1. Make some space between the terms with variables and the constant term. This is where we will eventually complete the square.
2. In order to complete the square, the coefficient of the squared term must be 1. We must therefore factor out the leading coefficient from the terms with variables (in this case, we factor out -2 from both terms) if the leading coefficient is other than 1.
3. This is the long one. First, within the parentheses we have completed the square. This is accomplished by taking half of the coefficient of x and then squaring it
This is where the +9 comes from inside of the parentheses. Second, we must balance the function. By adding 9 to the inside of the parentheses, we have actually added (-2)(9)=-18 to the right side of the function. In order to keep the function the same as when we started, we must subtract this same amount from the right side of the function (-18-(-18)=0 so we have, in effect not changed the function)
4. Factor the expression in parentheses which is a perfect square.
5. Combine the constant terms so that the function is in vertex form.