# A question on symmetric matrices

$\newcommand{\R}{\mathbb{R}}$

The question is

Is there a constructive (say, parametric) description of the set (say $M_n$) of all symmetric matrices $A\in\R^{n\times n}$ such that all the diagonal entries of $A$ are $0$ and the matrix $(A-tI_n)^2$ is diagonal for some real $t$?

Here, of course, $I_n$ is the $n\times n$ identity matrix.

E.g., if $A=I_n-\frac1n\,1_n1_n^T$, then all the diagonal entries of $A$ are $0$ and
$(A-\frac12\,I_n)^2=\frac14\,I_n$, so that $A\in M_n$. Here, as usual, $1_n1_n^T$ is the matrix in $\R^{n\times n}$ all of whose entries are $1$.

Even a necessary condition for a matrix $A$ to be in the set $M_n$ could be useful, if it is close enough to sufficiency.

• @ChristianRemling : Thank you for your comment. I have now edited the question, trying to express better what I need. – Iosif Pinelis Jul 19 '18 at 4:52
• I think my previous comment still in principle outlines a procedure: Fix a diagonal matrix $D$. Then each eigenspace of $D$ is also invariant under $A$ if $(A-t)^2=D$. On such a space (with ev $d$, let's say), $A$ will have the desired property if and only if its spectrum is contained in $t\pm \sqrt{d}$. – Christian Remling Jul 19 '18 at 5:27
• Of course, this gives various conditions that have to be satisfied. For example, $D$ can have at most one simple eigenvalue ($=t^2$), and the ev's of any part of $A$ must sum to zero. We probably also want a statement that if I have eigenvalues for $A$ as above with sum zero, then there will be an $A$ with these ev's. – Christian Remling Jul 19 '18 at 5:29
• other examples of such matrices are symmetric conference matrices, i.e. a square matrix $A$ of order $n$ with zero diagonal and $\pm 1$ off-diagonal, such that $A^2 = (n-1) I_n$. Such matrices exist for many values of $n$ for example when $n\equiv 2 \ (mod \ 4)$ and $n−1$ is a prime power. – Mahdi Jul 19 '18 at 11:41
• @AlexandreEremenko : I have re-checked the example, and it seems all right. Indeed, $(11^T)^2=n11^T$, whence $4(A-\frac12\,I)^2=(I-\frac2n\,11^T)^2=I-\frac4n\,11^T+\frac4{n^2}\,n11^T=I$. – Iosif Pinelis Jul 19 '18 at 13:33

Partial answer: As Christian Remling noted in remarks, it suffices to deal with the case that $(A-tI_{n})^{2} = \lambda I_{n}.$ Since $A$ is symmetric, we can only have $\lambda = 0$ when $A = tI_{n}$ for some $t$. But since the diagonal entries of $A$ are all $0,$ this only happens when $A = 0.$ Hence we may suppose that $\lambda \neq 0.$ Then $A = tI_{n} + \sqrt{\lambda}T$ for some matrix $T$ with $T^{2} = I_{n}.$ If $T = I_{n}$ we again see that $A$ is a scalar matrix, so the zero matrix. Hence the only non-zero possibilities for $A$ arise when $T^{2} = I \neq T.$ Now trace $T$ = $r-s$ where $T$ has $r$ eigenvalues $1$ and $s$ eigenvalues $-1$ Also, since $tI_{n} + \sqrt{\lambda}T$ has all diagonal entries zero, it follows that all diagonal entries of $T$ must be equal. Hence each diagonal entry of $T$ is $\frac{r-s}{n}$ and $t + \frac{(r-s)\sqrt{\lambda}}{n} = 0.$

Now $r = s$ gives $t = 0,$ so that $A = \sqrt{\lambda}T.$ If $r \neq s,$ then $\lambda = \frac{n^{2}t^{2}}{r-s}.$

Hence the problem is reduced in essence to determining which symmetric matrices $T$ of order two have all diagonal entries equal. But if $T$ is such a matrix, then $\frac{I+T}{2}$ and $\frac{I-T}{2}$ are mutually orthogonal idempotent symmetric matrices, each with all diagonal entries equal.

Now the problem is reduced to finding symmetric idempotent matrices $E$ with all diagonal entries equal (for we may take $T = 2E-I$ if we find such an $E$). If $E$ has rank $m,$ then note that each diagonal entry of $E$ is $\frac{m}{n}.$

We may obtain such an $E$ or each positive divisor $d$ of $n$: take $E$ to be the direct sum (in the obvious sense) of $n/d$ copies of $\frac{J_{d}}{d},$ where $J_{d}$ is the $d \times d$ matrix with all entries $1.$

At the moment, I don't see how to determine all possibilities for such an $E$. Later edit: (...but someone else might). One observation which might turn out to be relevant is that if $E$ is such an idempotent matrix, and $X$ is a "signed permutation matrix", that is, a matrix with exactly one non-zero entry in each row and each column, that entry being $\pm 1$), then $XEX^{t}$ is another such matrix. I don't know if there are other orthogonal matrices leaving this set of idempotents invariant.

Even later edit: Note that if $E,F$ are mutually orthogonal symmetric idempotent matrices with all diagonal matrices with all entries equal, then $E+F$ is symmetric idempotent with all diagonal entries equal.

This allows us to produce symmetric idempotent matrices with all diagonal entries equal of every rank for some values of $n$. For example, when $n = 2^{r},$ we may consider $Y = \frac{1}{\sqrt{n}} X,$ where $X$ is the character table of an elementary Abelian $2$-group of order $2^{r}.$

Let $u_{i}$ be the $i$-th column of $Y$. Then $E_{i} = u_{i}u_{i}^{t}$ is a symmetric idempotent matrix of rank $1$ with all diagonal entries $\frac{1}{n}.$ For $j \neq i,$ it is easy to see that $E_{i}E_{j} = E_{j}E_{i} = 0.$

Hence for $1 \leq k \leq n,$ we may take the sum of $k$ distinct $E_{i}$'s to get an idempotent symmetric matrix with all diagonal entries $\frac{k}{n}.$

• Thank you very much for your answer, +1. This is a nice reduction. I'd also need a constructive description of the $E$'s, to be fed into an optimization problem. Perhaps, this is impossible, though. – Iosif Pinelis Jul 19 '18 at 13:23
• I think the question of determining when there can be $n$ such mutually orthogonal symmetric idempotent $n \times n$ matrices (with equal main diagonal entries) is closely related to the existence of $n \times n$ Hadamard matrices, as the last example in my answer illustrates. – Geoff Robinson Jul 26 '18 at 8:54