How to factor$ x^2+2xy+y^2 $ I know the formula $x^2 + 2xy + y^2 = (x + y)^2$ by heart and in order to understand it better I am trying to solve the formula myself; however, I don't understand how step 4 is derived from step 3.
$$x^2+2xy+y^2\qquad1$$
$$x^2+xy+xy+y^2\qquad2$$
$$x(x+y) + y(x+y) \qquad3$$
$$(x+y)(x+y) \qquad 4$$
How does one get from step 3 to step 4? I don't know how to do that process.

Hint: go the other way! start with $(x + y)^2$, multiply out to get $x^2 + y^2 + xy + yx$ and then collect like terms to get the normal form $x^2 + 2xy + y^2$. "Multiplying out and collecting like terms" is a decision procedure for this kind of problem.
