Friday, January 25, 2013

Completing The Square

Factoring is an easy and satisfying way to solve a quadratic equation. Problem is not all quadratics can be factored. In fact only a small number of them can. To be exact, only quadratic equations with rational roots can be factored by traditional means.

Completing the square allows you to get around this problem. The basic idea is to take any quadratic equation and force it into a perfect square factor-able state. Math is very violent sometimes...

So now that you know the why and the idea behind the how, lets see how its done.

First thing before solving any quadratic is to make sure it's in the correct form for using a given technique. Factoring and using the quadratic equation want the equation in standard form:

$$ax^2 + bx + c = 0$$

With completing the square you end up isolating $x$ on the left hand side and putting your equation on the right. So you start out moving $c$ to the right side of the equals sign like so:

$$ax^2 + bx = -c$$

The next step is you divide each term by $a$ to get the equation into a monic form. This means that the coefficient of the the $x^2$ term is one. $$ x^2 + \frac{b}{a}x = \frac{-c}{a} $$

Next thing you want to do is take the value of \(\frac{b}{a}\) divide it by $2$ then square it all. Then add that to both sides of the equation. This is the real magic in completing the square. In any perfect square, the constant term we are adding to both sides has to be $(\frac{b}{2})^2$. This is what makes the perfect square work. $$ x^2 + \frac{b}{a}x + \frac{b^2}{4a^2} = \frac{-c}{a} + \frac{b^2}{4a^2} $$

Here is an image to help you understand what we just did to the left side to complete the square



Let's get the right side of the equals sign simplified by using a common denominator to add the two fractions. We do this by multiplying \(\frac{-c}{a}\) by \(\frac{4a}{4a}\) $$ \bigg( \frac{-c}{a} \times \frac{4a}{4a} \bigg) + \frac{b^2}{4a^2} = \frac{-4ac + b^2}{4a^2} $$

So now we have: $$ x^2 + \frac{b}{a}x + \frac{b^2}{4a^2} = \frac{-4ac + b^2}{4a^2} $$

Now to simplify the the left side the same way: $$ \bigg( \frac{x^2}{1} \times \frac{4a^2}{4a^2} \bigg) + \bigg( \frac{b}{a}x \times \frac{4a}{4a} \bigg) + \frac{b^2}{4a^2} = \frac{4a^2x^2 + 4abx + b^2}{ 4a^2} $$

Leaving us with: $$ \frac{4a^2x^2 + 4abx + b^2}{ 4a^2} = \frac{-4ac + b^2}{4a^2} $$

Now we can multiply both sides by $4a^2$ to get rid of the denominator. $$ {4a^2} \times \frac{4a^2x^2 + 4abx + b^2}{ 4a^2} = \frac{-4ac + b^2}{4a^2} \times 4a^2 $$ Now we have: $$ 4a^2x^2 + 4abx + b^2 = -4ac + b^2 $$ Ok, we are getting close. Now we can factor the left side as we have completed the square, so the left side is now a perfect square. $$ \begin{align*} (2ax+b)(2ax+b) &= -4ac + b^2 \\ (2ax+b)^2 &= -4ac + b^2 \end{align*} $$

Now lets take the square root of both sides: $$ \begin{align*} \sqrt{(2ax+b)^2} &= \pm \sqrt{-4ac + b^2}\\ 2ax+b &= \pm \sqrt{-4ac + b^2} \end{align*} $$

Now to finish isolating $x$ we will subtract $b$ from both sides and divide by $2a$ $$ \begin{align*} 2ax &= -b \pm \sqrt{-4ac + b^2}\\ \\ x &= \frac{-b \pm \sqrt{-4ac + b^2}}{2a} \end{align*} $$

We're done! What's that you say? YES, it is the quadratic formula! The quadratic formula is derived by completing the square! Sometimes it's easier to just use the quadratic formula outright, other times you might prefer to complete the square.

Let's try an example of completing the square. We will use the same equation we used in the last post: $x^2 - 4x - 12 = 0$. You will notice that this one can be factored 'normally', but we will use completing the square anyway. This example is already a monic equation so no need to divide all terms by $a$. $$ \begin{align*} x^2 - 4x - 12 &= 0\\ \\ x^2 - 4x &= 12 \\ \\ x^2 - 4x + 4 &= 16 \\ \\ (x - 2)(x - 2) &= 16\\ \\ (x - 2)^2 &= 16\\ \\ \sqrt{(x-2)^2} &= \pm \sqrt{16}\\ \\ x-2 &= \pm 4\\ \\ x &= 2 \pm 4\\ \\ x &= 6 \; or \; x = -2 \end{align*} $$

There you have it. You now know, if you didn't already, how to complete the square. You also saw how the quadratic equation is derived. I hope this has been informative. Please leave a comment if you have any questions or suggestions. Thanks.

Factoring Quadratic Equations

When I was in 10th grade I took Algebra II. I was more focused on women and other stuff, so a lot of what was taught just didn't stick. What did stick didn't seem to have any context. So it didn't really mean anything to me. Just some more stuff to memorize for the up coming test. This really took the fun out of math for me. Up until that class I understood math well and really enjoyed it.

Anyway, here I am 20 years later :s Now I want to understand math. Not just puke it up on demand, not really understanding what's happening. With that in mind, lets talk about quadratic equations!! \o/

A quadratic equation is a polynomial of the second degree with one variable. Second degree means the highest power any term is raised to is 2.

Example:

\(x^2 - 4x = 12\)

I know of 3 ways to solve quadratic equations.

  • Factoring
  • Completing The Square
  • Quadratic Formula

Of the 3 I think I enjoy factoring the most, so we will discuss it first. Factoring, as you probably know, is just busting up a number or expression into smaller parts that when multiplied together give you the expression you started with. This is useful for reducing a number or expression into simpler parts or solving quadratic equations :) If you need more information check this out

The first thing we do is rewrite the equation in standard quadratic equation form. a, b, and c below just reprensent some constants like 1, -4, and -12.

\(ax^2 + bx + c = 0\)

This means setting the whole thing equal to zero. This is useful when factoring because you know that one of the factors has to be zero. The only way you can get zero as the product of multiplication is if one of the number you are multiplying by is zero. By doing this you can more easily solve for the variable.

Example:

\((x + 3)(x - 2) = 6\)

vs

\((x - 3)(x + 4) = 0\)

In the second example you know that one of the factors must evaluate to zero. So in that example x could be $3$ or $-4$. In the example above it x is much harder to solve for because we must examine both factors to see how the product can produce $6$. I hope that makes sense :s

Once you have the equation in quadratic form you can then try to factor it. Not all equations can be factored. When you can't you must use some other method like the quadratic equation to solve for x. With all that said lets try one.

\(x^2 - 4x = 12\)

First lets put it in the standard form of \(ax^2 + bx + c = 0\).

\(x^2 - 4x - 12 = 0\)

With that done now we can factor it:

\((x - 6)(x + 2) = 0\)

Now we know that $6$ or $-2$ are solutions for x. That's it, equation solved! Let's just check our answers to be sure.

First we will plug in $6$ and see if it works.

$$ \begin{align*} 6^2 - 4(6) - 12 = 0\\ 36 - 24 - 12 = 0 \end{align*} $$

Looks good to me. Lets try with $-2$.

$$ \begin{align*} (-2)^2 - 4(-2) - 12 = 0\\ 4 + 8 - 12 = 0 \end{align*} $$

So there you have it. One thing to note, if you are dealing with an equation of degree 2, then you will have 2 roots (answers) for that equation. See this for more information.

This weekend I will cover completing the square and the quadratic formula. Then, for completeness, I will show you how to derive the quadratic formula and a reverse proof for it. Oh the fun we will have! Thanks for reading. Please comment if I missed something or you have any questions.