a.
A = (x + y + z)²
A = (x + y + z)(x + y + z)
A = x² + xy + xz + xy + y² + yz + xz + zy + z²
A = x² + y² + z² + 2xy + 2xz + 2yz
b.
B = (a - b -c)²
B = (a - b - c)(a - b - c)
B = a² - ab - ac - ab + b² + bc - ac + bc + c²
B = a² + b² + c² - 2ab - 2ac + 2bc