this uses (a+b)^2=a^2+2ab+b^2 for example, (x+1)^2=x^2+(2*1)x+1^2,simplified to (x+1)^2=x^2+2x+1,what we do here