If A and B are two matrices such that AB =B and BA = A, then A2+B2 is equal to
2AB
2BA
A + B
AB
We have
A2+B2=(BA)2+(AB)2=(BA)(BA)+(AB)(AB)=B(AB)A+A(BA)B=B(BA)+A(AB)=BA+AB=A+B.