(a-2b+c)^2
=(a-2b)^2+2c(a-2b)+c^2
=(a-2b)^2+2ac-4bc+c^2
=a^2-4ab+b^2+2ac-4bc+c^2
=a^2+b^2+c^2-4ab+2ac-4bc