# Complement of $n\times n$ matrices vector spaces over $\mathbb{R}$

Let $V$ be the vector space of all $n\times n$ matrices over $\mathbb{R}$, and define the scalar product of two matrices $A,B$ by

$\langle A,B\rangle=\operatorname{tr}(AB)$, where $\operatorname{tr}$ is the trace (sum of the diagonal elements). Describe the orthogonal complement of the subspace of diagonal matrices. What is the dimension of this orthogonal complement?

I do not understand what is the description of the "orthogonal complement of the subspace of diagonal matrices". In what concerns the dimension I remembered the theorem that states:$\dim W+\dim W^{\bot}=\dim V$ in which $W$ is a subspace of $V$.

Questions:

1) How do I answer this question?

2) Could someone provide me a proof?

Questions

• The vector space of diagonal matrices has a canonical basis. You have to find the vectors from the canonical basis of $M_n (\mathbb {R} )$ that are orthogonal over those vectors. They generate the complement. – rafa Jun 27 '17 at 17:08
• @rafa What is a canonical basis? – Pedro Gomes Jun 27 '17 at 17:10
• the subspace of diagonal matrices: $\mathfrak D=\{D \mid D_{i,j}=0, \forall i\neq j\}$, its complement: $\mathfrak D^\perp = \{M\mid \langle M,D\rangle=0, \forall D \in \mathfrak D\}$. – Surb Jun 27 '17 at 17:11
• What is the dimension of diagonal subspace. It is $n$, as I have written one of its basis in the answer. Any complement has dimension then $n^{2}-n$. – Riju Jun 27 '17 at 17:21
• By the way is $\langle A,B \rangle = Tr(AB)$ an innerproduct? It doesn't seem so! – Riju Jun 27 '17 at 17:35

Let $E_{ij}$ denote the matrix with $1$ in $ij^{th}$ position and $0$ otherwise. For $1 \leq i \leq n$ and $1 \leq j \leq n$, this is a basis for $M_{n\times n}(\mathbb{R})$. And $E_{ii}(1\leq i \leq n)$ forms a basis for the diagonal subspace. Also $E_{ij}E_{kl}=\delta_{jk}E_{il}$, where $\delta_{jk}$ is $1$ if $j=k$, otherwise it is $0$. So the basis for the subspace is clearly a orthogonal basis. Now, the extended basis for the whole space is as described above. Now just use the Gram-schimdt Orthogonalization process to orthogonalize this basis keeping the basis for the subspace same. Whatever vectors you get except the $E_{ii}$'s is a basis for the complement.

• I am not understanding your answer. Could you use matrix notation? I do not use Kronecker Delta stil. Those are the reasons I down voted. – Pedro Gomes Jun 27 '17 at 17:21
• I just wrote what $\delta_{jk}$ means. – Riju Jun 27 '17 at 17:24
• How do I apply Gram-Schmidt orthogonalization process in the diagonal basis in this specific case? How do you get $n^2-n$ as dimension of the complement, I mean the $n^2$? – Pedro Gomes Jun 27 '17 at 17:28
• Ok what is the dimension of the vector space $M_{n \times n}(\mathbb{R})$? What is the dimension of the subspace? If $V=U \oplus W$, then $dim(V)=dim(U)+dim(W)$, follows from the dimension theorem. – Riju Jun 27 '17 at 17:31
• Sorry but I have not yet covered that theorem. – Pedro Gomes Jun 27 '17 at 17:36

You can check by direct computation that a matrix $A=(a_{ij})_{1\le i,j\le n}$ is orthogonal to the diagonal matrix $D=(\lambda_1,\dots,\lambda_n)$ if and only if $$\lambda_1a_{11}+\dots+\lambda_n a_{nn}=0.$$ Hence it is orthogonal to all diagonal matrices if and only if $a_{11}=\dots= a_{nn}=0$, i.e. its diagonal elements are $0$. Clearly this subspace is isomorphic to $\mathbf R^{n^2-n}$.

• How do you get $n^2-n$? – Pedro Gomes Jun 27 '17 at 18:11
• This is the number of non-diagonal elements in an $n\times n$ matrix. – Bernard Jun 27 '17 at 18:15
• By a ‘standard basis’, I suppose you mean matrices $E_{ij}$ with all coefficients equal to $0$, except it has $1$ in the $(i,j)$ position? – Bernard Jun 27 '17 at 18:20
• yes, but I have already got it – Pedro Gomes Jun 27 '17 at 18:21
• It's the same as what I said: you remove the $E_{ii}$s from this basis, and you obtain your basis of the orthogonal complement. – Bernard Jun 27 '17 at 18:23