well i think it works because the distributive property is used on the variables on the left side of course to get x^2+y^2+2x+2y, and then when you multiply (x+y) and (x+y+2) you get x^2+y^2+2x+2y which would be equal to the left side. anyway, that's just my interpretation. hope this helped!