13. Integration Techniques#
13.1. Integration by Substitution#
This is the reverse of the chain rule. It gives us a way of changing the variable in an integral. The theorem itself looks a little confusing, but with some examples its use should become clear.
Theorem 13.1 (Integration by Substitution)
Let \(u=u(x)\) be a function of \(x\). Then we have
Remarks:
In the above formula, \(f(u)\) is \(f(u(x))\) expressed in terms of \(u\) only, \(\frac{dx}{du}\) is the derivative of \(x\) with respect to~\(u\) and the \(du\) appearing means that the right hand integral is performed with respect to \(u\).
A good way to remember the formula is that we are substituting
\[ dx=\frac{dx}{du}du \]so “the \(du\)’s cancel”.
Substitution works for integrating a function of a function; the chain rule works for differentiating a function of a function. So you can always check your answer by using the chain rule.
Not every integral of a function of a function can be found by using substitution. In fact, there are integrals for which there is no easy way to find the answer. The standard example is \(\displaystyle\int e^{-x^2} dx\). This integral is very important for probability theory (Gauss distribution) and while one can work out \(\displaystyle\int_a^b e^{-x^2}dx\) for any values of \(a\) and \(b\), there is no known function \(f(x)\) with \(f(x) = \int e^{-x^2}dx\).
Let’s look at an example.
Example 13.1
Find \(\displaystyle I = \int (7x +5)^9 dx\).
Solution.
Until now, to do this we would have had to expand out the bracket and work term by term; now we will use integration by substitution.
We note that \((7x+5)^9\) is a function of a function and the inner function is \(u = 7x +5\). Then \(\frac{du}{dx} = 7\) and so \(\frac{dx}{du}=\frac{1}{\frac{du}{dx}}=\frac{1}{7}\). We substitute these into our integral \(I\) to get
To finish, we must express the answer in terms of \(x\), so we substitute back to get
If we differentiate \(F(x) = \frac 1{70} (7x+5)^{10} + C\) we use the chain rule and get \(F'(x) = \frac 1{70}\times 7 \times 10(7x+5)^9 = (7x+5)^9\) as required.
Example 13.2
Find \(\displaystyle I = \int x^2 (x^3 + 4)^\frac 53 dx\).
Solution.
Again, we have a function of a function together with a product to integrate, \(f(x) = x^2(x^3 +4)^\frac 53\) where the inner function is
\(u = x^3 +4\). Then \(\frac{du}{dx} = 3x^2\) and we see that \(\frac{du}{dx} = 3x^2\) is nearly the other factor in our function \(f(x)\).
Now, by the inverse function rule, \(\frac{dx}{du} =
\frac{1}{3x^2}\) which cancels the \(x\)’s in the other factor.
Then, using integration by substitution, we get
(Remember that the answer should always be given in terms of \(x\), not \(u\).)
Again, differentiating \(F(x)= \frac 18 (x^3 +4)^\frac 83 + C\) using the chain rule gives \(F'(x) = \frac 18 \times 3x^2 \times \frac 83(x^3+4)^\frac 53 = f(x)\).
Example 13.3
Find \(I = \displaystyle \int \sin x \sqrt{\cos x} dx\).
Solution.
The function of a function is the \(\sqrt{\cos x}\) factor so we let \(u = \cos x\) which gives \(\frac{du}{dx} = -\sin x\) and thus \(\frac{dx}{du} = - \frac{1}{\sin x}\). Then, using integration by substitution we get
13.2. Definite Integrals and Substitution#
Care must be taken when using integration by substitution with definite integrals: the limits must be changed. When we have definite integral, convention allows us to write \(\displaystyle \int_a^b f(x)dx\) for \(\displaystyle\int_{x=a}^{x=b} f(x)dx\). This cuts down on writing. We illustrate how to deal with the limits with some examples.
Example 13.4
Find \(\displaystyle I = \int _0^1 \frac 1{(1+2x)^3} dx\).
Solution.
Let \(u = 1+ 2x\) so that \(\frac{du}{dx} = 2\) and \(\frac{dx}{du} = \frac{1}{2}\). But when we change the ‘\(dx\)’ of the integral into the ‘\(du\)’, our limits needs to change from \(x\)-limits into \(u\)-limits. So the next step is to calculate the new limits in terms of \(u\).
Now, when \(x=0\) (the lower limit) we have \(u =1+2\times0=1\). Similarly, when \(x=1\) we have \(u =1+2\times1=3\). Thus, after substituting for \(u\) are integral is between \(u=1\) and \(u=3\). We get
Remark: When calculating a definite integral it is not necessary to substitute back to get things in terms of \(x\) — changing the limits has already taken this into account.
Example 13.5
Find \(\displaystyle I = \int_0^{\frac \pi 2} \cos x \sec^2(\sin x)dx\).
Solution.
Let \(u = \sin x\) so that \(\frac{du}{dx} = \cos x\) and so \(\frac{dx}{du} =
\frac{1}{\cos x}\). For the limits, if \(x = 0\) then \(u = \sin 0 = 0\) and if \(x =
\frac \pi 2\) then \(u=\sin (\frac{\pi}{2}) = 1\). Thus
13.3. Integration using Partial Fractions#
13.3.1. Important Examples#
Partial fractions are a very practical tool to find integrals where the function to integrate is a quotient of two polynomials.
Recall that we have three types of possible terms:
where \(ax^2+bx+ C\) is a quadratic which doesn’t factorise. Here are examples of integrals of these types. They are dealt with by substitution.
Example 13.6
Find \(\displaystyle I = \int \frac 1{2x+3}dx\).
Solution.
Let \(u = 2x +1\) so that \(\frac{du}{dx} = 2\) and \(\frac{dx}{du} =
\frac{1}{2}\). Thus
Example 13.7
Find \(\displaystyle \int \frac 3{(2x-5)^6}dx\).
Solution.
Let \(u = 2x-5\) so that \(\frac{du}{dx} = 2\) and \(\frac {dx}{du} = \frac 12\). The
Example 13.8
Find \(\displaystyle I = \int \frac{4x + 5}{x^2+1} dx\).
Solution.
We note that we can write
and solve each of the integrals separately.
Let \(\displaystyle I_1 = \int \frac {4x}{x^2 +1} dx\). To evaluate this, we use substitution where \(u = x^2 +1\) to get \(\frac{du}{dx} = 2x\) so that \(\frac{dx}{du} =\frac{1}{2x}\). Then
Note that since \(x^2 + 1 \geq 1\) for all \(x\in \mathbb{R}\) we have \(\ln |x^2+1|=\ln (x^2+1)\) so that we can write \(I_1\) more simply as
For the second integral, write \(I_2=\int \frac{5}{x^2+1}~dx\) and recall that \(\displaystyle\int \frac 1{1+x^2} dx = \tan^{-1} x + C\) is a standard integral. So we get
Thus
where \(c=c_1+ C_2\).
13.3.2. Integration using Partial Fractions#
Now we deal with general integrals where the function to integrate is the quotient of two polynomials. Note that sometimes you can just use substitution for these, but partial fractions always works.
Example 13.9
Find \(\displaystyle I = \int \frac{4x + 5}{(x-1)(2x+3)} dx\).
Solution.
I first check if I can do substitution: The denominator is \(2x^2 -x -3\) and the derivative of this is not a multiple of the numerator, so substitution will not work here.
We simplify \(I\) by expressing \(\frac{4x + 5}{(x-1)(2x+3)}\) in partial fractions.
Noting that the fraction is bottom heavy, we write
for some real numbers \(A\) and \(B\). Multiplying through we get
Putting \(x = 1\) gives \( 9 = 5A\) so that \(\displaystyle A = \frac 95\).
Putting \(\displaystyle x = -\frac 32\) gives \(\displaystyle -1 = -\frac 52 B\) so that \(\displaystyle B = \frac {2}{5}\).
Thus we have
and hence
Let \(\displaystyle I_1=\frac 95 \int \frac{1}{x-1} dx\) and \(\displaystyle I_2=\frac 25 \int \frac{1}{2x+3} dx\). We have seen integrals like these before and have used integration by substitution to solve them. To evaluate \(I_1\) let \(u = x-1\). Then \(\frac{du}{dx} = 1\) so that \(\frac{dx}{du}=1\). Thus
To evaluate \(I_2\) let \(u = 2x+3\). Then \(\frac{du}{dx} = 2\) so that \(\frac{dx}{du} = \frac{1}{2}\). Thus
Hence, putting these together, we get
where \(c=c_1+ C_2\).
Example 13.10
Find \(\displaystyle I = \int \frac{x^2 + x - 7}{(x^2+1)(x-3)} dx\).
Solution.
The denominator is \(x^3 -3x^2 +x -3\) and its derivative is not a multiple of the numerator, so we need partial fractions.
Noting that the fraction is bottom heavy and that \(x^2+1\) doesn’t factorise (over the real numbers), we write
so that
Putting \(x = 3\) gives \(5 = 10 C\) so that \(C = \frac 1{2}\).
Comparing coefficients of \(x^2\) gives us that \( 1 = A + C\) so that \(A = \frac 12\).
Looking at the constant terms gives \(-7 = -3B + C\) so that \(B = (7+ \frac 12 )/3 = \frac{15}{6} = \frac 52\).
Thus
Hence
Let \(I_1, I_2\) and \(I_3\) be as shown. For \(I_1\), let \(u = x^2 + 1\) so that \(\frac{du}{dx} = 2x\) and \(\frac{dx}{du} = \frac{1}{2x}\). Then
as \(x^2+1 > 0\) for all \(x \in \mathbb{R}\).
We can evaluate \(I_2\) as a standard integral without the need for a substitution.
For \(I_3\), let \(u = x-3\) so that \(\frac{du}{dx} = 1\) and \(\frac{dx}{du} = 1\). Then
Putting these together we get
since \(x^2+1>0\) for all \(x\in \mathbb{R}\).
13.4. Integration by Parts#
Integration by parts is essentially the reverse of the product rule for differentiation. Recall that the product rule says
If we integrate this equation we get
and so, remembering that integration is the reverse to differentiation, we have
Rearranging this gives us the equation
This is a useful result, as we will see later on. It is referred to as “integration by parts”.
Theorem 13.2 (Integration by Parts)
Let \(u\) and \(v\) be functions of \(x\). Then
or, in another notation
We illustrate how to use this result with an example.
Example 13.11
Find \(\displaystyle \int x \sin x dx\).
Solution.
We use integration by parts, letting \(u = x\) and \(\frac{dv}{dx} =\sin x\). Then \(\frac{du}{dx} = 1\) and to find \(v\) we integrate:
(Note that any function which differentiates to give \(\sin x\) works for \(v\), so we can omit the constant). Using the integration by parts formula gives
Note that we can check our answer by differentiating:
as expected.
Remark 13.1
When using integration by parts to integrate something of the form \(\displaystyle \int x^n f(x) dx\) (where \(n\) is a positive integer) we normally let \(u = x^n\) and \(\frac{dv}{dx}=f(x)\). This ensures that the integral gets simpler to evaluate. One exception is if \(\ln x\) is involved, as we will see later.
Example 13.12
Find \(I = \displaystyle \int x e^x dx\).
Solution.
We use integration by parts with \(u = x\) and \(\frac{dv}{dx} = e^x\). Then \(\frac{du}{dx} = 1\) and \(v = e^x\). Thus
Again, we can check the answer by differentiating:
as expected.
Sometimes it is necessary to use integration by parts more than once. The following is one such example.
Example 13.13
Find \(\displaystyle I = \int x^2 \sin x dx\).
Solution.
We integrate by parts letting \(u = x^2\) and \(\frac{dv}{dx} = \sin x\) so that \(\frac{du}{dx} = 2x\) and \(v = - \cos x\). Then
We now have to find \(\displaystyle \int x\cos x dx\), which we do using integration by parts. Put \(u=x\) and \(\frac{dv}{dx}=\cos x\). Then \(\frac{du}{dx}=1\) and \(v=\sin x\) and we get
Hence
where \(c'=2c\).
Once again, we can check the answer using differentiation; this is left as an exercise.
We are yet to use integration by parts to solve definite integrals.
Example 13.14
Find \(\displaystyle I = \int_1^2 x^2 e^x dx\).
Solution.
Note that this is a definite integral. When evaluating definite integrals using integration by parts it is
necessary to put limits on each term in the answer, as demonstrated below.
Let \(u = x^2\) and \(\frac{dv}{dx} = e^x\). Then \(\frac{du}{dx} = 2x\) and \(v = e^x\). Thus, using integration by parts and the result from earlier that \(\displaystyle \int xe^x dx =e^x(x-1) + C\), we get
Sometimes there is only one option for \(u\) and \(v\) available, namely when we don’t know how to integrate one of the factors in the product.
Example 13.15
Find \(\displaystyle I = \int x \ln x dx\).
Solution.
As we do not know how to integrate \(\ln x\) at the moment, we will have to choose \(u = \ln x\) and \(\frac{dv}{dx} = x\) for integration by parts. Then \(\frac{du}{dx} = \frac 1x\) and \(v = \frac 12 x^2\) and so
Differentiating to check:
as expected.
13.5. Tricks using Integration by Parts#
There are a couple of tricks using integration by parts that can help with otherwise difficult integrals. The first trick is to create a product out of something that doesn’t look like one at first glance.
Example 13.16
Find \(\displaystyle I = \int \ln x dx\).
Solution.
The trick here is to write \(\ln x=1.\ln x\). Then we can put \(u=\ln x\) and \(\frac{dv}{dx}=1\) and use
integration by parts. We have \(\frac{du}{dx}=\frac{1}{x}\) and \(v=x\) so our formula gives
Differentiating to check:
as expected.
Example 13.17
Find \(\displaystyle I = \int \sin^{-1} x dx\).
Solution.
We know how to differentiate \(\sin^{-1} x\) so we try the same trick by setting \(u = \sin^{-1} x\) and \(\frac{dy}{dx} = 1\). Then \(\frac{du}{dx} = \frac{1}{\sqrt{1-x^2}}\) and \(v = x\). Thus using integration by parts gives
Now, we can solve \(\displaystyle \int x (1-x^2)^{-\frac 12}\) by substitution. Indeed, let \(u = 1-x^2\). Then \(\frac{du}{dx} = -2x\) so that \(\frac{dx}{du}=-\frac{1}{2x}\). Hence
Thus we get
That is, \(\displaystyle \int \sin^{-1} x dx = x\sin^{-1} x + (1-x^2)^\frac 12+ C\).
Checking the answer by differentiating:
Another helpful trick is to use integration by parts a couple of times to end up with our original integral. This often occurs when a trigonometric functions, such as \(\sin x\) or \(\cos x\), is coupled with \(e^x\). Here’s a typical example.
Example 13.18
Find \(\displaystyle I= \int e^x \sin x dx\).
Solution.
We use integration by parts with \(u = e^x\) and \(\frac{dv}{dx} = \sin x\). Then \(\frac{du}{dx} = e^x\) and \(v = -\cos x\). Hence
We now have to integrate \(\displaystyle \int e^x\cos x dx\), which will again require integration by parts. Let \(u = e^x\) and \(\frac{dv}{dx} = \cos x\) so that \(\frac{du}{dx} = e^x\) and \(v = \sin x\). Then
Thus
But \(\displaystyle \int e^x \sin x dx = I\) so that
and hence
(Note that we have introduced a constant of integration at this stage as \(I\) is an indefinite integral and so requires one.)
This gives us our result:
Note
If you got at the end to \(0 = 0\) you choose in the second integration by parts \(u\) and \(v\) so that they counter exactly the bit you did in the first part!
13.6. Trigonometric Powers#
We have two ‘types’ of trigonometric powers, odd and even.
We first consider the odd powers. Odd powers work by splitting one power off, using \(\sin^2 x + \cos^2 x =1\) and substitution.
Here are two examples.
Example 13.19
Find \(\displaystyle I = \int \sin^3 x dx\).
Solution.
With an odd power we take out a factor of \(\sin x\) and write \(\sin^3 x = \sin^2 x(\sin x) = (1-\cos^2x)(\sin x)\). Thus we get
We integrate this with the substitution \(u= \cos x\). Then \(\frac{du}{dx} = -\sin x\) so that \(\frac{dx}{du} = -\frac{1}{\sin x}\) and
Example 13.20
Find \(\displaystyle I = \int \cos^5 x dx\).
Solution.
We approach this similarly to the above, taking out a factor of \(\cos x\) to get
We let \(u = \sin x\) so that \(\frac{du}{dx} = \cos x\) and \(\frac{dx}{du} = \frac{1}{\cos x}\). Hence
This looks a little surprising. We’ll differentiate the right-hand side to check:\
as hoped.
For the even powers, we need the double angle formula for \(\cos x\):
Example 13.21
Find (i) \(\displaystyle \int \sin^2 x dx\) and (ii) \(\displaystyle \int \cos^2 x dx\).
Solution.
(i) We are looking at \(\displaystyle \int \sin^2 xdx\). Now, the equation \(\sin^2x + \cos^2 x=1\)
rearranges to give
But from \(\cos^2 x -\sin^2 x = \cos(2x)\) we get \(\cos^2 x=\cos(2x)+\sin^2 x\) and substituting this gives
Hence \(2\sin^2 x = 1-\cos(2x)\) and so
Putting this into our integral gives
(ii) We employ a similar method as above. From \(\cos^2 x - \sin^2 x = \cos(2x)\) we get
But \(\sin^2 x + \cos^2 x = 1\) so we get \(\sin^2 x = 1 - \cos^2 x\) and hence
Rearranging gives \(2\cos^2 x = \cos(2x)+1\) and we arrive at
Thus, putting this into our integral,
As an aside, note that our results above give
for some constant \(c\). This is a sign that we’ve calculated them correctly, because the identity \(\sin^2 x + \cos^2 x=1\) gives