# Calculating the dimension of the algebra generated by some given matrices

Let $X_1, X_2, \ldots, X_d$ be $n \times n$ matrices over some field $K.$ I want to calculate the dimension of the unital algebra generated by $X_1, X_2, \ldots, X_d$ for some examples in a problem I am working on. If $d=1,$ we only have one $X,$ and the dimension is equal to the degree of the minimum polynomial of $X.$ For $d>1,$ the problem, is less clear. For example, the unital algebra generated by $$X_1=\left(\begin{matrix} 0 & 1 \\ 0 & 0 \end{matrix}\right), X_2=\left(\begin{matrix} 1 & 0 \\ 0 & 0 \end{matrix}\right)$$ is three dimensional.

Is there a good theoretical characterization of calculating the dimension in general? That is, is there some relatively easy to understand object (like the minimum polynomial) which gives you the dimension?

EDIT: Here, I'm interested if there are known solutions to the problem which are algorithmically fast and not the generic case.

Your $X_1,X_2$ have a common invariant subspace $span([1,0]^T)$. If $K$ is algebraically closed and if $X_1,X_2$ have no non-trivial common invariant subspaces (in particular if $X_1,X_2$ are randomly chosen), then the algebra generated by $X_1,X_2$ is $M_n(K)$ (according to the Burnside Theoerem).