Let $\langle A,B \rangle = \text{tr}(B^TA)$. For $M_n(\mathbb{R}$): Find the orthogonal complement of the diagonal-square-matrices.
So I need to find $$U^{\perp} = \left\{ A\in M_n(\mathbb{R}) \mid \forall B\in \{\text{diagonal-square matrices}\}: \langle A,B \rangle = 0 \right\}$$
Hence,
$$\langle A,B \rangle = 0 \iff \text{tr}(B^TA) = 0 \iff \text{tr}(BA) = 0$$
So $A$ is a square matrix and $B$ is every possible square-diagonal matrix. So it must be that $A=0$, isn't it?
It is not the case that $A$ must be $0$. For example, when $n = 2$, the element $$ A = \pmatrix{0&1\\0&0} $$ is a member of $U^\perp$.
Hint: Because $B$ is diagonal, we have $$ \operatorname{trace}(BA) = \sum_{i=1}^n a_{ii}b_{ii} $$ Where $a_{ij}$ and $b_{ij}$ are the entries of $A$ and $B$ respectively. Try different combinations of $b_{ii}$. Note that the above sum says nothing about $a_{ij}$ when $i \neq j$.