Solution (source code)

= Solution
{c}

For an $m\times n$ <matrix>, the corresponding <elementary matrices> are $m\times m$, because the operation is implemented by left <matrix multiplication>. Apply the desired <elementary row operation> to the <identity matrix> $I_m$. Writing $E_{ij}$ for the <matrix unit> with its only nonzero entry, $1$, in position $(i,j)$ gives:
$$
\begin{aligned}
P_{ij}&=I_m-E_{ii}-E_{jj}+E_{ij}+E_{ji},
& P_{ij}^{-1}&=P_{ij},\\
D_i(c)&=I_m+(c-1)E_{ii},
& D_i(c)^{-1}&=D_i(c^{-1})\quad(c\ne0),\\
L_{ij}(c)&=I_m+cE_{ij},
& L_{ij}(c)^{-1}&=L_{ij}(-c)\quad(i\ne j).
\end{aligned}
$$
Indeed, these <matrix products> interchange rows $i,j$, scale row $i$, and add $c$ times row $j$ to row $i$, respectively. The displayed inverses undo precisely those operations. Algebraically, $E_{ij}^2=0$ when $i\ne j$, so $(I_m+cE_{ij})(I_m-cE_{ij})=I_m$; the other two inverse identities follow immediately from their row actions. Thus every <elementary matrix> is an <invertible matrix>.