# Find the Smith Normal Form of xI - A

So for a homework in my Abstract Algebra class we are to find the invariant factors of a matrix using the Smith Normal Form. The matrix is rather large, so I was trying a 3x3 sub matrix first to just make sure I could get something simpler into SNF before embarking on the 7x7 case. So we have a matrix $$A =\pmatrix{1&1&0\\ 11&4&0\\0&0&0}$$ and I want to find the SNF of $$xI-A = \pmatrix{x-1&-1&0\\-11&x-4&0\\0&0&x}$$ Following something from Dummit & Foote I am just going to do elementary row and column operations to get down to a diagonal matrix whose entries divide each other (going left to right). Unfortunately when I went about this the matrix I ended up with was indeed diagonal but I did not get the dividing condition. So my question is if there is a specific sequence of operations which will get me to SNF (i.e. not every reduction will result in SNF) or if I somehow made a mistake. Here are the operations I did

$$\pmatrix{x-1&-1&0\\-11&x-4&0\\0&0&x}\to\pmatrix{x-2&-1&0\\x-15&x-4&0\\0&0&x}\to\pmatrix{13&3-x&0\\x-15&x-4&0\\0&0&x}\to\pmatrix{1&\frac{3-x}{13}&0\\x-15&x-4&0\\0&0&x}\to\pmatrix{1&0&0\\x-15&\frac{x^2-5x-7}{13}&0\\0&0&x}\to\pmatrix{1&0&0\\0&\frac{x^2-5x-7}{13}&0\\0&0&x}\to\pmatrix{1&0&0\\0&x^2-5x-7&0\\0&0&x}\to\pmatrix{1&0&0\\0&x&0\\0&0&x^2-5x-7}$$

Without using TikZ I wasn't sure how to put the column operations above the arrows so my operations are:

$$C_1+C_2\mapsto C_1; R_1-R_2\mapsto R_1; \frac{1}{13}R_1\mapsto R_1; \frac{1}{13}(x-3)C_1 + C_2\mapsto C_2; (15-x)R_1 +R_2 \mapsto R_2; 13R_2\mapsto R_2$$

Then my last operation just moves the diagonal terms. So as can be seen I certainly get a diagonal matrix but $x\nmid x^2-5x-7$. So is it the case that there is a very specific way to get it to the correct form and other ways will fail? Because as it was explained in class it seemed that you could just go about it any way that makes the pivot column and row zero first. Any help is appreciated.

EDIT:Will also answered below, so I'll give him the 'correct' answer but I also figured out the answer to my own question via a similar, but different set of steps. From where I left of I will get $$\to\pmatrix{1&0&0\\0&x&x^2-5x-7\\0&0&x^2-5x-7}=\pmatrix{1&0&0\\0&x&x(x-5)-7\\0&0&x^2-5x-7}\to\pmatrix{1&0&0\\0&x&-7\\0&0&x^2-5x-7}\to\pmatrix{1&0&0\\0&-7&x\\0&x^2-5x-7&0}\to\pmatrix{1&0&0\\0&-7&0\\0&x^2-5x-7&\frac{1}{7}x(x^2-5x-7)}\to\pmatrix{1&0&0\\0&1&0\\0&x^2-5x-7&\frac{1}{7}x(x^2-5x-7)}\to\pmatrix{1&0&0\\0&1&0\\0&0&\frac{1}{7}x(x^2-5x-7)}\to\pmatrix{1&0&0\\0&1&0\\0&0&x(x^2-5x-7)}$$

Which is now in Smith Normal Form, but again Will's answer above is just as good.

To fix the $2\times 2$ block in the lower right, do $$\begin{bmatrix}x & 0\\0 & x^2-5x-7\end{bmatrix}\to \begin{bmatrix}x & x\\0 & x^2-5x-7\end{bmatrix}\to \begin{bmatrix}x & x\\-x^2 & -5x-7\end{bmatrix}\to \begin{bmatrix}x & x\\-x^2+5x & -7\end{bmatrix}\to \begin{bmatrix}-\frac{1}{7}x^3+\frac{5}{7}x^2+x & 0\\-x^2+5x & -7\end{bmatrix}\to \begin{bmatrix}-\frac{1}{7}x^3+\frac{5}{7}x^2+x & 0\\0 & -7\end{bmatrix}\to \begin{bmatrix}x^3-5x^2-7x & 0\\0 & 1\end{bmatrix}\to \begin{bmatrix}1 & 0\\0 & x^3-5x^2-7x \end{bmatrix}.$$ The operations are

1. add column 1 to column 2
2. subtract $x$ times row 1 from row 2
3. add $5$ times row 1 to row 2
4. add $\frac{1}{7}x$ times row 2 to row 1
5. add $-\frac{1}{7}(x^2-5x)$ times column 2 to column 1
6. multiply row 1 by $-7$ and row 2 by $-\frac{1}{7}$
7. swap rows 1 and 2 and columns 1 and 2.

In Steps 2, 3, and 4 we are using the Euclidean algorithm to place the GCD of the elements in column 2 in the lower right corner.