Smith Normal Form I would like to put this matrix below into Smith Normal Form over $\mathbb{Q}[x]: $
$$\left(
\begin{array}{ccc}
7 & x & 0 & -x \\
0 & x-3 & 0 & 3\\
0 & 0 & x-4 & 0 \\
x-6 & -1 & 0 & x+1 
\end{array}
\right)$$
but I am stuck here:
$$\left(
\begin{array}{ccc}
7 & 0 & 0 & -x \\
0 & x & 0 & 3\\
0 & 0 & x-4 & 0 \\
8x+22 & x & 0 & -x^2-3x+1 
\end{array}
\right)$$ 
I'm not sure how to proceed. Any help is appreciated. 
 A: Here are the first few steps as per my suggestion in the comments:
\begin{align*}
\left(\begin{array}{rrrr}
x & 7 & 0 & -x \\
x - 3 & 0 & 0 & 3 \\
0 & 0 & x - 4 & 0 \\
-1 & x - 6 & 0 & x + 2
\end{array}\right) &\leadsto
\left(\begin{array}{rrrr}
-1 & x - 6 & 0 & x + 2 \\
x - 3 & 0 & 0 & 3 \\
0 & 0 & x - 4 & 0 \\
x & 7 & 0 & -x
\end{array}\right)\\
\left(\begin{array}{rrrr}
1 & -x + 6 & 0 & -x - 2 \\
x - 3 & 0 & 0 & 3 \\
0 & 0 & x - 4 & 0 \\
x & 7 & 0 & -x
\end{array}\right) &\leadsto
\left(\begin{array}{rrrr}
1 & -x + 6 & 0 & -x - 2 \\
0 & x^{2} - 9 x + 18 & 0 & x^{2} - x - 3 \\
0 & 0 & x - 4 & 0 \\
0 & x^{2} - 6 x + 7 & 0 & x^{2} + x
\end{array}\right)\\
\left(\begin{array}{rrrr}
1 & 0 & 0 & 0 \\
0 & x^{2} - 9 x + 18 & 0 & x^{2} - x - 3 \\
0 & 0 & x - 4 & 0 \\
0 & x^{2} - 6 x + 7 & 0 & x^{2} + x
\end{array}\right)
&\leadsto
\left(\begin{array}{rrrr}
1 & 0 & 0 & 0 \\
0 & x - 4 & 0 & 0 \\
0 & 0 & x^{2} - 9 x + 18 & x^{2} - x - 3 \\
0 & 0 & x^{2} - 6 x + 7 & x^{2} + x
\end{array}\right)
\end{align*}
Can you take it from here?  In the end, I get
$$
\left(\begin{array}{rrrr}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & x^{4} - 3 x^{3} - 11 x^{2} + 7 x + 84
\end{array}\right)
$$
for the Smith normal form.
