How to Complete the Square


[For another point of view on completing the square, see the page and applet on the topic at Arizona State University and this Utube video]
© 2001 by Karl Hahn
KCT logo

Start with the Basics

The idea of completing the square is to find the sum of a squared binomial (i.e. (x + something)2) with some constant expression that is equal to your original quadratic. That is, you want to write your quadratic in the form of,  (x + something)2 + otherStuff

The procedure shown to the right illustrates how to do this when the x2 coefficient is 1. When that is the case, simply replace the p and the q in the quadratic shown in the illustration with whatever your quadratic's coefficients are, and do the same thing.

If the leading coefficient is not 1, then divide through by that leading coefficient so that the result is:

 ax2 + bx + c  =  a(x2 + (b/a)x + c/a)
The b/a becomes your p and the c/a becomes your q. Now simply apply the procedure to the quadratic that is inside the parentheses in the above.

Here is an example. The steps show that
x2 + 6x + 7 = (x + 3)2 - 2

Once you have the quadratic in the form of  (x + something)2 + otherStuff,  you can always make the substitution,  u = x + something  and find that your quadratic has become,  u2 + otherStuff

Now Apply it to Trig Substitution

All trig substitution and hyperbolic substitution integral problems involve a quadratic as part of the integrand. To apply the method of trig or hyperbolic substitution, that quadratic must first be brought into a form where the middle coefficient is zero. That is, it has to be in the form of

   v2 ± p
positive version
or

   p - v2
negative version
where p is some positive constant. If you have a quadratic in the form of


   q(x)  =  x2 + ax + b
positive version
or

  -q(x)  =  -x2 - ax - b
negative version
then, to get it into the first form, you will have to complete the square. (Note that you can always get your quadratic into one of the above forms by dividing out the absolute value of the leading coefficient. e.g.,  -3x2 + 6x + 12  becomes  3(-x2 + 2x + 4)). 

Step 1: Add half the middle coefficient to x. That is, make the substitution,  v = x + a/2. Then, when you square v, you get


   v2  =  x2 + ax + a2/4
positive version
or

   -v2  =  -x2 - ax - a2/4
negative version
The choice of making  v = x + a/2  is calculated so that when you square this expression, it will have the same middle term as the original quadratic,  q(x).  For the example of  -x2 + 2x + 4,  you have  a = -1  (this example is the negative
version -- can you see why we have -1 and not +1 here?) When you square  v = x - 1,  you get  v2 = x2 - 2x + 1,  or equivalently,  -v2 = -x2 + 2x - 1

Step 2: Add the constant that will turn v2 into the original quadratic,  q(x).  In the general case you would add  b - a2/4  (in our example  b = -4,  so you would add  -4 - 4/4 = -5  to v2, which forms a positive version. Then just turn it around to form the negative version,  5 - v2).  Here's the general case of how adding the constant to v2 gets us back to the original quadratic,  q(x)

     v2             =  x2 + ax +     a2/4
    +     b - a2/4  =            b - a2/4
                                        
     v2 + b - a2/4  =  x2 + ax + b           =  q(x)
That means that in the first equation on this page,  v2 ± p  or  p - v2,  we have figured out what p is.
   p  =  |b - a2/4|

(note that in the positive version, you choose the + or - according to whether  b - a2/4  is positive or negative respectively)

Now convert  v2 ± p  or  p - v2  into


   p

 

 v
 _
√p

2
  ±  1


positive version
or


   p

 

1  -

  
 v
 _
√p

2



negative version
and we would be prepared to make our trig or hyperbolic substitution. In our example  p = |-5| = 5,  so you would have as your substituted expression,  5 - v2  or

   5
 

1  -

  
 v
 _
√5

2



our example is a negative version
If the substituted expression is under a radical, you will have to pull the p outside of the radical, which means it will be square-rooted there, so the whole substituted expression, including all the radicals, will be.

    _
   √p

 
positive version
or

    _
   √p

 
negative version
The example, if the original quadratic had occurred under a radical, becomes

   _
  √5

 
our example is a negative version


To Integrate...

Your substitution function will be: If the quadratic is under a radical, then use

Hyperbolic method:

                v
   sinh(u)  =   _
               √p
positive version with a plus sign
or
Method covered in More Substitutions

               v
   tan(u)  =   _
              √p
Hyperbolic method:

                v
   cosh(u)  =   _
               √p
positive version with a minus sign
or
Method covered in More Substitutions:

               v
   sec(u)  =   _
              √p

                v
   sin(u)   =   _
               √p
negative version
If the quadratic appears in the denominator with no radical, then use

                v
   tan(u)  =    _
               √p
positive version with plus sign
                v
   tanh(u)  =   _
               √p
positive version with a minus sign (or factor and use partial fractions)
In this case, if you have a negative version, factor out a (-1) to turn it into a positive version.

Note that the functions, cosh, sinh, and tanh, are covered in the section on hyperbolic functions.


Return to Main Text

You can email me by clicking this button:

  Use your own emailer     Use form