My question is motivated by [this one](https://mathoverflow.net/q/316985), but within real matrices instead of complex ones.



> 
> ${\bf Sym}\_n(\mathbb R)$ is a vector space of dimension $N=\frac{n(n+1)}2$. Equipped with the scalar product $\langle A,B\rangle={\rm Tr}(AB)$, this is a Euclidean space. Does there exist a basis $(R\_1,\ldots,R\_N)$, made of orthogonal matrices only ?
> 
> 
> 


In this situation, each element $U\_j$ satisfies $(U\_j)^2=I\_n$ and therefore is of the form $2\pi\_j-I\_n$, where $\pi\_j$ is an orthogonal projector, over some subspace $E\_j$ of $\mathbb R^n$.


Two observations. On the one hand, the answer is **No** when $n=3$. The basis may not contain $\pm I\_3$, because $\langle I\_3,R\_j\rangle=\pm1\ne0$ for $R\_j\ne\pm I\_3$. Therefore one may choose each $R\_j$ of the form $2x\_jx\_j^T-I\_3$ where $x\_j$ is a unit vector. The condition that $\langle R\_j,R\_k\rangle=0$ for $j\ne k$ writes $|\langle x\_j,x\_k\rangle|=\frac12$. Therefore $\|x\_j-x\_k\|=1$ or $\sqrt3$. The twelve unit vectors $\pm x\_j$ are such that the pairwise distances are either $1$, $\sqrt3$ or $2$ (for opposite vectors). In short, they should form a regular icosahedron (each vertex has five neighbours) inscribed in the unit sphere, whose edges have unit length ! This is false, since the edge of this icosahedron equals
$$\sqrt{\frac{10-2\sqrt5}5}.$$


On the other hand, if we denote $d\_j=\dim E\_j={\rm Tr}\pi\_j$, the orthogonality condition is
$$4{\rm Tr}(\pi\_j\pi\_k)=2d\_j+2d\_k-n,\qquad j\ne k.$$
We deduce that
$$\langle\pi\_i-\pi\_j,\pi\_k-\pi\_\ell\rangle=0$$
whenever $i,j,k,\ell$ are pairwise distinct. Therefore ${\bf Sym}\_n(\mathbb R)$ contains a subset made of $\frac{N(N-1)}2$ elements (the $S\_{ij}=\pi\_i-\pi\_j$), in which each element is orthogonal to $\frac{(N-2)(N-3)}2$ other ones. Can such a rich configuration exist ?


**Edit**. Here is an interesting remark. The case $n=3$, studied above, suggested that $I\_n$ is unlikely to belong to the basis (though it does for $n=2$). Thus let us raise the side question:



> 
> does there exist such a base $\cal B$, containing $R\_1=I\_n$ ?
> 
> 
> 


If so the other elements $R\_i=2\pi\_i-I\_n$, being orthogonal to $I\_n$, satisfy $\dim E\_i=\frac n2$. In particular $n$ is even. Now, the orthogonality of $R\_i$ and $R\_j$ gives
$$4{\rm Tr}(\pi\_i\pi\_j)=2\frac n2+2\frac n2-n=n.$$
Let now $k\in[1,N-1]$ be an integer, and $J\subset[2,N]$ have cardinal $k$. Let us form
$$H\_J=\sum\_{j\in J}\pi\_j,$$
which is positive semi-definite. Then
$${\rm Tr}H\_J=k\frac n2,\qquad{\rm Tr}(H\_J)^2=k\frac n2+k(k-1)\frac n4=k\frac n4 (k+1).$$
Let $r\_J$ be the rank of $H\_J$. By Cauchy-Schwarz (written for the eigenvalues of $H\_J$), we have
$$({\rm Tr}H\_J)^2\le r\_J{\rm Tr}(H\_J)^2,$$
which gives
$$r\_J\ge n\frac k{k+1}.$$
If $k=n$, then this implies $r\_J\ge\frac{n^2}{n+1}>n-1$ and thus $r\_J\ge n$. In other words:



> 
> Suppose $R\_1=I\_n$. For every $J\subset[2,N]$ of cardinal $n$, the symmetric matrix $H\_J=\sum\_{j\in J}\pi\_j$ is positive definite.
> 
> 
> 


Of course this sum of $n$ terms is relatively small, compared to the $N-1=\frac{(n-1)(n+2)}2$ involved projectors $\pi\_j$.


**Redit**. The argument above actually extends to the general case (when $\cal B$ does not necessarily contain $I\_n$). Let $J\subset[1,N]$ be of cardinal $m$, and denote
$$H\_J=\sum\_J\pi\_j.$$
If $D\_J={\rm Tr}H\_J=\sum\_Jd\_j$, then ${\rm Tr}(H\_J)^2=m(D\_J-\frac{n(m-1)}4)$. Cauchy-Schwarz yields
$$D\_J^2\le r\_Jm\left(D\_J-\frac{n(m-1)}4\right).$$
The polynomial $X^2-r\_Jm\left(X-\frac{n(m-1)}4\right)$ thus has real roots. Writing that its discriminant is non-negative, we obtain
$$r\ge n\frac{m-1}m.$$
For $m=n+1$, this gives $r>n-1$, that is $r=n$. Therefore



> 
> The sum of $n+1$ distinct $\pi\_j$'s is positive semi-definite.
> 
> 
> 



Orthogonal basis of ${\bf Sym}_n(\mathbb R)$, made of orthogonal matrices
Here is an example with $n=4$. (ADDED BELOW: An example for any power of $2$)


I identify $\mathbb R^4$ with the quaternions, and describe $10$ subspaces such that any two of the resulting orthogonal projections satisfy the required condition $4Tr(\pi\pi')=2d+2d'-4$. One of the ten is the zero-dimensional subspace, and the other nine are $2$-dimensional. I need $Tr(\pi\pi')=1$ for any two of these nine.


Recall that in the group of unit quaternions there is a subgroup of order $24$. It contains (and normalizes) the order $8$ group $\lbrace \pm 1,\pm i,\pm j, \pm k\rbrace$. The other sixteen elements are the quaternions of the form
$$
\frac{\pm 1\pm i \pm j\pm k}{2}.$$
Dividing by the subgroup $\lbrace \pm 1\rbrace$, we get a group $G$ of order $12$ with a normal subgroup $V$ of order $4$. The elements of $G$ correspond to $12$ one-dimensional vector subspaces. The four lines belonging to $V$ are perpendicular to each other, and within each of other two cosets of $V$ in $G$ the four lines are again perpendicular to each other. This gives us eighteen two-dimensional subspaces, each spanned by two perpendicular lines. These come in nine orthogonal pairs. Choose one from each pair.


When $V$ and $V'$ are two of the nine and $\pi$ and $\pi'$ are the corresponding projections, then:


Case 1. $V$ and $V'$ might both come from the same coset of $V$ in $G$. A typical example is: $V$ spanned by $\lbrace 1,i\rbrace$ and $V'$ spanned by $\lbrace 1,j\rbrace$. The trace here is $1$ (eigenvalues $1,0,0,0$).


Case 2. $V$ and $V'$ come from different cosets. Here a typical example is $V$ spanned by $\lbrace 1,i\rbrace$ and $V'$ spanned by $\lbrace 1+i,j+k\rbrace$. The trace is again $1$ (eigenvalues $\frac{1}{2},\frac{1}{2},0,0$).


ADDED


Now that I think it over, a more direct way to describe these nine symmetric-and-orthogonal matrices is to say that they are the maps $x\mapsto axb$, where $\lbrace a,b\rbrace\subset \lbrace i,j,k\rbrace$.


GENERALIZATION


The answer is yes when $n=2^k$ for any $k\ge 0$. In the basis that I will specify, each matrix is a monomial matrix, that is, the product of a permutation matrix (for a very particular kind of permutation) and a diagonal matrix whose eigenvalues are $\pm 1$.


Let $V$ be a $k$-dimensional vector space over $\mathbb F\_2$. I will make a set of "$V$ by $V$ matrices", i.e. functions $A:V\times V\to \lbrace 1,-1,0\rbrace\subset \mathbb R$. Each of these will be an orthogonal matrix, the inner product of two of them will always be zero, and he number of elements of the set will be $\frac{n(n+1)}{2}$.


If $H\subset V$ is either $V$ or a codimension one vector subspace, and if $c\in H$, then define the matrix $A\_{H,c}$ by $A\_{H,c}(v,v+c)=1$ if $v\in H$ and $A\_{H,c}(v,v+c)=-1$ if $v\notin H$, and $A\_{H,c}(v\_1,v\_2)=0$ if $v\_2\neq v\_1+c$. Note that this is symmetric because $c\in H$.


The inner product of $A\_{H,c}$ and $A\_{H',c'}$ is $0$ if $c\neq c'$, because in that case there is no $(v\_1,v\_2)$ such that both $A\_{H,c}(v\_1,v\_2)$ and $A\_{H',c'}(v\_1,v\_2)$ are non-zero.


The inner product of $A\_{H,c}$ and $A\_{H',c}$ is $0$ if $H\neq H'$ because exactly one half of the vectors of $V$ are in the symmetric difference of $H$ and $H'$, insuring that one half of the non-zero terms $A\_{H,c}(v,v+c)A\_{H',c}(v,v+c)$ in the inner product are $-1$ while the other half are $+1$.


The total number of pairs $(H,c)$ with $H=V$ is $n$, and the total number of pairs $(H,c)$ with $H\neq V$ is $\frac{(n-1)n}{2}$. This adds to $\frac{n^2+n}{2}$.


