Computing Integrals by Completing the Square

We will review the method of completing the square in the context of evaluating integrals.

Example

Let's start by evaluating


dx
2x2-12x+26
.

The denominator does not factor with rational coefficients, so partial fractions is not a viable option. There is also no obvious substitution to make. Instead, we will complete the square in the denominator to get a recognizable form for the integral.

Now

2x2-12x+26 = 2[x2-6x+13]
Factor out the
coefficient of x2
= 2[(x2-6x+9)+4]
1/2(-6) = -3
(-3)2 = 9
so group x2-6x+9
= 2[(x-3)2+4].
Factor your
perfect square.

Returning to the integral,


dx
2x2-12x+26
=

dx
2[(x-3)2+4]
=
1
2

dx
(x-3)2+22
    

du
u2 + a2
 =  1
a
 arctan /

\
u
a
\
 |
/
+C
=
1
2
/

\
1
2
 arctan((x-3)/2) \
 |
/
+C
=
1
4
 arctan /

\
x-3
2
\
 |
/
+C.

Certain other types of integrals can be evaluated by this method as well:

Example

Consider




        dx         
   ________
21-4x-x2
.


Now

21-4x-x2 = 21-[x2+4x]
Factor out the
coefficient (-1) of x2
= 21+4-[x2+4x+4]
1/2(4) = 2
22 = 4
so group x2+4x+4
= 25-(x+2)2.
Factor your
perfect square

Returning to the integral,




        dx         
   ________
21-4x-x2
=




        dx         
   ________
25-(x+2)2
    



      du       
   ______
a2 - u2
= arcsin /

\
u
a
\
 |
/
+C
=
arcsin /

\
x+2
5
\
 |
/
+C.

Completing the square is a powerful method that is used to derive the quadratic formula:

We will find the roots of ax2+bx+c = 0.

ax2 + bx + c = 0
x2 + b
a
x + c
a
= 0
Divide through by a
x2 + b
a
x
=
- c
a
Move the constant
c
a
to the right)
x2 + b
a
x + b2
4a2
=
b2
4a2
- c
a
Add the square of
1/2[coefficient of x]
to both sides)
/

\
x + b
2a
\
 |
/
2

 
=
b2 - 4ac
4a2
Factor the left as a
perfect square;
simplify the right
x + b
2a
=
      ______
± b2 - 4ac

2a

Take the square root
of both sides)
x =
           ______
-b ± b2 - 4ac

2a

Solve for x
which is the familiar quadratic formula!


Key Concepts [index]

By completing the square, we may rewrite any quadratic polynomial

ax2 + bx + c
in the form
a[(x+k1)2+k2]
where k1 and k2 may be positive or negative. Integrals containing negative or non-integer powers of ax2+bx+c can often be computed using a trigonometric substitution or looked up in an integral table after being rewritten in this form.