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.

$$x\color{blue}{(x+y)} + y \color{blue}{(x+y)} \qquad3$$
Let $\color{blue}{b=(x+y)}$
So, now you have. 
$$x\color{blue}{(b)} + y\color{blue}{(b)}  = x\color{blue}{b} +y\color{blue}{b} =\color{blue}{b}x+\color{blue}{b}y $$
Now factor out the $\color{blue}{b}# :
$$\color{blue}{b} (x+y)$$  
Remember, $\color{blue}{b=x+y}$, so substitute:
$$\color{blue}{(x+y)}(x +y)=(x+y)^2$$
