TITLE: If $A^2=B^2=0$ and $AB=BA$ then $(A+B)^2=0$
QUESTION [8 upvotes]: I've been given a class assignment to try and prove or disprove the following:

$A^2=B^2=0$ where $A,B \in M_n(\mathbb R)$ for $n≥2$ . 
  If $AB=BA$, then is $(A+B)^2=0$ ?

I've been trying to prove this by saying that given the above conditions, $(A+B)^2 = 0$ is always true, $0=0$. My attempt:
$$(A+B)^2 = A^2 + AB + BA + B^2 = AB + BA = 2AB$$
Now because: $(A+B)^2=0$ then: $2AB=0 \implies AB=0 $ but because $A^2=B^2=0$ then if we multiply by A on the left side we get: $AAB = A0 \implies A^2B  = 0 \implies 0 = 0$.
Did I prove this correctly? or am I not allowed to multiply by $A$ when there is $0$ on one side? I tried disproving it and just could not find any counter-examples that worked.

REPLY [12 votes]: When $A,B$ commute you can apply the binomial theorem, as you did, which gives that $(A+B)^2=A^2+2AB+B^2$. Since you have the hypothesis $A^2=0$ and $B^2=0$, this means that $(A+B)^2=2AB$, and the question is whether this is forced to be $0$ under the given hypotheses.
If you have played a bit with the possibilities of (commuting) nilpotent matrices, you may know that they can often be modelled by partial maps from a finite set to itself, each element of the set representing a basis vector, and the map describing basis vectors being mapped to other basis vectors, with the elements where the map is undefined corresponding to basis vectors mapped to$~0$. Here I'll take a finite set$~S$ of points in$~\Bbb Z^2$, the maps being a shift in the horizontal and vertical direction (which ensures commutation) whenever that lands inside$~S$. The conditions $A^2=0$ and $B^2=0$ mean the $S$ can have no more than $2$ successive points horizontally and vertically, and $AB$ is a shift by $(1,1)$. It seems clear that the hypotheses do not imply that such a shift always takes a point of $S$ outside the set$~S$. The simplest counterexample is with $S$ being the four corners of a unit square. This give rise to matrices
$$
  A=\pmatrix{0&1&0&0\\0&0&0&0\\0&0&0&1\\0&0&0&0\\}
\quad\hbox{and}\quad
  B=\pmatrix{0&0&1&0\\0&0&0&1\\0&0&0&0\\0&0&0&0\\}
$$
which indeed verify the hypotheses, but fail the conclusion: $(A+B)^2=2AB\neq0$.