When given the matrix $A$, how do I find integer matrices $C$ and $D$ so that $CAD$ is diagonal? To be more specific, I am looking for $C$ and $D$ when $A$ equals:
$$ \begin{pmatrix} 2 & 1 & 2 \\\ 1 & 2 & 2 \\\ 2 & 3 & 0 \\\ \end{pmatrix} $$
I have an idea how to find $S$ so that $S^{-1} A S$ is diagonal, but that's not the only type of matrices $C$ and $D$ that exist. Also, how do I find integer ones specifically?
Let $C=(c_{ij})$ and $D=(d_{ij})$ two integer matrices. Then $CAD=diag(r_1,r_2,r_3)$ is equivalent to a system of Diophantine equations. This is difficult to solve in general. However, it is possible to find some interesting solutions, i.e., except for $C=0$ or $D=0$. Since $10A^{-1}$ has integer coefficients we obtain the solution $$ C=\begin{pmatrix} 6 & -6 & 2 \cr -4 & 4 & 2 \cr 1 & 4 & -3 \end{pmatrix},\; D=\begin{pmatrix} 1 & 0 & 0 \cr 0 & 1 & 0 \cr 0 & 0 & 1\end{pmatrix}. $$ Then we have $$ CAD=\begin{pmatrix} 10 & 0 & 0 \cr 0 & 10 & 0 \cr 0 & 0 & 10\end{pmatrix}, $$ which is a diagonal matrix.