# Proving two matrices are equal

A friend and I are having some trouble with a linear algebra problem:

Let $A$ and $B$ be square matrices with dimensions $n\times n$

Prove or disprove:

If $A^2=B^2$ then $A=B$ or $A=-B$

It seems to be true but the rest of my class insists it's false - I can't find an example where this isn't the case - can someone shed some light on this?

Thanks!

• Consider the matrix $A'$ which is element-wise equivalent to $A$ except the upper-left (non-zero) element, which is the negative of the upper-left element in $A$... Or pick any single non-zero element in $A$ and make such a $A'$, assuming that $A$ has at least two non-zero elements. Then $(A')^2=A^2$. Nov 20, 2015 at 17:01
• Your intuition for why it seems true is natural though and motivated by your familiarity with the $1\times 1$ real valued matrices. Nov 20, 2015 at 17:16
• @abiessu I don't see how that example works without assuming a lot more zeros in $A$ than you've stated. Unless you're interpreting $A^2$ to mean element-wise squaring, which would be very unconventional. Nov 20, 2015 at 17:31
• @ErickWong: ah, the failure of an "in-the-moment" example... You are right of course. Nov 21, 2015 at 5:59

$\begin{pmatrix} 0&1\\0&0\end{pmatrix}^2=\begin{pmatrix} 0&2\\0&0\end{pmatrix}^2=\begin{pmatrix} 0&0\\0&0\end{pmatrix}$
Your class is correct, and consider the suggestion in the comment: Let $$A=\left(\begin{array}{rr}1 & 0\\ 0 & 1\end{array}\right), \ \mathrm{and} \ B=\left(\begin{array}{rr}-1 & 0\\ 0 & 1\end{array}\right).$$
All matrices $E_{ij}$ of the standard basis of $M_n(\mathbf R)$, defined with $$a_{kl}=\begin{cases} 1&\text{if }(k,l)=(i,j)\\ 0&\text{if }(k,l)\neq(i,j) \end{cases}$$ satisfy the equation $\;E_{ij}^2=0$ if $i\neq j$.