# Orthogonal basis for $\operatorname{Tr}(AB)$

I recently stumbled across this bilinear form: $\beta(A,B)=\operatorname{Tr}(AB)$ for $A,B \in \mathbb{R}^{n,n}$. I am searching for an orthogonal basis. With many difficulties I could find one for $\mathbb{R}^{2,2}$ namely:

$$B_{2,2}=\left\{\left( \begin{array}{cc} \frac{1}{\sqrt{2}} & 0 \\ 0 & \frac{1}{\sqrt{2}} \end{array} \right),\left( \begin{array}{cc} 0 & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & 0 \end{array} \right),\left( \begin{array}{cc} \frac{1}{\sqrt{2}} & 0 \\ 0 & -\frac{1}{\sqrt{2}} \end{array} \right),\left( \begin{array}{cc} 0 & -\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & 0 \end{array} \right)\right\}$$

This form was also made that the representation matrix of $\beta$ is very elegant:

$$M_\beta=\left( \begin{array}{cccc} \beta \left(b_1,b_1\right) & \beta \left(b_1,b_2\right) & \beta \left(b_1,b_3\right) & \beta \left(b_1,b_4\right) \\ \beta \left(b_2,b_1\right) & \beta \left(b_2,b_2\right) & \beta \left(b_2,b_3\right) & \beta \left(b_2,b_4\right) \\ \beta \left(b_3,b_1\right) & \beta \left(b_3,b_2\right) & \beta \left(b_3,b_3\right) & \beta \left(b_3,b_4\right) \\ \beta \left(b_4,b_1\right) & \beta \left(b_4,b_2\right) & \beta \left(b_4,b_3\right) & \beta \left(b_4,b_4\right) \end{array} \right)=\left( \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \end{array} \right)$$

So I can read the positive index of inertia (basically the number of 1s on the diagonal) which is in this case $n_+=3$. I am looking for such bases for higher dimensions of $\mathbb{R}^{n,n}$ but could not succeed. Thank you in advance.

-

You can construct an orthogonal basis with only $1$ and $-1$ on the diagonal by starting from the canonical basis $(b_{kl})_{ij}=\delta_{ik}\delta_{jl}$. The products are all zero except when the two factors are transposes of each other. Thus, each basis element $b_{kl}$ with $k=l$ is already orthogonal to all the others, and the remaining basis elements form pairs of transposes. You can form linear combinations of these pairs with coefficients $\pm 1/\sqrt{2}$ like you did for $n=2$ to from orthogonal combinations of them, one with "norm" $1$ and one with $-1$. Thus, the positive index of inertia is $n+\frac{n(n-1)}{2}=\frac{n(n+1)}{2}$.