Skip to main content
Integration 2
This material has been adapted from material by Fergus Cooper and others from the "Essential Mathematics" module at the Doctoral Training Centre, University of Oxford.

This material has been adapted from material by Fergus Cooper and others from the "Essential Mathematics" module at the Doctoral Training Centre, University of Oxford.

Creative Commons License
This course material was developed as part of UNIVERSE-HPC, which is funded through the SPF ExCALIBUR programme under grant number EP/W035731/1

This course material was developed as part of UNIVERSE-HPC, which is funded through the SPF ExCALIBUR programme under grant number EP/W035731/1

Creative Commons License

Integration 2


YouTube lecture recording from October 2020

A recording of this lecture from October 2020; the material has changed a little since.
Youtube lecture thumbnail

Why more methods?

Not every function can be integrated by reversing a standard derivative, or by substitution.
In this lecture we add two more methods: integration by parts, which reverses the product rule, and partial fractions, which splits a fraction into simpler ones.
We will need both when we solve differential equations.

Integration reverses the process of differentiation

In general

d(a xn+1)dx=(n+1)a xn⇒∫x1x2a xn dx=[an+1 xn+1]x1x2(n≠−1)\begin{gathered} \frac{d(a\, x^{n+1})}{dx}=(n+1)a\, x^n \\ \Rightarrow\qquad \int_{x_1}^{x_2} a\, x^n\,dx = \Big[\frac{a}{n+1}\, x^{n+1}\Big]_{x_1}^{x_2} \qquad (n\neq -1) \end{gathered}

Reminder, method 1: integration by substitution

This method can be thought of as an integral version of the chain rule. Suppose we wish to integrate:
I=∫f(g(x)) dx=∫f(u) dxI=∫f(u)dxdu du\begin{aligned} I &=\int f(g(x))\,dx= \int f(u)\,dx \\ I &=\int f(u)\frac{dx}{du}\,du \end{aligned}

Integration method 2: integration by parts

Recall that:
ddxf(x) g(x)=f(x) g′(x)+g(x) f′(x)\frac{d}{dx}f(x)\,g(x)=f(x)\,g'(x)+ g(x)\,f'(x)
Integrate and rearrange to get:
∫abf(x) g′(x) dx=[f(x) g(x)]ab−∫abg(x) f′(x) dx\int\limits_a^b f(x)\,g'(x)\,dx=\Big[f(x)\,g(x)\Big]_a^b-\int\limits_a^b g(x)\,f'(x)\,dx
This is known as the formula for 'integrating by parts' and can also be written:
∫abu dvdx dx=[uv]ab−∫abv dudx dx\int\limits_a^b u\,\frac{dv}{dx}\,dx = \Big[uv\Big]^b_a-\int\limits_a^b v\,\frac{du}{dx}\,dx
or
∫abu v′ dx=[uv]ab−∫abv u′ dx\int\limits_a^b u\,v'\,dx = \Big[uv\Big]^b_a-\int\limits_a^b v\,u'\,dx
with f(x)≡uf(x) \equiv u and g(x)≡vg(x) \equiv v.

Integration by parts: example 1

∫abx (x+1) dx=∫abx (x+1)1/2 dx\int\limits_a^b x\,\sqrt{(x+1)}\,dx=\int\limits_a^b x\,(x+1)^{1/2}\,dx
Choose
u=xandv′=(x+1)u=x\qquad\text{and}\qquad v'=\sqrt{(x+1)}
so that:
u′=1andv=23(x+1)3/2.u'=1\qquad\text{and}\qquad v=\frac{2}{3}(x+1)^{3/2}.
Then:
∫abx (x+1) dx=[x 23(x+1)3/2]ab−∫ab1×23(x+1)3/2 dx=[23 x (x+1)3/2]ab−[23⋅25(x+1)5/2]ab\begin{aligned} \int\limits_a^b x\,\sqrt{(x+1)}\,dx &=\Big[x\,\frac{2}{3}(x+1)^{3/2}\Big]_a^b - \int\limits_a^b 1 \times \frac{2}{3}(x+1)^{3/2}\,dx \\ &=\Big[\frac{2}{3}\,x\,(x+1)^{3/2}\Big]_a^b- \Big[\frac{2}{3}\cdot \frac{2}{5}(x+1)^{5/2}\Big]_a^b \end{aligned}
If we had chosen the other option for uu and v′v' we would have got:
[(x+1)1/2 x22]ab−∫ab12 1(x+1) x22 dx\Big[(x+1)^{1/2}\,\frac{x^2}{2}\Big]_a^b - \int\limits_a^b \frac{1}{2}\,\frac{1}{\sqrt{(x+1)}}\,\frac{x^2}{2}\,dx
The second term is worse than the integral we started with! It's important to choose uu and vv carefully. This comes with practice.

Integration by parts: example 2

Let us calculate the indefinite integral,
∫ln⁡x dx\int \ln x\,dx
We can do a bit of a trick. Let:
u=ln⁡x⟹u′=1xandv′=1⟹v=xu=\ln x \quad\Longrightarrow\quad u'=\frac{1}{x}\qquad\text{and}\qquad v'=1\quad\Longrightarrow\quad v=x
Putting these into our equation:
∫ln⁡x dx=ln⁡x⋅x−∫x 1x dx=xln⁡x−∫1 dx=xln⁡x−x+C\begin{aligned} \int \ln x\,dx &= \ln x \cdot x - \int x\,\frac{1}{x}\,dx \\ &= x \ln x - \int 1\, dx = x \ln x - x + C \end{aligned}
We can also check this calculation using SymPy:
import sympy as sp x = sp.symbols('x') sp.integrate(sp.log(x),x)
xlog⁡(x)−xx \log{\left(x \right)} - x
(SymPy writes log⁡\log for the natural logarithm, ln⁡\ln.)

Integration by parts: example 3

∫0∞x3 e−x dx\int\limits^{\infty}_0 x^3\,e^{-x}\,dx
Using the formula:
(∫u v′ dx=[u v]−∫v u′ dx)\Big(\int u\, v'\, dx = [u\, v]-\int v\, u'\, dx\Big)
Choose
u=x3andv′=e−xso thatu′=3x2andv=−e−xu=x^3\qquad\text{and}\qquad v'=e^{-x} \qquad\text{so that}\qquad u'=3x^2\qquad\text{and}\qquad v=-e^{-x}
Then:
∫0∞x3 e−x dx=−[x3 e−x]0∞+∫0∞3x2 e−x dx\int\limits^{\infty}_0 x^3\,e^{-x}\,dx=-\Big[x^3\,e^{-x}\Big]^{\infty}_0 +\int\limits^{\infty}_0 3x^2\,e^{-x}\,dx
Now apply integration by parts to the right-hand side:
Choose
u=3x2andv′=e−xso thatu′=6xandv=−e−xu=3x^2\qquad\text{and}\qquad v'=e^{-x} \qquad\text{so that}\qquad u'=6x\qquad\text{and}\qquad v=-e^{-x}
Then:
∫0∞3x2 e−x dx=−[3x2 e−x]0∞+∫0∞6x e−x dx\int\limits^{\infty}_0 3x^2\,e^{-x}\,dx=-\Big[3x^2\,e^{-x}\Big]^{\infty}_0 +\int\limits^{\infty}_0 6x\,e^{-x}\,dx
And, once more:
Choose
u=6xandv′=e−xso thatu′=6andv=−e−xu=6x\qquad\text{and}\qquad v'=e^{-x} \qquad\text{so that}\qquad u'=6\qquad\text{and}\qquad v=-e^{-x}
Then:
∫0∞6x e−x dx=−[6x e−x]0∞+∫0∞6 e−x dx⟹∫0∞6 e−x dx=−[6 e−x]0∞=0+6e0=6\begin{aligned} \int\limits^{\infty}_0 6x\,e^{-x}\,dx &=-\Big[6x\,e^{-x}\Big]^{\infty}_0 +\int\limits^{\infty}_0 6\,e^{-x}\,dx \\ \Longrightarrow \int\limits^{\infty}_0 6\,e^{-x}\,dx &= -\Big[6\,e^{-x}\Big]^{\infty}_0=0+6e^0=6 \end{aligned}
(Since e−x→0e^{-x}\to 0 as x→∞x\to\infty, and e0=1e^0=1)
The other terms are all zero, because x3e−xx^3e^{-x}, 3x2e−x3x^2e^{-x} and 6x e−x6x\,e^{-x} all tend to 00 as x→∞x\to\infty (e−xe^{-x} shrinks faster than any power of xx grows), and all are 00 at x=0x=0:
−[x3 e−x]0∞=0−0=0−[3x2 e−x]0∞=0−0=0−[6x e−x]0∞=0−0=0\begin{aligned} -\Big[x^3\,e^{-x}\Big]^{\infty}_0 &= 0 - 0 = 0 \\ -\Big[3x^2\,e^{-x}\Big]^{\infty}_0 &= 0 - 0 = 0 \\ -\Big[6x\,e^{-x}\Big]^{\infty}_0 &= 0 - 0 = 0 \end{aligned}
So, to answer our original question:
∫0∞x3 e−x dx=6\int\limits^{\infty}_0 x^3\,e^{-x}\,dx=6
Let's also check it with SymPy:
sp.integrate(x**3 * sp.exp(-x),(x,0,sp.oo))
66
This result actually generalises:
∫0∞xn e−x dx=n!for n=0,1,2,…\int\limits^{\infty}_0 x^n\,e^{-x}\,dx=n! \qquad \text{for } n = 0, 1, 2, \ldots
Here n!n! (read "nn factorial") is the product of the whole numbers from nn down to 1:
n!=n×(n−1)×⋯×2×1n! = n \times (n-1) \times \cdots \times 2 \times 1
For example, 3!=3×2×1=63! = 3 \times 2 \times 1 = 6, which is the answer we found above, and by convention 0!=10! = 1.

Integration by parts: example 4, trigonometry

Recall that:
ddx(sin⁡x)=cos⁡xddx(cos⁡x)=−sin⁡x\begin{aligned} \frac{d}{dx}(\sin x) &=\cos x \\ \frac{d}{dx}(\cos x) &=-\sin x \end{aligned}
Let's try and calculate the following integral:
∫abcos⁡x e−x dx=I\int\limits^b_a \cos x\,e^{-x}\,dx = I
Choose
u=cos⁡xandv′=e−xso thatu′=−sin⁡xandv=−e−x\begin{aligned} &u=\cos x\qquad\text{and}\qquad v'=e^{-x} \\ \text{so that}\qquad &u'=-\sin x\qquad\text{and}\qquad v=-e^{-x} \end{aligned}
Then:
I=[−cos⁡x e−x]ab−∫ab(−)sin⁡x (−)e−x dxI =\Big[-\cos x\, e^{-x}\Big]^b_a -\int\limits^b_a (-)\sin x\,(-)e^{-x}\,dx
Next, choose
u=sin⁡xandv′=e−xso thatu′=cos⁡xandv=−e−x\begin{aligned} &u=\sin x\qquad\text{and}\qquad v'=e^{-x} \\ \text{so that}\qquad &u'=\cos x\qquad\text{and}\qquad v=-e^{-x} \end{aligned}
Then:
I=[−cos⁡x e−x]ab−[sin⁡x (−)e−x]ab+∫abcos⁡x (−)e−x dxI =\Big[-\cos x\, e^{-x}\Big]^b_a - \Big[\sin x\,(-)e^{-x}\Big]^b_a + \int\limits^b_a \cos x\,(-)e^{-x}\,dx
The last term is the integral we started with:
⟹2∫abcos⁡x e−x dx=[sin⁡x e−x]ab−[cos⁡x e−x]ab\Longrightarrow \quad 2\int\limits^b_a \cos x\,e^{-x}\,dx = \Big[\sin x\, e^{-x}\Big]^b_a - \Big[\cos x\, e^{-x}\Big]^b_a

Integration method 3: partial fractions

If we want to calculate the integral below, none of the previous rules allow us to make much progress.
∫dx(2x+1)(x−5)\int \frac{dx}{(2x+1)(x-5)}
But, in this case, we can try splitting the denominator up into two fractions that we can deal with:
Let1(2x+1)(x−5)=A(2x+1)+B(x−5)\text{Let}\qquad \frac{1}{(2x+1)(x-5)}=\frac{A}{(2x+1)} + \frac{B}{(x-5)}
If we multiply both sides by (2x+1)(x−5)(2x+1)(x-5), we get:
A(x−5)+B(2x+1)=1soAx−5A+2Bx+B=1A(x-5)+B(2x+1)=1 \qquad\text{so}\qquad Ax-5A+2Bx+B=1
We can then equate coefficients of xx:
A+2B=0thusA=−2B(A)A+2B=0 \qquad\text{thus}\qquad A=-2B \qquad \text{(A)}
Equate the constant terms (coefficients of x0x^0):
−5A+B=1so from (A):10B+B=1,B=111,A=−211-5A+B=1 \qquad\text{so from (A):}\qquad 10B+B=1, \quad B=\frac{1}{11}, \quad A=-\frac{2}{11}
Thus:
∫dx(2x+1)(x−5)=−∫2 dx11(2x+1)+∫dx11(x−5)\int \frac{dx}{(2x+1)(x-5)}=-\int \frac{2\, dx}{11(2x+1)} + \int \frac{dx}{11(x-5)}
Now use method of substitution on the first fraction:
u=2x+1u=2x+1
so du/dx=2du/dx=2 and dx/du=1/2dx/du=1/2
And on the second fraction:
w=x−5w=x-5
so dw/dx=1dw/dx=1 and dx/dw=1dx/dw=1
−∫2 du2×11×u+∫dw11w=−ln⁡∣u∣11+ln⁡∣w∣11=−ln⁡∣2x+1∣11+ln⁡∣x−5∣11+C\begin{aligned} -\int \frac{2\, du}{2 \times 11 \times u} + \int \frac{dw}{11w} &= -\frac{\ln |u|}{11} + \frac{\ln |w|}{11} \\ &=-\frac{\ln |2x+1|}{11} + \frac{\ln |x-5|}{11} + C \end{aligned}
SymPy can also solve integrals requiring partial fractions:
sp.integrate(1/((2*x + 1)*(x - 5)),x)
log⁡(x−5)11−log⁡(x+12)11\frac{\log{\left(x - 5 \right)}}{11} - \frac{\log{\left(x + \frac{1}{2} \right)}}{11}
This answer seems different because of the arbitrary constant of integration.

Introductory problems

For more practice, an AI tool can write new problems like the ones below. Ask it for problems of the same type and difficulty, or for problems set in your own field. For example, you could ask it to "write five cell biology problems on integration by parts, at the level of these ones". Work them on paper first, then ask the tool to check your answers and to explain any step you are unsure of.

Introductory problems 1

By using suitable substitutions, evaluate the following integrals:
  1. ∫x2(x3+4)2 dx\int x^2(x^3+4)^2\,dx
  2. ∫e−x(5−4e−x) dx\int e^{-x}(5-4e^{-x})\,dx
  3. ∫(1+x)(4x2+8x+3) dx\int (1+x)\sqrt{(4x^2+8x+3)}\,dx
  4. ∫3xe(x2+1) dx\int 3x e^{(x^2+1)}\,dx

Introductory problems 2

Find the indefinite integrals, with respect to xx, of the following functions:
  1. x e3bxx\,e^{3bx}
  2. x3 e−3xx^3\,e^{-3x}
  3. xcos⁡(x)x \cos (x)
  4. ebxsin⁡(x)e^{bx} \sin(x)

Introductory problems 3

Sketch the curve y=(x−2)(x−5)y=(x-2)(x-5) and calculate by integration the area between the curve and the xx-axis, bounded by x=2x=2 and x=5x=5.

Introductory problems 4

Use partial fractions to find:
  1. ∫1(x+1)(x+3) dx\int \frac{1}{(x+1)(x+3)}\,dx
  2. ∫5x+1(x−1)(x+2) dx\int \frac{5x+1}{(x-1)(x+2)}\,dx
  3. ∫011(x+1)(x+2) dx\int_0^1 \frac{1}{(x+1)(x+2)}\,dx

Main problems

Main problems 1

Evaluate the following indefinite and definite integrals:
  1. ∫6/(7−x)3 dx\int 6/(7-x)^3\,dx
  2. ∫13x3(9−x4)5 dx\int 13x^3(9-x^4)^5\,dx
  3. ∫255ln⁡(x) dx\int_2^5 5\ln(x)\,dx
  4. ∫xx (1+ln⁡(x)) dx\int x^x\,(1 + \ln(x))\,dx
Hint for 4.: differentiate xx=exln⁡(x)x^x = e^{x\ln(x)}.

Main problems 2

Suppose the area A(t)A(t) (in cm2^2) of a healing wound changes at a rate
dAdt=−4t−3,\frac{dA}{dt} = -4t^{-3},
where tt, measured in days, lies between 1 and 10, and the area is 2 2\,cm2^2 after 1 day. What will the area of the wound be after 10 days?

Main problems 3

A rocket burns fuel, so its mass decreases over time.
If it burns fuel at a constant rate ρ kg/s\rho\,\text{kg/s}, and if the exhaust velocity relative to the rocket is a constant ve m/sv_e\,\text{m/s}, then there will be a constant force of magnitude ρve\rho v_e propelling it.
The rocket starts burning fuel at t=0 st=0\,\text{s} with total mass of m0 kgm_0\,\text{kg}, and runs out of fuel at a later time t=tf st=t_f\,\text{s}, with a final mass of mf kgm_f\,\text{kg}.
  1. Newton's second law tells us that the instantaneous acceleration aa of the rocket at time tt is equal to the force propelling it at that time, divided by its mass at that time. Write down an expression for aa as a function of tt.
  2. By integrating this expression, show that the rocket's total change in velocity is given by
    veln⁡(m0mf).v_e \ln\left(\frac{m_0}{m_f}\right).

Main problems 4

The flow of water pumped upwards through the xylem of a tree, FF, is given by:
F=M0(p+qt)3/4,F = M_0(p+qt)^{3/4},
where tt is the tree's age in days, pp and qq are positive constants, and M0p3/4M_0p^{3/4} is the flow when the tree is planted (i.e. at t=0t=0).
Determine the total volume of water pumped up the tree in its tenth year (ignoring leap years) if:
  • p=10p=10,
  • q=0.01 q=0.01\,day−1^{-1}, and
  • M0=0.92 M_0=0.92\,l \,day−1^{-1}.

Extension problems

Extension problems 1

Express
1x(x2−16)in the formAx+B(x+4)+C(x−4).\frac{1}{x(x^2-16)}\quad\text{in the form}\quad\frac{A}{x} + \frac{B}{(x+4)} + \frac{C}{(x-4)}.
Hence calculate
∫1x(x2−16) dx.\int\frac{1}{x(x^2-16)}\,dx.

Extension problems 2

The speeds of the molecules of mass mm in a gas at temperature TT follow the Maxwell-Boltzmann distribution, whose probability density is:
f(v)=4π(m2πkT)3/2v2e−mv2/2kTf(v) = 4 \pi \left(\frac{m}{2\pi k T} \right)^{3/2} v^2 e^{-mv^2/2kT}
where kk is Boltzmann's constant. Find the average speed:
v‾=∫0∞v f(v) dv.\overline {v} =\int_0^{\infty}v\,f(v)\,dv.

Extension problems 3

Baranov developed expressions for commercial yields of fish in terms of lengths, LL, of the fish. His formula gave the total number of fish of length LL as k e−cLk\,e^{-cL}, where cc and kk are constants (kk and cc are positive).
  1. Give a sketch of the graph f(L)=k e−cLf(L)=k\,e^{-cL}. (Something decreasing, concave upward and asymptotic to horizontal axis will do.) On your sketch, introduce marks on the horizontal axis that represent lengths L=1L=1, L=2L=2, L=3L=3, L=4L=4 and L=5L=5. Now draw a rectangle on your sketch that represents the number of fish whose lengths are between L=3L=3 and L=4L=4.
  2. Explain how we can represent the total number of fish NN as an area. Show that this number equals k/ck/c.
  3. Only fish longer than L0L_0 count as commercial. Hence, assuming that the fish are all similar in shape (i.e. their width and breadth scales with their length) and of equal density ρ\rho, show that the weight, WW, of the commercial fish population is
    W=∫L0+∞a kρ L3e−cL dL,W= \int_{L_0}^{+\infty} a\, k \rho\,L^3 e^{-cL}\,dL,
    and hence that
    W=N a ρ e−cL0c3((cL0)3+3(cL0)2+6cL0+6),W=\frac{N\, a\, \rho\, e^{-cL_0}}{c^3} \left((cL_0)^3 +3(cL_0)^2+ 6cL_0 +6\right),
    where aa is a constant.