# Let $A=(a_{ij})$ be an $n\times n$ matrix. Suppose that $A^2$ is diagonal. Must $A$ be diagonal?

Let $A=(a_{ij})$ be an $n\times n$ matrix. Suppose that $A^2$ is diagonal? Must $A$ be diagonal.

In other words, is it true that

$$A^{2}\;\text{is diagonal}\;\Longrightarrow a_{ij}=0,\;i\neq j\;\;?$$

• Any involution has the identity matrix as its square. So some counterexamples are reflections and 180 degree rotations. – Andreas Rejbrand Apr 12 '18 at 18:41

As a simplified case, consider $n=2$ and let $$A=\begin{pmatrix}a&b\\c&d\end{pmatrix}\implies A^2=\begin{pmatrix}a^2+bc&b(a+d)\\c(a+d)&d^2+bc\end{pmatrix}$$ so $$A^2\,\,\text{diagonal}\iff b(a+d)=c(a+d)=0\implies\left\{\begin{matrix} b=c=0 \implies A\,\,\text{diagonal}\\ a+d=0\implies a=-d \end{matrix}\right.$$

Hence a counterexample would be any matrix of the form $$A=\begin{pmatrix}-d&b\\c&d\end{pmatrix}$$ with $b \ne 0$ or $c \ne 0$ or both.

• Interesting that if $A^2$ is diagonal and $B^2$ is diagonal, then $(A + B)^2$ is automatically diagonal as well (since the set of matrices you're describing is closed under addition.) – Michael Seifert Apr 12 '18 at 19:20
• Why you say $b \neq c$? It seems that $b = c$ works fine. – Jacob Maibach Apr 12 '18 at 19:34
• I understand your idea that you only mentioned the case where counterexample arises. My point is that the sentence using "diagonal only if" is a wrong statement by itself. Maybe try some "is diagonal only if $b(a+d)=c(a+d)=0$, which is true if either $b=c=0$ ($A$ is diagonal) or $a=-d$". – Džuris Apr 12 '18 at 19:57
• you don't need $d\neq0$, for example $A = \begin{pmatrix}0&1\\1&0\end{pmatrix}$ (from the other answer) works just fine. – ilkkachu Apr 12 '18 at 20:08
• @MichaelSeifert: That's not quite right. $\begin{pmatrix}1&0\\0&1\end{pmatrix}^2 = \begin{pmatrix}0&1\\1&0\end{pmatrix}^2 = \begin{pmatrix}1&0\\0&1\end{pmatrix}$, but $\begin{pmatrix}1&1\\1&1\end{pmatrix}^2$ is not a diagonal matrix. – ruakh Apr 13 '18 at 14:41

No, this is already false for $n=2$. Consider $$A=\begin{pmatrix} 0 & 1 \cr 1 & 0 \end{pmatrix}$$ Since $A^2=I$ is diagonal, but $A$ is not, there is a problem. In general, there are always elements of finite order $r$ in $GL_n(K)$ with $A^r=I$ diagonal, but $A$ not diagonal for $n\ge 2$.

• Thanks a lot. I will also remove the false exception $n=2$ from the question. – Medo Apr 12 '18 at 11:36
• Could you define the class $GL_{n}(K)$ ? – Medo Apr 12 '18 at 11:37
• See wikipedia. Here $K$ is a field. – Dietrich Burde Apr 12 '18 at 11:39
• Can you add a reference or proof for the last statement in your answer ? – Gabriel Romon Apr 12 '18 at 12:03
• As loup blanc says, just add $1$'s in the diagonal to obtain an example of any size $n\ge2$. – Dietrich Burde Apr 12 '18 at 13:45

It's probably easier to see the answer to this question if you think of matrices not as arrays of numbers, but as representing linear operators. A diagonal matrix is one that just scales the elements (not necessarily by the same amount), i.e. the eigenvectors are the elementary vectors. So this question can be thought of as "Is there a linear operator that involves interactions between elements of the vector, but when done twice, does not?"

From there, there are several relatively easy-to-understand examples. For instance, swapping two elements is not a "diagonal" operator, but applying it twice is just the identity, which is. Rotating by $90$ degrees is also not a diagonal operator, but applying it twice is a rotation by $180$ degrees, which is. If you treat order $1$ polynomials as vectors, then differentiation is not diagonal, but the second derivative is trivially so (since it sends everything to zero).

These examples have extensions to arbitrary $n$: swapping $n$ elements, rotating by $\dfrac{\pi}{n}$, and taking the derivative of order $n$ polynomials are all non-diagonal operators, but taking them $n$ times is diagonal.

• Thank you for the great insight. – Medo Apr 12 '18 at 18:52

The matrix $A$ with all entries $0$ except for $1$ at position $(1,n)$ is such that $A^2=0$, a diagonal matrix.

For $n=3$, the matrix is $$\begin{bmatrix}0&0&1\\0&0&0\\0&0&0\end{bmatrix}$$

• Your more generally part is (a) essentially the same as the original (because $T^{n-1}$ is a multiple of the first example, or its transpose) and (b) wrong (because there are strictly triangular $T\ne 0$ where $T^{n-1}=0$ (for example, the matrix from the first example). – celtschk Apr 12 '18 at 19:40
• Actually, the more general example could have been fixed: (a) While $T^{n-1}$ doesn't bring anything new, you can take any power with exponent $\ge n/2$, which for suffiiently large $n$ gives you plenty of additional examples. (b) just specify that the minor diagonal (is that the correct English term? German “Nebendiagonale”) is non-zero. – celtschk Apr 13 '18 at 5:46
• @celtschk, yes, I guess that what I had in mind, thanks. – lhf Apr 13 '18 at 11:20

I would like to show why the Dietrich's example is the key of the problem.

Generically (if you randomly choose a diagonal $D$), then $A^2=D$ implies that $A$ is diagonal. Indeed, the elements of $D$ are "always" distinct and $DA=AD$ implies that $A$ is diagonal.

Now, assume that $D$ has non-distinct elements. Using a permutation of the vectors of basis, we may assume that $D=diag(\lambda_1I_{n_1},\cdots,\lambda_k I_{n_k})$ where the $\lambda_i$ are distinct. Then $AD=DA$ implies that $A$ is in the form $A=diag(A_1,\cdots,A_k)$ where $A_i^2=\lambda_i I_{n_i}$ (since $A^2=D$). Thus, at least over $\mathbb{C}$, the problem for any non-zero $D$, is reduced (equivalent) to find a non-diagonal matrix s.t. $A^2=I$ when $n\geq 2$. Dietrich did that for $n=2$; for $n>2$, it suffices to add "ones" on the diagonal.

• ... equivalent to $A^n = I$ or $A^n = 0$, the zero matrix. "non-zero $D$" is not the same as having no eigenvalues equaling $0$. – Greg Martin Apr 12 '18 at 22:57
• @Greg Martin , of course you are right. In fact I consider only the diagonals that have at least one non-zero multiple eigenvalue. Yet, if we want to cover all cases, then we must also study the case $A^2=0$; but, frankly, I'm fed up with this last equation... – loup blanc Apr 12 '18 at 23:52