Solution (source code)

= Solution

Each <elementary matrix> is obtained by applying one invertible elementary row operation to the <identity matrix>. Its inverse is the elementary matrix for the reverse operation. A product of <elementary matrices> is therefore invertible and has full <rank> $n$.

Conversely, if $\operatorname{rank}A=n$, <Gaussian elimination> has a pivot in every column and reduces $A$ to the identity. Writing the successive row operations as left multiplication gives $E_r\cdots E_1A=I$. Hence $A=E_1^{-1}\cdots E_r^{-1}$, a product of <elementary matrices>. This proves both directions of the <elementary-matrix factorization theorem>.