Finding Invariant Factors of a Matrix I am trying to find the invariant factors of the matrix
$$A = \begin{pmatrix} 1 & 1 & 0 \\ 1 & 1 & 0 \\ 3 & 2 & 2 \\ \end{pmatrix}$$
From what I gather, I have to use elementary row operations on $xI - A$ until I obtain a diagonal matrix, and the nonzero diagonal entries form the invariant factors of $A$. Well, I tried this multiple times and these are some of the results of what I got:
$$\begin{pmatrix} (1-x)(x^2-2x) & 0 & 0 \\ 0 & -x^2 + 2x & 0 \\ 0 & 2x + 1 & 2-x \\ \end{pmatrix}$$
$$\begin{pmatrix} (x-1)^3 & 0 & 0 \\ 0 & (x-1)^2 & 0 \\ 0 & 0 & (x-2)(x-1)^3 \\ \end{pmatrix}.$$
$$\begin{pmatrix} (x-1)^3 & 0 & 0 \\ 0 & (x-1)^2 & 0 \\ 0 & 0 & (x-2)(x-1)^3 \\ \end{pmatrix}.$$
But none of these seem right. Either the degree of the polynomials is too high or the right divisibility relation does not hold. I don't know what I am doing wrong. I am very awful at calculating, but I didn't think I was that awful.
Perhaps there is an easier way. I know that the largest invariant factor is the minimal polynomial, and the minimal polynomial divides the characteristic polynomial. A quick calculation (which wolframalpha did for me, because I don't trust myself) reveals that $p_{A}(x) = -x(x-2)^2$ is the minimal polynomial. Clearly $x$ and $x-2$ are not the minimal polynomials of $A$, so $m_A(x) = (x-2)^2$ is the minimal polynomial of $A$. At this point, can I conclude what the invariant factors of $A$ are? I know they have to divide $m_A$.
 A: Here is a quick way to find the invariant factors.
First, compute the characteristic polynomial $p(x) = \det(xI - A) = x(x-2)^2$. Each degree $1$ factor of the characteristic polynomial must be a factor of the minimal polynomial, so the minimal polynomial is either $x(x-2)$ or $x(x-2)^2$.
One way to show that the minimal polynomial is not $x(x-2)$ is to compute $A(A-2I)$ and verify that you do not end up with the zero matrix.
Alternatively, it suffices to find the rank of $A - 2I$. Note that if $A$ has minimal polynomial $x(x-2)$ (i.e. the minimal polynomial is a product of distinct degree one factors), then $A$ must be diagonalizable. This would mean that we have $\dim\ker(A - 0I) + \dim \ker(A - 2 I ) = 3$. We must have $\dim \ker A = 1$ since $0$ is an eigenvalue of algebraic multiplicity $1$. We find that $\dim \ker (A - 2 I) = 1$ (or correspondingly that $A - 2 I$ has rank $2$), which means that the sum of the dimensions of the kernels is not equal to $3$, which means that $A$ is not diagonalizable, which means that the minimal polynomial must be $x(x-2)^2$.
Since the characteristic and minimal polynomials are equal, deduce that $x(x-2)^2$ is the only invariant factor of $A$.
