Find the rational canonical form of a matrix from its minimal and characteristic polynomials 
What is the rational canonical form of $A$?
  $$A=\begin{bmatrix}
    1       & 1 & 0 & 0 \\
    0       & 1 & 0 & 0 \\
    2      & 3 & -1 & 4\\
   1     & 1 & -1 & 3\\
\end{bmatrix}$$

I found that the minimal polynomial $m_A(x)=(x-1)^2$ and the characteristic polynomial $c_A(x)=(x-1)^4$. Therefore the invariant factors can be 
$$x-1,x-1,(x-1)^2$$
or
$$(x-1)^2,(x-1)^2$$
Therefore the rational canonical form may be
$$\begin{bmatrix}
    1      & 0 & 0 & 0 \\
    0       & 1 & 0 & 0 \\
    0     & 0 & 0 & -1\\
  0    & 0 & 1 & 2\\
\end{bmatrix}$$
or
$$\begin{bmatrix}
    0      & -1 & 0 & 0 \\
    1       & 2 & 0 & 0 \\
    0     & 0 & 0 & -1\\
  0    & 0 & 1 & 2\\
\end{bmatrix}$$
How do I quickly figure out which one is the correct one?

If the first matrix is the rational form of $A$, we should have $\dim \ker (A - I) = 3$ (because this is true for the rational form and so it should be true for $A$ as well) while if the second matrix is the rational form of $A$, we should have $\dim \ker(A - I) = 2$. Just check which of those two options holds for $A$ by computing the rank of $A - I$.
