This is the process of completing the square.
Keep this equation in mind: [tex]ax^2+bx+c[/tex]
Basically, to make this a perfect square trinomial, you take half of b and square that value. This will make it so you can compress the left side of the equation into [tex](x+b)^2 \ or \ (x-b)^2 [/tex] depending on the sign in the middle of the original equation.