a^2+b^2+c^2+2ab+2bc+2ca
=(a^2+2ab+b^2)+(2bc+2ac)+c^2
=(a+b)^2+2c(a+b)+c^2
=(a+b+c)^2
a^3+b^3+c^3-3abc
=(a^3+3a^2b+3ab^2+b^3+c^3)-(3abc+3a^2b+3ab^2)
=[(a+b)^3+c^3]-3ab(a+b+c)
=(a+b+c)(a^2+b^2+2ab-ac-bc+c^2)-3ab(a+b+c)
=(a+b+c)(a^2+b^2+c^2+2ab-3ab-ac-bc)
=(a+b+c)(a^2+b^2+c^2-ab-bc-ac)