# Using Smith Normal Form to prove that even for a singular square matrix with entries in field $F$, $\exists U$ nonsingular where $(UA)^2 = UA$

How might I use Smith Normal Form of a matrix to show that even for a singular square matrix with entries in field $F$, $\exists U$ nonsingular (with entries in $F$) where $(UA)^2 = UA$? The conclusion seems to imply that if it is equivalent to showing that $(UA)^2(UA)^{-1}=(UA)(UA)^{-1}$ ie $UA = I$, which would imply that somehow you can use Smith Normal Form to show that $A$ is invertible even when its not? Maybe I am missing the point, but I thought the idea behind putting a matrix in SNF was that its a unique diagonalized form where the diagonal elements are determinintal divisors up to unit. In a field, everything is a unit except $0$, yet the SNF of a singular matrix is going to have a zero in the diagonal. How is this useful in helping me trying to invert a singular matrix?

-
What prevents you from taking $U=0$? – Martin Argerami Nov 20 '12 at 13:10
@MartinArgerami, actually, the statement is such that there is a non-singular $U$ with entries in $F$. My apologies. – tacos_tacos_tacos Nov 20 '12 at 13:16
Makes sense. That's why I asked. – Martin Argerami Nov 20 '12 at 13:17

Note that matrices are a ring, not a field: so $X^2=X$ does not necessarily imply that $X=I$. For example, $$\begin{bmatrix}1&0\\0&0\end{bmatrix}^2=\begin{bmatrix}1&0\\0&0\end{bmatrix}.$$ So there is no contradiction.
To find the $U$, you can write $A=SDT$, where $D$ is diagonal and $S,T$ are invertible matrices. Let $U_0$ be the diagonal matrix with $$(U_0)_{kk}=\begin{cases}1/D_{kk},&\text{ if }D_{kk}\ne0 \\ 1,&\text{ otherwise} \end{cases}$$ Then $U_0$ is a diagonal matrix with nonzero diagonal entries, so invertible. And $U_0D$ is a diagonal matrix with diagonal entries consisting of $1$ and $0$, so $(U_0D)^2=U_0D$.
Now let $U=T^{-1}U_0S^{-1}$. $$(UA)^2=(T^{-1}U_0S^{-1}SDT)^2=(T^{-1}U_0DT)^2=T^{-1}(U_0D)^2T=T^{-1}U_0DT=T^{-1}U_0S^{-1}SDT=UA.$$
When you define $U_0$ you leave the possibility that entry $kk$ might be 0 (if $D_{kk} != 0$), so I am not clear on why $U_0$ is a diagonal matrix with nonzero diagonal entries – tacos_tacos_tacos Nov 20 '12 at 13:37
Sorry, it was supposed to be a $1$. – Martin Argerami Nov 20 '12 at 13:38