# Under what conditions is $(A+B)(A-B) = (A^2 - B^2)$ for two $n \times n$ matrices $A$ and $B$?

so my approach to this problem was

to view $A$ as a matrix of the form $\begin{bmatrix}a_1 & a_2 & a_3 & \dots & a_n\end{bmatrix}$ and $B$ as $\begin{bmatrix}b_1 & b_2 & b_3 & \dots & b_n\end{bmatrix}$

define variable $C = (A+B)$ and $D = (A-B)$

$C = \begin{bmatrix}c_1 & c_2 & c_3 & \dots & c_n\end{bmatrix}$ $D = \begin{bmatrix}d_1 & d_2 & d_3 & \dots & d_n\end{bmatrix}$

$CD = A^2 - B^2$

$Cd_1 + Cd_2 +\dots + Cd_n = (a_1A - b_1B) + (a_2A + b_2B) + (a_3B + b_3B) + \dots + (a_nB + b_nB)$

substitute back for $d$ and $C$

$(a_1-b_1)(A+B) + (a_2 - b_2)(A+B) + \dots = (a_1A - b_1B) + (a_2A + b_2B) + (a_3B + b_3B)+ \dots$

$(a_1A + A_1B -B_1A - b_1B) + (a_2A + A_2B -B_2A - b_2B) + \dots = (a_1A - b_1B) + (a_2A + b_2B) + \dots$

at this point I'm stuck, because I feel like I'm on the wrong track because my answer does not match correctly with the solution. How does one solve this problem?

You can make it simpler. $$(A+B)(A-B)=A^2+BA-AB-B^2$$ When is this equal to $A^2-B^2$?
$(A+B)(A-B)=A^2+BA-AB-B^2$ its equal to $A^2-B^2$ when $AB=BA$ i mean A,B must commute