Solution (source code)

= Solution

An <elementary matrix> acts on rows by left multiplication. In the stated order, the three matrices are
$$
\boxed{E_s=\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&3&0\\0&0&0&1\end{pmatrix},\quad E_a=\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&-3&0&1\end{pmatrix},\quad E_p=\begin{pmatrix}0&0&0&1\\0&1&0&0\\0&0&1&0\\1&0&0&0\end{pmatrix}.}
$$
The first scales row 3, the second adds $-3$ times row 2 to row 4, and the third swaps rows 1 and 4. Right multiplication would instead perform column operations.