PDA

Click to See Complete Forum and Search --> : Completing The Square Tutorial


03myersd
May 7th, 2008, 03:02 PM
I have my higher maths exam coming up in a couple of weeks and one of the things I just cant get my head wrapped around is completing the square. I am looking for someone to take the time and show me how to do it as clearly as possible. Just in case anyone isn't entirely sure on what it is, it is something along the lines of:

Express x2+3x+5 in the form (x+a)2+b


Thanks in advance for any help I recieve.

NickThissen
May 7th, 2008, 03:39 PM
Consider (x+a)2 and then factor out the brackets:

(x+a)(x+a) = x2 + 2ax + a2

Let's take the example above, x2 + 3x + 5.

Since you must write this in the form (x+a)2 + b (= x2 + 2ax + a2 + b) you can directly see that:

2a = 3
a2 + b = 5

This allows you to find both a and b!

a = 3/2
(3/2)2 + b = 5
b = 5 - (3/2)2 = 11/4

This yields:
x2 + 3x + 5 = (x+3/2)2 + 11/4


Note that this also works with - , for example:
x2 - 8x - 5 = (x+a)2 + b
x2 - 8x - 5 = x2 + 2ax + a2 + b
2a = - 8 --> a = -4
a2 + b = - 5 --> (-4)2 + b = -5 --> b = -5 - 16 = -21

x2 - 8x - 5 = (x + (-4))2 + (-21) = (x - 4)2 - 21


Another way to do this is slightly harder to explain but mostly much easier to do.

For example, let's take a look at x2 + 4x + 8.

Let's forget about the +8 for now and look only at x2 + 4x + ...
If you want to factorize this into something like (x+a)2 you will easily see that it will be something along the lines of (x+2)2, because:
(x+2)2 = x2 + 4x + 4

Now look back at the +8.

Since (x+2)2 = x2 + 4x + 4, you are still missing another +4 on the right.

So if you write (x+2)2 + 4, you get:
x2 + 4x + 4 + 4 = x2 + 4x + 8.


So the easiest way (for me) is to look for the (x+a)2 form first, forgetting about the last constant term.
This form is usually really easy to get, take a look at this:

x2 + ax + ... = (x+ a/2)2 + ...

In other words, you know that the 'a' in (x+a)2 is always half of the linear 'x' term (in ax2 + bx + c, the linear 'x' term is b).

Once you have found that, you quickly see what you should add (or substract) to get the last constant term back.



To verify you understand, try to write the following in the form (x + a)2 + b , they might be a bit harder than usual:wave:
a) x2 - 6x + 8
b) x2 - 2πx - e
c) x2 + 116x
d) x2 - 8x + 16

03myersd
May 7th, 2008, 03:53 PM
The first way makes perfect sense. Takes slightly longer but Im much less likely to get it wrong. You have got to love the mind of a programmer.... :D

Thanks!!!!!

03myersd
May 7th, 2008, 04:14 PM
Just noticed the questions you left for me. I haven't checked these by multiplying back but I get:

(x-3)2-1
(x+pi)2-e-pi2
(x+58)2-3364
(x-4)2

jemidiah
May 7th, 2008, 05:42 PM
In general given x2 + px + q, you can complete the square by using

(x+p/2)2 = x2 + px + (p/2)2, so
(x+p/2)2 + (q - (p/2)2) = x2 + px + q = (x+a)2+b.


That is, in your original form, a = p/2, and b = q - (p/2)2.

Checking the first question posed with this we have
x2 - 6x + 8 ---> p = -6, q = 8 ---> a=-3, b = 8-9 = -1 ---> the answer is (x-3)2-1, as you have. If you can remember formulas well this method is computationally very efficient and mechanistic. Note, though, that this assumes the number in front of the x2 term is 1.

NickThissen
May 8th, 2008, 01:31 AM
Your answers are correct except for b), it should be (x-pi)... but I suppose that's just a tiny error :)

jemidiah, good explanation. It's exactly what I gave as the first method only more compact I guess :p
And both my methods also assume the quadratic term is 1x2. If not, if the formula is ax2 + bx + c for example, (a not 0 or 1) then you can always divide by a: x2 + (b/a)x + (c/a), and complete the square then.


I still like to do it with my second method more though. Requires less thinking and you don't have to write up so much (easier to do in your head) especially when the numbers are easy (no fractions etc).

03myersd
May 8th, 2008, 01:34 AM
So the first method of yours Nick only works if the number before x2 is 1?

NickThissen
May 8th, 2008, 01:44 AM
As far as I know, all methods only work if the number before x2 is 1.

However, if it's not, then you can always divide the whole thing by the number infront of x2, making the number 1 again.

What you are actually doing when completing the square is rewriting ax2 + bx + c = 0

Dividing by a yields:
(a/a)x2 + (b/a)x + (c/a) = (0/a)
x2 + (b/a)x + (c/a) = 0

So you can now complete the square for x2 + (b/a)2 + (c/a). This probably gives you fractions but it's still possible.


You can use completing the square to find roots of a quadratic function. For example:

2x2 + 12x - 14 = 0
x2 + 6x - 7 = 0
(x + 3)2 - 16 = 0
(x + 3)2 = 16
(x + 3) = +/- 4
x = -3 +/- 4
x = -7 or x = 1

(Note that if you write this out with a, b and c as coefficients instead of 2, 12 and -14, you get the familiar quadratic formula!)

zaza
May 8th, 2008, 04:44 AM
Clearly if you are looking to express it in the form (x+a)2+b then the x2 component has to have a factor of 1, implying that you need to have divided through already. Of course, it is perfectly possible to express it in the form (cx+a)2+b; it just means that c2 is determined solely by the x2 component, allowing you to then work out a and b as normal...

03myersd
May 8th, 2008, 11:46 AM
If the co-efficient (is that the word?) of x2 is something other than one then don't we just need to take out a common factor?

NickThissen
May 8th, 2008, 12:08 PM
That is basically the same as simply dividing by that coefficient.

Look at the following:

ax2 + 2ax + 5a = 0 (a not 0)
a ( x2 + 2x + 5 ) = 0

This implies that:
a = 0 or x2 + 2x + 5 = 0

Since we have chosen a not 0, this yields only the latter solution.

For general coefficients:

ax2 + bx + c = 0
a ( x2 + (b/a)x + (c/a) ) = 0
a = 0 or x2 + (b/a)x + (c/a) = 0
a is not 0 so... The same applies here.


Finally have a look at this. If you encounter a polynomial like this:
9x2 + 2x - 5

You can try to write it in the form
(x + a)2 + b = x2 + 2ax + a2 + b

From this you see that:
2a = 2
a2 + b = - 5
x2 = 9x2

The last (bold) equation is not satisfied for all x and thus you have reached a contradiction. You cannot write 9x2 + 2x - 5 in the form (x + a)2 + b.

You can however write it in a similar form, like zaza mentioned: (cx + a)2 + b

(cx + a)2 + b = (cx)2 + 2acx + a2 + b

Looking at the 9x2 + 2x - 5 example we see:
c2 = 9 --> c = 3
2ac = 2 --> 6a = 2 --> a = 2/6 = 1/3
a2 + b = -5 --> 1/9 + b = -5 --> b = -5 - 1/9

9x2 + 2x - 5 = (3x + 1/3)2 - (5 + 1/9)

anhn
May 14th, 2008, 01:33 AM
Generally, you can transform x2 + p.x + q to (x + a)2 + b like this:

x2 + p.x + q
= x2 + 2.(p/2).x + (p/2)2 + q - (p/2)2
= [x2 + 2.(p/2).x + (p/2)2] + [q - (p/2)2]
= (x + p/2)2 + [q - (p/2)2]
= (x + a)2 + b
where a = p/2 and b = q - (p/2)2

Example:
x2 + 3.x + 5 = x2 + 2.(3/2).x + (3/2)2 + 5 - (3/2)2
= (x + 3/2)2 + (5 - 9/4) = (x + 3/2)2 + (11/4 )

03myersd
May 14th, 2008, 02:39 AM
I still find Nick's the easiest to use. All you have to remember is that if there is a number before the X^2 then take out a common factor.

NickThissen
May 14th, 2008, 09:42 AM
All the methods we have provided here are equivalent. If you break them down into what exactly you are doing, you fill find the methods are exactly the same. Some methods however are easier to remember, some are easier to execute.