> [!NOTE] Lemma (Smith Normal Form)
> Let $R$ be a [[Principal Ideal Domain|principal ideal domain]]. Every [[Matrix|matrix]] $A \in \operatorname{Mat}_{n \times m}(R)$ with entries in $R$ is [[Equivalence of Matrices|equivalent]] to a matrix in Smith normal form:
>
> There exist invertible matrices $P \in \operatorname{Mat}_{n \times n}(R)$ and $Q \in \operatorname{Mat}_{m \times m}(R)$ such that the product matrix $P A Q$ is of the following form:
>
> $\begin{gathered}
> \text { PAQ = } \\
> \left[\begin{array}{cccccccc}
> a_1 & 0 & \cdots & \cdots & \cdots & \cdots & \cdots & 0 \\
> 0 & a_2 & 0 & \cdots & \cdots & \cdots & \cdots & 0 \\
> 0 & 0 & a_3 & 0 & \cdots & \cdots & \cdots & 0 \\
> \vdots & \vdots & \vdots & \ddots & \cdots & \cdots & \cdots & \cdots \\
> 0 & 0 & \cdots & \cdots & a_m & 0 & \cdots & 0 \\
> \vdots & \vdots & \vdots & \vdots & 0 & 0 & \cdots & 0 \\
> 0 & 0 & \cdots & \cdots & \cdots & \cdots & \cdots & 0
> \end{array}\right]
> \end{gathered}$
>
> such that each $a_i$ [[Divisibility|divides]] $a_{i+1}$.
###### Proof