To obtain the identity for the square of a difference, replace b by (−b) in the identity
(a+b)2=a2+2ab+b2:
(a+(−b))2=a2+2a(−b)+(−b)2
Since, 2a(−b)=−2ab and (−b)2=b2, we get
(a−b)2=a2−2ab+b2.
Thus, (a−b)2=a2−2ab+b2
Observe that compared to the identity (a+b)2=a2+2ab+b2, only the sign of the middle term changes.