Canonical: https://knowlpedia.com/algebra-modules/smith-normal-form-theorem/

# Smith normal form theorem

A matrix over a PID can be diagonalized with divisibility conditions on the diagonal.

**Smith normal form theorem**: Let \(R\) be a [PID](https://knowlpedia.com/algebra-rings/pid/) and let \(A\) be an \(m\times n\) matrix with entries in \(R\). Then there exist invertible matrices \(U\in \mathrm{GL}_m(R)\) and \(V\in \mathrm{GL}_n(R)\) such that
\[
UAV=\mathrm{diag}(d_1,\dots,d_r,0,\dots,0),
\]
where \(d_i\neq 0\) for \(1\le i\le r\) and \(d_1\mid d_2\mid \cdots \mid d_r\). The \(d_i\) are determined uniquely up to multiplication by units; they are the Smith invariants (see [Smith normal form invariants](https://knowlpedia.com/algebra-modules/smith-normal-form-invariants/)).

Interpreting \(A\) as the matrix of a homomorphism between free modules (compare [matrix representation](https://knowlpedia.com/algebra-modules/matrix-representation/)), Smith normal form yields the invariant factor decomposition in the [structure theorem for finitely generated modules over a PID](https://knowlpedia.com/algebra-modules/structure-theorem-pid/) by identifying the cokernel as a direct sum of cyclic modules \(R/(d_i)\).

Reading \(A\colon R^n\to R^m\) as a homomorphism and writing \(D=UAV\), the square below commutes because \(AV=U^{-1}D\), so \(\operatorname{coker}A\cong\operatorname{coker}D\):

```tikz-cd
R^n \arrow[r, "D"] \arrow[d, "V"', "\cong"] & R^m \arrow[d, "U^{-1}", "\cong"'] \\
R^n \arrow[r, "A"'] & R^m
```
