A bit of trouble computing the Smith normal form of a matrix?

I am trying to diagonalize the following $\lambda-$matrix:

$$\left( \begin{array}{cccc} -\lambda -16 & -17 & 87 & -108 \\ 8 & 9-\lambda & -42 & 54 \\ -3 & -3 & 16-\lambda & -18 \\ -1 & -1 & 6 & -\lambda -8 \\ \end{array} \right)$$

I am allowed to do the following:

enter image description here

enter image description here

But this is the best I could come up to:

$$\left( \begin{array}{cccc} \lambda -1 & 0 & 0 & 0 \\ -1 & 1-\lambda & 0 & 0 \\ 0 & 0 & -3 \lambda & 2-2 \lambda \\ -3 \lambda & 0 & 3 & 1-\lambda \\ \end{array} \right)$$

Are there tricks or heuristics to do that? The final result must be a matrix with only polynomials in the diagonal, I've been trying for hours but still can't make it.


Solution 1:

If you know the theory I would suggest you to use SageMath or Macaulay2 For SageMath:(If you use $x$ instead of $\lambda$ it would be easier.)

var('x')

M=Matrix([[first row],[second row],....,[last row]])

M.smith_form()

This should give you the smith form.

Solution 2:

This should get you going.

Pre-mutiply the matrix with:

$$ \Phi= \begin{bmatrix}1\\ & 1\\ & & 1\\ & & -1 & \frac{\lambda^{2}-8\lambda+7}{-9(2\lambda+1)} \end{bmatrix}\begin{bmatrix}1\\ & 1\\ & -1 & \frac{\lambda+8}{-8}\\ & -1 & & \frac{\lambda+8}{-8} \end{bmatrix}\begin{bmatrix}1\\ -1 & \frac{\lambda+16}{-8}\\ -1 & & \frac{\lambda+16}{3}\\ -1 & & & \frac{\lambda+16}{1} \end{bmatrix}$$

and you will get an upper triangular matrix.

Then post multiply with

$$ \Psi=\begin{bmatrix}1 & -1 & -1 & -1\\ & \frac{\lambda+16}{17}\\ & & \frac{\lambda+16}{-87}\\ & & & \frac{\lambda+16}{108} \end{bmatrix}\begin{bmatrix}1\\ & 1 & -1 & -1\\ & & \frac{29\left(\lambda^{2}+7\lambda-8\right)}{34\left(4-7\lambda\right)}\\ & & & \frac{2\left(\lambda^{2}+7\lambda-8\right)}{-17\lambda} \end{bmatrix}\begin{bmatrix}1\\ & 1\\ & & 1 & -1\\ & & & \frac{\lambda\left(7-\lambda\right)}{2\left(7\lambda-4\right)} \end{bmatrix} $$

Then with ${\rm A}=\begin{bmatrix}-\left(\lambda+16\right) & -17 & 87 & -108\\ 8 & 9-\lambda & -42 & 54\\ -3 & -3 & 16-\lambda & -18\\ -1 & -1 & 6 & -\left(\lambda+8\right) \end{bmatrix}$ you have the diagonalization as follows:

$$ \mathrm{D} = \Phi{\rm A}\Psi=\begin{bmatrix}\ddots\\ & \ddots\\ & & \ddots\\ & & & \ddots \end{bmatrix} $$

The matrices are found in stages trying to make each column under the i-th diagonal zero.

The general form for the i-th column is (here $k=i+1 \ldots n$)

$$\small \begin{bmatrix}1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & -1 & \frac{A_{ii}}{A_{ki}} & 0\\ 0 & -1 & 0 & \frac{A_{ii}}{A_{ni}} \end{bmatrix}\begin{bmatrix}A_{11} & A_{1i} & A_{1k} & A_{1n}\\ 0 & A_{ii} & A_{ik} & A_{in}\\ 0 & A_{ki} & A_{kk} & A_{kn}\\ 0 & A_{ni} & A_{nk} & A_{nn} \end{bmatrix}=\begin{bmatrix}A_{11} & A_{1i} & A_{1k} & A_{1n}\\ 0 & A_{ii} & A_{ik} & A_{in}\\ 0 & 0 & \frac{A_{ii}}{A_{ki}}A_{kk}-A_{ik} & \frac{A_{ii}}{A_{ki}}A_{kn}-A_{in}\\ 0 & 0 & \frac{A_{ii}}{A_{ni}}A_{nk}-A_{ik} & \frac{A_{ii}}{A_{ni}}A_{nn}-A_{in} \end{bmatrix}$$

At least for $\Phi$, and for $\Psi$ I did the exact same thing to $A^\top$. So in the answer, I cheated a bit, because the diagonalization is $ \mathrm{D} = \Phi{\rm A}\Psi^\top $ really. I just decided to present $\Phi^\top$ as $\Phi$ above for simplicity.