# How to Integrate Functions by Completing the Square

Instructor: Michael Eckert

Michael has a Bachelor's in Environmental Chemistry and Integrative Science. He has extensive experience in working with college academic support services as an instructor of mathematics, physics, chemistry and biology.

We want to integrate a rational function that includes a polynomial by expressing the polynomial as the sum or difference of two squares so that we can apply a substitution (trigonometric or logarithmic).

## Integrating Rational Functions

As we move along in a calculus course, we begin to see integrals of increasing complexity. An example of this is a rational function with a polynomial in the numerator or denominator. In this case, we may first have to complete the square to rewrite it as the sum or difference of two squares. Once this is done, we can usually apply a substitution or series of substitutions from which we can more easily integrate.

For instance, we are given the following integral:

What are some of the steps to integrating this rational function?

## Completing the Square

First, we see that the denominator is a quadratic expression. At first glance, it appears that it cannot be factored. Our goal should be to change this denominator into the sum or difference of two squares so that we can use substitution to integrate. We look at this denominator:

x2 + 2x + 5

To complete the square, we need to change this quadratic expression to a form that we can factor. We start with:

x2 + 2x + 1 + 4

Here, we expressed the 5 as 1 + 4. We see that we can group and factor the first three terms:

x2 + 2x + 1 + 4 = (x + 1)2 + 4

Additionally, we can express the 4 as 22. So, in completing the square of this quadratic expression, we will be left with:

(x + 1)2 + 22

Substituting this result back into our integral:

We now have an integral with the sum of two squares, where x = (x + 1) and a = 2:

## Substitutions

### The Denominator

Because we now have our denominator in the form:

a2 + x2

and we know that:

x = a tanθ

We can express a2 + x2 as:

a2 + a2 tan2θ = a2 (1 + tan2θ)

And, in turn:

a2 (1 + tan2θ)

can be expressed as (another substitution):

a2 sec2θ

Since we established that a = 2, our denominator becomes 4 sec2θ.

### The Numerator

Before we can integrate, we must change our numerator, dx, to a form with dθ. We know the following:

(x + 1) / 2 = tanθ

This is equal to:

x + 1 = 2 tanθ

Taking the derivative of this, we have:

dx = 2 sec2

This is what we were looking for. Now that dx is in terms of dθ, we can fill in the numerator with 2 sec2 dθ.

## Back to Our Integral

Making all the necessary substitutions, our denominator will be:

4 sec2θ

and our numerator will be:

2 sec2θdθ.

To unlock this lesson you must be a Study.com Member.

### Register to view this lesson

Are you a student or a teacher?

#### See for yourself why 30 million people use Study.com

##### Become a Study.com member and start learning now.
Back
What teachers are saying about Study.com

### Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.