Skip to main content
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 1


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 integration?

We often know the rate at which something happens (e.g. how quickly a product is made), and want to know the total amount over some time. Integration lets us work this out.
It is also how we find the area under a curve, and, as we will see, it reverses differentiation.

Integration

Calculating the area under a curve:
If we want to find the area under a curve, we can divide the area into strips, calculate the area of each strip, and sum these areas together.
e.g. find the area of
y=f(x)=x2betweenx=1 and x=2y = f(x) = x^2\qquad\text{between}\qquad x=1\text{ and }x=2
Individual rectangle under a curve
The area of the strip is δAi≈y(xi) δx\delta A_i \approx y(x_i)\,\delta x
We can sum up all the strips between x=1x=1 and x=2x=2 to give an estimate for the total area:
A≈∑δAi=∑y(xi) δx.A \approx \sum \delta A_i = \sum y(x_i)\,\delta x.
This becomes more accurate as δx\delta x becomes smaller. We can use the same trick as when differentiating: let δx\delta x tend to 00:
A=lim⁡δx→0∑y(xi) δx=∫12y dxA = \lim_{\delta x \to 0}\sum y(x_i)\,\delta x= \int\limits^{2}_{1} y\,dx
If we use a coarse approximation, then we are over-counting the area under the curve by quite a lot:
Coarse approximation to the integral
But, as the size of each rectangle reduces, we converge to the true area under the curve:
Fine approximation to the integral
∫\int is an elongated S, for the Latin summa (sum).
This process is called integration.

Calculating the integral

Let us 'invent' a function F(x)F(x) that gives the area from some fixed point to xx. Then A=F(2)−F(1)A = F(2) - F(1).
With this (imagined) function, we can find the area of one of our tiny steps exactly, as
F(x+δx)−F(x)F(x + \delta x) - F(x)
Remember we approximated this as y δx=f(x) δxy\,\delta x = f(x)\,\delta x, so:
F(x+δx)−F(x)≈f(x)δxf(x)≈F(x+δx)−F(x)δx\begin{aligned} F(x + \delta x) - F(x) &\approx f(x)\delta x \\ f(x) &\approx \frac{F(x+\delta x)-F(x)}{\delta x} \end{aligned}
The error in this approximation tends to 00 as δx→0\delta x\to 0, so
f(x)=lim⁡δx→0F(x+δx)−F(x)δx=F′(x)f(x) = \lim_{\delta x\to 0} \frac{F(x+\delta x)-F(x)}{\delta x} = F'(x)
(recalling the definition of the derivative).
In other words, for our example,
A(x)=∫1xy(t) dttheny(x)=A′(x)A(x) = \int\limits^{x}_{1} y(t)\,dt\qquad\text{then}\qquad y(x) = A'(x)
Integration reverses the process of differentiation.

Calculating integrals

We know that:
d(x2)dx=2x⇒[x2]x1x2=∫x1x22x dx\frac{d \left(x^2\right)}{dx}= 2 x \qquad\Rightarrow\qquad \Big[x^2\Big]_{x_1}^{x_2} = \int_{x_1}^{x_2} 2 x\,dx
Likewise:
d(x33)dx=x2⇒∫x=1x=2x2 dx=[13x3]x=1x=2=83−13=73\frac{d\left(\frac{x^3}{3}\right)}{dx}= x^2 \qquad\Rightarrow\qquad \int_{x=1}^{x=2} x^2\,dx = \Big[\frac{1}{3}x^3\Big]_{x=1}^{x=2}=\frac{8}{3}-\frac{1}{3}= \frac{7}{3}
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\left(a\, x^{n+1}\right)}{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}

SymPy examples

∫x1x2x6 dx=\int_{x_1}^{x_2} x^6\,dx =
import sympy as sp x, x1, x2 = sp.symbols('x x_1 x_2') sp.integrate(x**6,(x,x1,x2))
−x177+x277- \frac{x_{1}^{7}}{7} + \frac{x_{2}^{7}}{7}
∫x1x2x32 dx=\int_{x_1}^{x_2} x^{\frac{3}{2}}\,dx =
sp.integrate(x**(sp.sympify(3)/2),(x,x1,x2))
−2x1525+2x2525- \frac{2 x_{1}^{\frac{5}{2}}}{5} + \frac{2 x_{2}^{\frac{5}{2}}}{5}
∫x1x2x−12 dx=\int_{x_1}^{x_2} x^{-\frac{1}{2}}\,dx =
sp.integrate(x**(-sp.sympify(1)/2),(x,x1,x2))
−2x1+2x2- 2 \sqrt{x_{1}} + 2 \sqrt{x_{2}}

Indefinite integrals

Consider now the functions:
y=x2+7(1)y=x2−100(2)\begin{aligned} y&=x^2+7 &&\text{(1)} \\ y&=x^2-100 &&\text{(2)} \end{aligned}
Differentiating (1):
dydx=2x\frac{dy}{dx}=2x
Differentiating (2):
dydx=2x\frac{dy}{dx}=2x
This implies that the integral:
y=∫2x dx=x2+Cwhere C is an unknown constanty=\int 2x\,dx=x^2 + C \qquad \text{where } C \text{ is an unknown constant}
An integral without limits is called an indefinite integral.

Indefinite integrals in SymPy

x = sp.symbols('x') sp.integrate(2*x,x)
x2x^{2}

Other integrals

Recall that ddxln⁡x=1x\frac{d}{dx}\ln x = \frac{1}{x}. In fact, for any x≠0x \neq 0:
ddxln⁡∣x∣=1x⇒∫1x dx=ln⁡∣x∣+C\frac{d}{dx}\ln|x|=\frac{1}{x} \qquad\Rightarrow\qquad \int\frac{1}{x}\,dx=\ln |x| + C
We need the modulus because ln⁡\ln is only defined for positive numbers, but 1/x1/x is defined for negative xx too. For x>0x>0, ∣x∣=x|x| = x, so this is just the derivative of ln⁡x\ln x that we already know. For x<0x<0, ∣x∣=−x|x| = -x, and the chain rule gives
ddxln⁡(−x)=1−x×(−1)=1x.\frac{d}{dx}\ln(-x) = \frac{1}{-x}\times(-1) = \frac{1}{x}.
So ln⁡∣x∣\ln|x| has derivative 1/x1/x on both sides of zero.
This constant CC can be written as:
C=ln⁡BC=\ln B
where BB is another constant. Thus:
∫1x dx=ln⁡∣x∣+C=ln⁡∣x∣+ln⁡B=ln⁡(B∣x∣)\int \frac{1}{x}\,dx = \ln |x| + C=\ln |x| +\ln B =\ln (B |x|)

Integrating trigonometric functions

Recall that:
ddx(sin⁡x)=cos⁡xandddx(cos⁡x)=−sin⁡x\frac{d}{dx}\Big(\sin x\Big)= \cos x \qquad\text{and}\qquad \frac{d}{dx}\Big(\cos x\Big)= -\sin x
Example 1:
∫0π/2cos⁡x dx=[sin⁡x]0π/2=1−0=1\int_{0}^{\pi/2} \cos x \, dx = \Big[\sin x \Big]_0^{\pi/2}=1-0=1
Example 2:
∫0π/2sin⁡x dx=[−cos⁡x]0π/2=0−(−1)=1\int_{0}^{\pi/2} \sin x \, dx = \Big[-\cos x \Big]_0^{\pi/2}=0-(-1)=1

Summary of integration formulae

∫a dx=ax+C∫ax dx=12ax2+C∫axn dx=1n+1axn+1+Cfor all n except n=−1∫x−1 dx=∫1x dx=ln⁡∣x∣+C\begin{aligned} \int a\,dx &= ax+C \\ \int ax\,dx &= \frac{1}{2}ax^2+C \\ \int ax^n\,dx &= \frac{1}{n+1}ax^{n+1}+C \qquad\text{for all } n \text{ except } n=-1 \\ \int x^{-1}\,dx &= \int \frac{1}{x}\,dx = \ln \vert x\vert +C \end{aligned}

Application

Recall that f′(t)f'(t) gives the rate at which f(t)f(t) changes at time tt.
Integrating the derivative f′(t)f'(t), we see:
∫abf′(t) dt=[f(t)]ab=f(b)−f(a)\int_a^b f'(t) \, dt = \Big[f(t)\Big]_a^b = f(b)-f(a)
Therefore, the definite integral from aa to bb of f′(t)f'(t) with respect to tt will always give the net change that f(t)f(t) has undergone as the parameter tt moves from aa to bb.

Example

A chemical process produces NaCl at the rate of 3t3\sqrt{t} grams per minute. We ask three questions:
  1. What is the rate of production one minute into the process?
  2. What is the quantity of NaCl produced over the next three minutes?
  3. What is the mean rate of NaCl production over this interval?

Solution

Let f(t)f(t) denote the grams of NaCl produced after tt minutes. Then f′(t)=3tf'(t)= 3\sqrt{t}.
  1. The rate of production one minute into the process is f′(1)=31=3f'(1) = 3\sqrt{1} = 3 grams per minute.
  2. The quantity of NaCl produced over the next three minutes is:
    f(4)−f(1)=∫14 f′(t) dt=∫14 3t dt=[2t3/2]14=2×(8−1)=14f(4)-f(1) = \int_1^4\,f'(t)\,dt = \int_1^4\,3\sqrt{t}\,dt = \left[2t^{3/2}\right]_1^4 = 2\times(8-1) = 14
    t = sp.Symbol('t') sp.integrate(3*sp.sqrt(t),(t,1,4))
    1414
  3. The mean rate is the constant rate which would give the same overall effect:
    1b−a∫ab f′(t) dt=14−1∫14 3t dt=143\frac{1}{b-a}\int_a^b\,f'(t)\,dt = \frac{1}{4-1}\int_1^4\,3\sqrt{t}\,dt = \frac{14}{3}
    sp.integrate(3*sp.sqrt(t),(t,1,4))/(4-1)
    143\frac{14}{3}

Substitution method

Suppose we wish to integrate:
I=∫f(g(x)) dxe.g.∫ab(3−4x)−5 dxI=\int f(g(x))\,dx \qquad \text{e.g.} \quad \int_{a}^{b} (3-4x)^{-5}\,dx
In general, for g(x)=ug(x)=u, we can write:
∫x1x2f(g(x)) dx=∫u1u2f(u)dxdu du\int_{x_1}^{x_2} f(g(x))\,dx = \int_{u_1}^{u_2} f(u) \frac{dx}{du}\, du
This can be thought of as being like the integral version of the chain rule.

Examples

Consider:
∫ab(2x+3)4 dx(3)\int_{a}^{b} (2x + 3)^4\,dx \qquad \text{(3)}
Multiplying this out and then integrating it would be very tedious. Try a substitution instead:
u=2x+3⟺x=12(u−3)=u2−32⟺dxdu=12u=2x+3 \quad\Longleftrightarrow\quad x=\frac{1}{2}(u-3)=\frac{u}{2}-\frac{3}{2} \quad\Longleftrightarrow\quad \frac{dx}{du}=\frac{1}{2}
Substitute into equation (3) above:
∫u(a)u(b)u4×12 du=12∫u(a)u(b)u4 du=12[15u5]u(a)u(b)=12[15(2x+3)5]ab\begin{aligned} \int_{u(a)}^{u(b)} u^4 \times \frac{1}{2}\,du &= \frac{1}{2}\int_{u(a)}^{u(b)} u^4\,du \\ &= \frac{1}{2}\Big[\frac{1}{5}u^5\Big]_{u(a)}^{u(b)} = \frac{1}{2}\Big[\frac{1}{5}(2x+3)^5\Big]_a^b \end{aligned}
a, b = sp.symbols('a b') sp.integrate((2*x + 3)**4,(x,a,b))
−16a55−24a4−72a3−108a2−81a+16b55+24b4+72b3+108b2+81b\begin{aligned} &- \frac{16 a^{5}}{5} - 24 a^{4} - 72 a^{3} - 108 a^{2} - 81 a \\ &+ \frac{16 b^{5}}{5} + 24 b^{4} + 72 b^{3} + 108 b^{2} + 81 b \end{aligned}
Let's look at another example:
∫ab(3−4x)−5 dx(4)\int_{a}^{b} (3-4x)^{-5}\,dx \qquad \text{(4)}
Let:
u=3−4x⟺x=14(3−u)=34−u4⟺dxdu=−14u=3-4x \quad\Longleftrightarrow\quad x=\frac{1}{4}(3-u)=\frac{3}{4}-\frac{u}{4} \quad\Longleftrightarrow\quad \frac{dx}{du}=-\frac{1}{4}
Substitute into equation (4) above:
∫u(a)u(b)u−5×−14 du=−14∫u(a)u(b)u−5 du=−14[1−4u−4]u(a)u(b)=116[(3−4x)−4]ab\begin{aligned} \int_{u(a)}^{u(b)} u^{-5} \times \frac{-1}{4}\,du = -\frac{1}{4}\int_{u(a)}^{u(b)} u^{-5}\,du &= -\frac{1}{4}\Big[\frac{1}{-4}u^{-4}\Big]_{u(a)}^{u(b)} \\ &= \frac{1}{16}\Big[(3-4x)^{-4}\Big]_a^b \end{aligned}
sp.integrate((3 - 4*x)**(-5),(x,a,b))
14096b4−12288b3+13824b2−6912b+1296−14096a4−12288a3+13824a2−6912a+1296\frac{1}{4096 b^{4} - 12288 b^{3} + 13824 b^{2} - 6912 b + 1296} - \frac{1}{4096 a^{4} - 12288 a^{3} + 13824 a^{2} - 6912 a + 1296}

Introductory problems

Tip

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 climate science problems on definite integrals, 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

Integrate the following functions with respect to xx. Remember that you can check your own answers by differentiating your results:
  1. x3−1/x4+x2x^3-1/x^4+x^2
  2. x3+1/(3x4)\sqrt[3]{x}+1/(3\sqrt[4]{x})
  3. 1/x2+1/x3−71/x^2 + 1/\sqrt[3]{x} - 7

Introductory problems 2

Evaluate the following definite integrals:
  1. ∫12x1/2 dx\int_1^2 x^{1/2}\,dx
  2. ∫23x−2/3 dx\int_2^3 x^{-2/3}\,dx
  3. ∫0ln⁡(2)e3x dx\int_0^{\ln(2)}e^{3x}\,dx
  4. ∫02(x+1)1/5 dx\int_0^2(x+1)^{1/5}\,dx

Introductory problems 3

Find the integrals below by making the substitution suggested:
  1. ∫x2(2x3−5)3 dxusingu=2x3−5\int x^2(2x^3-5)^3\,dx \qquad\text{using}\qquad u = 2x^3-5
  2. ∫x7−2x2 dxusingu=7−2x2\int x\sqrt{7-2x^2}\,dx \qquad\text{using}\qquad u = 7-2x^2
  3. ∫01ex(3ex−10)4 dxusingu=3ex−10\int_0^1 e^x(3e^x-10)^4\,dx \qquad\text{using}\qquad u = 3e^x-10
  4. ∫x315−3x4 dxusingu=15−3x4\int x^3\sqrt{15-3x^4}\,dx \qquad\text{using}\qquad u = 15-3x^4
  5. ∫04x3 4+x5/2 dxusingu=4+x5/2\int_0^4 \sqrt{x^3}\,\sqrt{4+x^{5/2}}\,dx \qquad\text{using}\qquad u = 4+x^{5/2}
  6. ∫01xn−1(1−xn)2 dxusingu=1−xn\int_0^1 x^{n-1}(1-x^{n})^2\,dx \qquad\text{using}\qquad u = 1-x^{n}

Introductory problems 4

By making suitable substitutions, find the indefinite integrals of:
  1. 2(6x−5)32(6x-5)^3
  2. 7x/(x2−2)7x/(x^2-2)
  3. 3/5−x3/\sqrt{5-x}
  4. 1/(x−a)1/(x-a)

Introductory problems 5

Consider the area under y=1/xy = 1/x between x=1x = 1 and x=3x = 3.
  1. Estimate the area by dividing it into 4 strips of width 0.50.5, taking the height of each strip as the value of yy at its right-hand end.
  2. Is your estimate too big or too small? Why?
  3. Calculate the area exactly by integration, and compare.
  4. Use Python to repeat the estimate with 100 strips.

Main problems

Main problems 1

Electrostatic work: the force acting between two electric charges q1q_1 and q2q_2 separated by distance xx in a vacuum is given by Coulomb's inverse square law:
F(x)=q1q24πϵ0x2F(x) = \frac{q_1 q_2}{4\pi \epsilon_0 x^2}
where ϵ0\epsilon_0 is the permittivity of a vacuum.
Like charges (charges with the same sign, such as 2 nuclei or 2 electrons) repel so that the force acting on q2q_2 due to the presence of q1q_1 acts in a positive xx direction, away from q1q_1. Unlike charges (of opposite signs such as the proton and electron in the hydrogen atom) attract, and the force on q2q_2 is directed towards q1q_1 (i.e. F is negative).
Consider 2 like charges, initially infinitely far apart. Because the charges repel, work must be done on the system to bring q2q_2 from infinity to the distance xx from q1q_1. The force FF must be applied to overcome the repulsion.
  1. Explain why the total work done is given by
    W=−∫∞xF(x′) dx′=−q1q24πϵ0∫∞xdx′x′2.W=-\int_\infty^x F(x')\,dx' = -\frac{q_1 q_2}{4\pi \epsilon_0} \int_\infty^x \frac{dx'}{{x'}^2}.
  2. Calculate the work, WW, in Joules when
    • x=5.3×10−11 mx =5.3 \times 10^{-11}\,\text{m},
    • q1=q2=1.6×10−19 Cq_1=q_2=1.6 \times 10^{-19}\,\text{C},
    • ϵ0=8.85×10−12 Fm−1\epsilon_0=8.85 \times 10^{-12}\,\text{Fm}^{-1}.

Main problems 2

The rate at which the world's oil is being consumed is continuously increasing. Suppose the rate (in billions of barrels per year) is given by the function r=f(t)r=f(t), where tt is measured in years and t=0t=0 is the start of 1990.
  1. Write down a definite integral which represents the total quantity of oil used between the start of 1990 and the end of 2020.
  2. Calculate this integral using the function r(t)=24e0.015tr(t)=24 e^{0.015t}.

Main problems 3

Since 1850, global carbon dioxide (CO2_2) emissions have been rising exponentially. Let C(t)C(t) represent the rate that CO2_2 is emitted into the atmosphere, measured in Gigatonnes per year, where tt measures the number of years since the start of 1850. A model for the rate of emission over time is given by
C(t)=kept,C(t) = ke^{pt},
where kk and pp are positive constants.
  1. What are the units of kk and pp?
  2. Given that, at the start of 1850, the global emission rate was 0.2 Gigatonnes per year, and that at the start of 2010 the global emission rate was 32 Gigatonnes per year, calculate kk and pp.
  3. Calculate the total quantity of CO2_2 emitted between the start of 1850 and the start of 2010.

Main problems 4

The velocity vv of blood in a cylindrical vessel of radius RR and length ll is given by
v(r)=P(R2−r2)4ηlv(r) = \frac{P(R^2 - r^2)}{4\eta l}
where η\eta and PP are constants, and rr is the radial distance from the cylinder's axis.
Find the average velocity of blood along the radius of the cylinder (i.e. for 0≤r≤R0\leq r\leq R), and compare this with the maximum velocity.

Main problems 5

Consider the function y=4x3+2x2−8x+2y = 4x^3 +2x^2-8x + 2.
  1. Draw an accurate graph of this function for values of xx between −4-4 and 44.
  2. Calculate the turning points of the curve and mark these on the graph.
  3. On your graph, shade in the region under the curve between x=−2x=-2 and x=2x=2 and estimate its area.
  4. Integrate the function between x=−2x=-2 and x=2x=2. Is this an accurate calculation of the area of the shaded region in part 3.?
  5. Identify and explain any differences you find between your estimate in part 3. and your calculation in part 4.

Extension problems

Extension problems 1

Evaluate the following definite integrals:
  1. ∫−π/2π/23cos⁡(x) dx\int_{-\pi/2}^{\pi/2} 3\cos (x)\,dx
  2. ∫π/2πcos⁡(x) sin⁡(x) dx\int_{\pi/2}^{\pi}\cos (x)\,\sin(x)\,dx
  3. ∫0π(cos⁡2(x)+sin⁡2(x)) dx\int_0^\pi(\cos^2(x)+\sin^2(x))\,dx

Extension problems 2

Let uu and vv be functions of xx.
  1. Given that
    ddx(uv)=udvdx+vdudx,\frac{d}{dx}(uv) = u\frac{dv}{dx} + v\frac{du}{dx},
    show that
    ∫v dudx dx=uv−∫u dvdx dx.\int v\,\frac{du}{dx}\,dx = uv-\int u\,\frac{dv}{dx}\,dx.
  2. By using this 'integration by parts' formula, and substituting z=x2z=x^2 or otherwise, show that
    ∫0∞xn e−x2 dx=12(n−1)∫0∞xn−2e−x2 dxfor n>1.\int_0^{\infty} x^n\,e^{-x^2}\,dx=\frac{1}{2}(n-1)\int_0^{\infty} x^{n-2}e^{-x^2}\,dx\qquad \text{for } n>1.
  3. Hence evaluate
    ∫0∞x5 e−x2 dx.\int_0^{\infty} x^5\,e^{-x^2}\,dx.

Extension problems 3

A country wishes to achieve net-zero CO2\text{CO}_2 emissions in 50 years. Let tt be the time in years since the start of its programme, and let E(t)E(t) be the rate at which the country emits CO2\text{CO}_2, in Mt CO2 year−1\text{Mt CO}_2\,\text{year}^{-1}. At the start, E=800E = 800. The country plans to reduce this rate steadily, so that each year its rate of emission is 12 Mt CO2 year−1\text{Mt CO}_2\,\text{year}^{-1} lower than the year before.
1. Write down dE/dtdE/dt, and hence find E(t)E(t). Use this to calculate the total CO2\text{CO}_2 that the country emits over the 50 years.
After 10 years, the country starts a CO2\text{CO}_2 removal programme, which captures CO2\text{CO}_2 from the atmosphere and stores it underground. The rate of removal R(t)R(t), in Mt CO2 year−1\text{Mt CO}_2\,\text{year}^{-1}, is
R(t)=0.1t2−tfort≥10R(t) = 0.1t^{2} - t \qquad\text{for}\qquad t \geq 10
(where tt is still the time since the start of the programme).
2. Find the time at which the rate of removal equals the rate of emission. Does the country reach net-zero emissions within 50 years?
After 50 years, the country's rate of emission stays at its value at t=50t=50, while the rate of removal carries on following R(t)R(t). The country wants the total CO2\text{CO}_2 it has emitted since the start of the programme to be balanced by the total it has removed, so that overall it has added no CO2\text{CO}_2 to the atmosphere.
3. Show that this happens about 108.5 years after the start of the programme.