# Matrix multiplication question (diagonal matrices)

Suppose $AB = BA$ and $A^2+B^2 = I$, where A and B are complex matrices.

My feeling is that this implies that both A and B are diagonal matrices. But I'm having trouble proving it.

Appreciate any help.

-
They are matrices; do not trust your feeling. – Servaes Apr 21 '14 at 20:32
Thanks for the counter example. My bad. – Ameet Sharma Apr 21 '14 at 20:33
never mind. i've got it. – Ameet Sharma Apr 21 '14 at 20:58
For your first question; no. Consider the matrices $$A=\binom{1\ 0}{0\ 1}\qquad\text{ and }\qquad B=\binom{0\ 1}{0\ 0}.$$ For your second question; not that I know of. – Servaes Apr 21 '14 at 21:01

Consider the matrices $A=\binom{0\ 0}{0\ 0}$ and $B=\binom{0\ 1}{1\ 0}$.
Let $A=0$ and $B=\left( \begin{matrix} 0 & 1 \\ 1 & 0 \end{matrix}\right)$, this provides a counterexample.
Aamet, you are very unlucky because, between $2$ Servaes's answers, you chose the bad one. Indeed, your question is a non-sense because you can obtain other solutions with a change of basis. The correct question is: are $A,B$ necessarily simultaneously diagonalizable over $\mathbb{C}$ ? The answer is NO and Servaes gave such a couter-example in his comment, comment that obtains zero point ! – loup blanc Apr 22 '14 at 15:27