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?

The "first" $2\times 2$ principal block is clearly not an $x-1,x-1$ block as it is not the identity. Nor is the "other" $2\times 2$ principal block since it is not the identity. So we have two $(x-1)^2$ blocks.
• Why the "first" $2\times 2$ principal block cannot be an $x-1,x-1$ block? – Kenneth.K Apr 16 '17 at 18:08
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$.