# Linear algebra / matrix equation

I have a set of $n$ matrices $M_i$, $1 \le i \le n$, which can each be written as the sum of three rank-1 matrices: $$M_i = x_i x_i^T + y_i y_i^T + z_i z_i^T$$ for $x_i,y_i,z_i \in \mathbb R^p$. The vectors $x_i,y_i,z_i$ are orthogonal: $$x_i^T y_i = x_i^T z_i = y_i^T z_i = 0$$ I am looking for solutions $A \in G \le GL(p,\mathbb R)$, which satisfy:

$$A^T M_i A = M_i$$ Now $A = \pm I$ are trivial solutions to this equation, so I am looking for nontrivial solutions.

Progress so far:

We can make some progress for the special case $n = 1$. In this case, since $x_1,y_1,z_1$ are orthogonal, we can choose a basis in which $x_1 = e_1$, $y_1 = e_2$, $z_1 = e_3$. Then for some $w \in \mathbb R^p$, \begin{align} w^t M_1 w &= w^t e_1 e_1^T w + w^t e_2 e_2^T w + w^t e_3 e_3^T w \\ &= (e_1^T w)^2 + (e_2^T w)^2 + (e_3^T w)^2 \\ &= w_1^2 + w_2^2 + w_3^2 \end{align} Similarly for the left hand side note that $e_j^T A = A_j^T$, where $A_j^T$ is the $j$-th row of $A$. Then we get \begin{align} w^t A^T M_1 A w &= w^t \left( A_1 A_1^T + A_2 A_2^T + A_3 A_3^T \right) w \\ &= (A_1^T w)^2 + (A_2^T w)^2 + (A_3^T w)^2 \end{align} Since this expression is equal to $w_1^2 + w_2^2 + w_3^2$ it must be true that the upper 3-by-3 block of $A$ is orthogonal in order to preserve the norm of the first three elements of $w$. Therefore, $A$ can be written in block form as $$A = \pmatrix{ O(3) & 0 \\ \textrm{Mat}(p-3,3,\mathbb R) & GL(p - 3, \mathbb R) }$$ Does anyone have any ideas how to get a solution for general $n$?