Prove that $(A+B)^n = 0$

Let $A$ and $B$ be $n \times n$ real matrices such that $A^n = B^n = 0$ and $AB = BA$. Prove that $(A+B)^n = 0$.

We have $$(A+B)^n = A^n+A^{n-1}B\binom{n}{1}+\cdots+AB^{n-1}\binom{n}{n-1}+B^n.$$ I tried proving this for just the case $n = 2$. We have $(A+B)^2 = A^2+2AB+B^2 = 2AB$ since $A^2 = B^2 = 0$. Then I didn't see how to show that $AB = 0$.

Since $A$ and $B$ commute, they can be simultaneously triangularized over $\mathbb{C}$. In other words, there exists an invertible matrix $P$ and upper-triangular matrices $T$ and $U$ such that $$T=P^{-1}AP$$ and $$U=P^{-1}BP$$ Moreover, since $$T^n=P^{-1}A^nP=0$$ it follows that $T$ must be strictly upper triangular (i.e. it has no non-zero entries on its diagonal), and similarly $U$ must be strictly upper triangular as well.
Therefore $T+U$ is strictly upper triangular, so $(T+U)^n=0$, hence $$(A+B)^n=P(T+U)^nP^{-1}=0$$
If you expand $(A+B)^{2n}$ with the binomial theorem, you'll see that $A^n=B^n=0$ implies each term is $0$ because each term has $A^j B^k$ where either $j\geq n$ or $k\geq n$. Hence $A+B$ is a nilpotent matrix. If $C$ is an $n$-by-$n$ nilpotent matrix, then $C^n=0$.
• Can you explain how each term is $0$? – user19405892 Mar 16 '17 at 2:08
• They look like some constant times $A^j B^k$ with $j+k=2n$, so $j\geq n$ or $k\geq n$, with implies $A^j=0$ or $B^k=0$. (Really $2n-1$ would suffice.) – Jonas Meyer Mar 16 '17 at 2:09
• How does it imply $A^j = 0$ or $B^k = 0$? – user19405892 Mar 16 '17 at 2:10
• @user19405892: If $j\geq n$, then $A^j = A^n A^{j-n}=0\cdot A^{j-n}=0$. Similarly, if $k\geq n$, then $B^k=0$. E.g., if $A^{32}=0$, then also $A^{37}=A^{32}A^5=0$. – Jonas Meyer Mar 16 '17 at 2:16