We expand the two quadratics using the squaring rule, and then sum the result.
(a+b)2+(a−b)2=(a2+2ab+b2)+(a2−2ab+b2)=a2+2ab+b2+a2−2ab+b2=a2+a2+2ab−2ab+b2+b2=2a2+2b2