Let's take it step by step.
First things first, x2 + y2 is NOT equal to (x+y)2
That is because if we expand the second to (x+y)*(x+y) it's x*x + x*y + y*x + y*y which is equal to x2+2*x*y+y2.
This is the basic calculus formula for quadratic equations, which are equations to the power of 2.
Now...