Maximum number of linearly independent non-commuting matrices Let $S$ be a set of non-commuting, linearly independent $d \times d$ positive definite matrices (i.e., for any $A \neq B$, $[A, B] = AB - BA \neq 0$). Is there any upper bound for the number of elements the set $S$ contains? (It is clear that it must be equal to or smaller than $d^2$. Any reference to a book/article is appreciated).
By positive definite matrix I mean matrices in the form $A = M^{\dagger}M$ where $M$ is a $d \times d$ invertible matrix over the field $\mathbb{C}$. Linear independence, however, is (necessarily) considered over $\mathbb{R}$, e.g., $A \neq a_1 B + a_2 C$ for any $a_1, a_2 \in \mathbb{R}$ and $A,B,C \in S$.
 A: The sharp upper bound is $d^2$. For each $d$ we may construct a feasible set $S_d$ that is also a basis of the real vector space of all $d$-rowed Hermitian matrices.
When $d=1$, take $S_1=\{I_1\}$. Now suppose that for some $d\ge1$ we have constructed a feasible set $S_d$. Pick some $a>0$ that is not an eigenvalue of any matrix in $S_d$. Let $\{e_1,e_2,\ldots,e_d\}$ be the standard basis of $\mathbb C^d$ and let $e=\sum_je_j$ be the vector of ones. Put the following four classes of matrices into $S_{d+1}$:
\begin{cases}
\pmatrix{A&0\\ 0&a}&\text{for each $A\in S_d$},\\
\pmatrix{2I&e_j\\ e_j^\top&1}&\text{for each $j\in\{1,2,\ldots,d\}$},\\
\pmatrix{2I&ie_j\\ -ie_j^\top&1}&\text{for each $j\in\{1,2,\ldots,d\}$, where $i=\sqrt{-1}$},\\
\pmatrix{2dI&e\\ e^\top&d+1}.\\
\end{cases}
Clearly all matrices in the first three classes are positive definite. The sole matrix in the fourth class is also positive definite because it is a strictly diagonally dominant real symmetric matrix with a positive diagonal. One may verify that no two matrices in $S_{d+1}$ commute:

*

*Matrices in the first class in $S_{d+1}$ do not commute among themselves because matrices in $S_d$ do not commute.

*Matrices in the first class do not commute with matrices in the other three classes because $a$ is not an eigenvalue of $A$ and
$$
\pmatrix{A&0\\ 0&a}\pmatrix{\ast&u\\ \ast&\ast}
=\pmatrix{\ast&Au\\ \ast&\ast}
\neq\pmatrix{\ast&au\\ \ast&\ast}
=\pmatrix{\ast&u\\ \ast&\ast}\pmatrix{A&0\\ 0&a}\\
$$
whenever $u\ne0$.

*Matrices in the second and the third classes do not commute, because
$$
\pmatrix{2I&u\\ \ast&1}\pmatrix{2I&v\\ \ast&1}
=\pmatrix{\ast&2v+u\\ \ast&\ast}
\neq\pmatrix{\ast&2u+v\\ \ast&\ast}
=\pmatrix{2I&v\\ \ast&1}\pmatrix{2I&u\\ \ast&1}
$$
whenever $u\ne v$.

*Matrices in the second or the third classes do not commute with the matrix in the fourth class. In fact, when $u=e_j$ or $ie_j$, we have $e\ne(d-1)u$. Therefore
\begin{aligned}
&\pmatrix{2I&u\\ \ast&1}\pmatrix{2dI&e\\ \ast&d+1}
=\pmatrix{\ast&2e+(d+1)u\\ \ast&\ast}\\
\ne\,&\pmatrix{2dI&e\\ \ast&d+1}\pmatrix{2I&u\\ \ast&1}
=\pmatrix{\ast&e+2du\\ \ast&\ast}.
\end{aligned}
Since $S_{d+1}$ has precisely $(d+1)^2$ matrices, to show that it is linearly independent over $\mathbb R$, it suffices to show that its real linear span is the real vector space of all $(d+1)$-rowed Hermitian matrices. First, note that
$$
\pmatrix{0_{d\times d}&0\\ 0&1}=\pmatrix{2dI&e\\ e^\top&d+1}-\sum_j\pmatrix{2I&e_j\\ e_j^\top&1}\in\operatorname{span}_{\mathbb R}(S_{d+1}).
$$
Consequently, for every $A\in S_d$ and every $j\in\{1,2,\ldots,d\}$, the matrices $\pmatrix{A&0\\ 0&0},\pmatrix{0&e_j\\ e_j^\top&0}$ and $\pmatrix{0&ie_j\\ -ie_j^\top&0}$ also lie inside $\operatorname{span}_{\mathbb R}(S_{d+1})$. Therefore the real linear span of $S_{d+1}$ is the set of all $(d+1)$-rowed Hermitian matrices.
