How to encode a linear transformation from $M_n(F) \to M_n(F)$ $\newcommand\nullspace{\mathscr{N}}$
$\newcommand\F{\mathbb F}$
$\renewcommand\vec{\mathbf}$
I'm taking a linear algebra course and we recently proved that any linear transformation from an $m$-dimensional vector field $V$ to an $n$-dimensional vector field $W$ can be encoded as some matrix $A \in M_{m \times n}(\F)$, where $\F$ is the scalar field of $V$ and $W$.
I was asked to find the range and nullspace of the linear transformation $L: M_2(\mathbb{R}) \to M_2(\mathbb{R})$ given by
$$\begin{equation*}
     L\begin{pmatrix}
        a & b \\
        c & d
     \end{pmatrix} = \begin{pmatrix}
        b-c & d-a \\
        c-b & a-d
     \end{pmatrix}.
\end{equation*}$$
My initial approach was to solve for $\nullspace(L)$ and $\mathscr{R}(L)$ by finding the matrix representation $A$ of $L$ and solving $A \vec{x} = \vec{0}$ for the null space and $A ^T \vec{x} = \vec{0}$ for the column space. However, I couldn't derive a matrix $A \in M_2(\mathbb{R})$ that encoded the transform. I conjectured that $M_2(\mathbb{R})$ is in fact 4-dimensional because the set
$$\begin{equation*}
\left\{\begin{pmatrix}
    1 & 0 \\
    0 & 0
\end{pmatrix}, \begin{pmatrix}
    0 & 1 \\
    0 & 0
\end{pmatrix}, \begin{pmatrix}
    0 & 0 \\
    1 & 0
\end{pmatrix}, \begin{pmatrix}
    0 & 0 \\
    0 & 1
\end{pmatrix}\right\}
\end{equation*}$$
is linearly independent and spans $M_n(\mathbb{R})$, but it's impossible to left-multiply an element of $M_n(\mathbb{R})$ by a $4 \times 4$ matrix.
How do I represent the linear transformation as a matrix?
 A: I'll stick to $M_2$ for concreteness but everything I'm about to say generalizes to $M_n$. You're correct that $M_2$ is $4$-dimensional; the "standard" choice for a basis is the matrices $E_{11}, E_{12}, E_{21}, E_{22}$ which have a $1$ in the entry determined by their subscript and $0$s otherwise. When you write a matrix as a linear combination of elements of this basis you get
$$M = \left[ \begin{array}{cc} m_{11} & m_{12} \\ m_{21} & m_{22} \end{array} \right] = \sum_{1 \le i, j \le 2} m_{ij} E_{ij}.$$
In other words, you've converted the $2 \times 2$ matrix into a vector $\left[ \begin{array}{c} m_{11} \\ m_{12} \\ m_{21} \\ m_{22} \end{array} \right]$. This operation is called vectorization and denoted $\text{vec}$, although as a warning it's highly non-unique: it depends on a choice of ordered basis of matrices, and different choices (even the same basis with a different ordering) will give you different vectors. Then you multiply this vector by a $4 \times 4$ matrix, then "de-vectorize" the result back into a matrix. With respect to this basis, $L$ has the $4 \times 4$ matrix
$$\left[ \begin{array}{cccc} 0 & 1 & -1 & 0 \\
 -1 & 0 & 0 & 1 \\
 0 & -1 & 1 & 0 \\
 -1 & 0 & 0 & -1 \end{array} \right].$$
A certain kind of person will find this conceptually unsatisfying because of the need to make a highly non-unique choice, but it's worth knowing at least theoretically that linear transformations on matrices are themselves just bigger matrices and don't require any new theory to describe.
