Space spanned by matrices I have a set of $5 \times 5$ matrices, $M_1, M_2,\dots, M_{19}, M_{20}$. I want to try to find a basis from this set and also to find relationships between these matrices.
This is how I think I should approach the problem. First I want to look at the dimension of the space spanned by these $20$ matrices. This information will allow me to determine how many matrices I need to use as a basis. Once I have said basis I can write a computer program to solve the analogous question of $AX=b$.
My first question: This problem is straightforward with vectors, but now that matrices are involved I am lost. Can I create a vector out of each matrix?
To find relationships among the $20$ matrices, I will look at the space spanned by the kernel of these $20$ matrices. Again, I am not sure how to do this with matrices.
 A: Yes, it's enough to look at the matrices as vectors (by concatenating the columns, for example): as $K$-vector spaces, $K^{n \times n}$ (matrices) and $K^{n^2}$ (vectors) are isomorphic.
If you already know an algorithm for the problem with vectors, there's no need to modify it here.
A: We write
$$\alpha_1 \mathrm M_1 + \alpha_2 \mathrm M_2 + \cdots + \alpha_{20} \mathrm M_{20} = \mathrm O_5$$
Vectorizing, we obtain an overdetermined homogeneous system of $25$ equations in $20$ unknowns
$$\begin{bmatrix} | & | & & |\\ \mbox{vec} (\mathrm M_1) & \mbox{vec} (\mathrm M_2) & \dots & \mbox{vec} (\mathrm M_{20})\\ | & | & & |\end{bmatrix} \begin{bmatrix} \alpha_1\\ \alpha_2\\ \vdots\\ \alpha_{20}\end{bmatrix} = 0_{25}$$
A: Yes, you can treat each $n \times n$ matrix as vector of length $n^2$. Many ideas in linear algebra are related to this equivalency: for example, the inner product on $\mathbf{S}^n_+$ is defined as $\langle X, Y \rangle = \mbox{Tr} (XY)$, which is equivalent to the inner product on $\mathbb{R}^n$, $\langle x,y \rangle = x^T y$ if the matrices were written as vectors e.g. $x = \mbox{vec}(X)$.
