For all square matrices $A$ and $B$ of the same size, it is true that $(A+B)^2 = A^2 + 2AB + B^2$?

The below statement is a true/false exercise.

Statement: For all square matrices A and B of the same size, it is true that $(A + B)2 = A^2 + 2AB + B^2$.

My thought process: Since it is not a proof, I figure I can show by example and come to a valid conclusion based on such example.

My work:

Come up with a square matrix A and B let both be a 2 by 2 matrix(rows and cols must be same).

Matrix $A$:

$A = \begin{array}{ccc} 3 & 5 \\ 4 & 6 \\ \end{array} $

Matrix $B$:

$B = \begin{array}{ccc} 5 & 8 \\ 9 & 4 \\ \end{array} $

$A + B = \begin{array}{ccc} 8 & 13 \\ 13 & 10 \\ \end{array}$

$(A + B)^2 = \begin{array}{ccc} 233 & 234 \\ 234 & 264 \\ \end{array}$

$A^2 = \begin{array}{ccc} 29 & 45 \\ 36 & 56 \\ \end{array}$

$(AB) = \begin{array}{ccc} 60 & 44 \\ 74 & 56 \\ \end{array}$

$2(AB) = \begin{array}{ccc} 120 & 88 \\ 234 & 112 \\ \end{array}$

$B^2 = \begin{array}{ccc} 97 & 72 \\ 81 & 88 \\ \end{array}$

$A^2 + 2AB + B^2 = \begin{array}{ccc} 246 & 205 \\ 265 & 256 \\ \end{array}$

Based my above work, the answer is false.

Is there another way to approach the problem? It seems like a lot of work needed to be done for a true/false question which raised my suspicion about whether there is a better way to look at the problem.


A counterexample is all you need, so you're done. You probably could have picked a simpler counterexample, say with most entries of $A$ and $B$ being $0,$ but yours works just fine.

As an alternative, note that if $A$ and $B$ are square matrices of the same size, then $$(A+B)^2=A(A+B)+B(A+B)=A^2+AB+BA+B^2.$$ From this, it follows that $$(A+B)^2=A^2+2AB+B^2$$ if and only if $AB=BA.$ So, any two square matrices $A,B$ of the same size such that $AB\neq BA$ will yield a counterexample.


$$\begin{align*} (A+B)^2 &= (A+B)(A+B) \\ &= AA+AB+BA+BB \\ &= A^2 + AB+BA+B^2.\end{align*}$$

Is it always true that $AB+BA = 2AB$?