# How do I convert the equation f(x)=x^2+6x+5 to vertex form?

Aug 17, 2014

The answer is $f \left(x\right) = {\left(x + 3\right)}^{2} - 4$.

To convert to vertex form, you must complete the square.

$f \left(x\right) = \left({x}^{2} + 6 x + k\right) - k + 5$

We add $k$ to complete the square inside the brackets, but whatever we add inside, we must subtract outside the brackets to keep the equation balanced.

$k = {\left(\frac{b}{2}\right)}^{2} = {\left(\frac{6}{2}\right)}^{2} = 9$

Substitute $k$ to get your final solution:

$f \left(x\right) = \left({x}^{2} + 6 x + 9\right) - 9 + 5$
$= {\left(x + 3\right)}^{2} - 4$

You can derive a formula algebraically:

$f \left(x\right) = {x}^{2} + b x + c$
$= \left({x}^{2} + b x + {\left(\frac{b}{2}\right)}^{2}\right) + c - {\left(\frac{b}{2}\right)}^{2}$
$= {\left(x + \frac{b}{2}\right)}^{2} + c - {\left(\frac{b}{2}\right)}^{2}$

It is a slightly more complicated if $a \ne 1$:

$f \left(x\right) = a {x}^{2} + b x + c$

You must factor out $a$ first, then continue as before:

$f \left(x\right) = a \left({x}^{2} + \frac{b}{a} x + k\right) + c - a k$
$= a \left({x}^{2} + \frac{b}{a} x + {\left(\frac{b}{2 a}\right)}^{2}\right) + c - a {\left(\frac{b}{2 a}\right)}^{2}$
$= a {\left(x + \frac{b}{2 a}\right)}^{2} + c - \frac{a {b}^{2}}{4 {a}^{2}}$
$= a {\left(x + \frac{b}{2 a}\right)}^{2} + c - \frac{{b}^{2}}{4 a}$

With a little rearrangement, it should look very familiar:

$= a {\left(x + \frac{b}{2 a}\right)}^{2} - \frac{{b}^{2} - 4 a c}{4 a}$

If you can complete the derivation yourself, you should have no trouble completing the square with any question. When using the formula, be very careful when $a$ is negative.

Here is another example: