Integration: It’s more than the sum of its parts

Defining what exactly an integral is leads naturally to an explanation of how to handle approximating them.

post

Trapezium rule. Image created using WolframAlpha

When you’re taught integration in school, it can look weird and random. What’s that curly line? Why do you have to write “dee ecks” after the function like it’s a magic spell? You’re taught that it finds the area under a curve, and that it’s the opposite of differentiation. But what’s often lost in-between learning tricks like integration by parts is a sense of what integration is and what it means. It turns out that explaining this leads naturally to an explanation of a huge area of integration overlooked in school but vital to science and engineering: numerical integration.

One definition of the integral is that it’s the area under a curve for a given function. But how is this area determined? The original idea behind integration, which Isaac Newton and Gottfried Leibnitz came up with in the 1600s, and Bernhard Riemann later improved in the 1800s, is that you split the area under the curve into chunks you know the areas of, then add those areas up. This is how you’d estimate the area, but the clever ideas the founders of calculus came up with let you turn those estimates into exact values.

The Riemann Sum is one way to define integration, and to construct the sum you do the following:

Take the curve between two points $x=a$ and $x=b$, then draw $n$ evenly spaced vertical lines from the curve to the x-axis between $a$ and $b$. Then draw horizontal lines between the vertical lines to turn the $n$ lines into $n-1$ rectangles. You can work out the width of each rectangle, $\Delta x = \frac{b-a}{n-1}$ (the range of the integration divided by the number of chunks it’s being split into). You can also work out the height of each rectangle: it’s the value of the function at one of the corners: $f(x_i)$.

The ‘rectangle rule’. Image credit: Wikimedia

So the area of the rectangle at point $x_i$ is $f(x_i)\Delta x$, so to get the total area under the curve you just add up the areas of the rectangles. In summation notation:

 

$$Area = \sum_{i=1}^{n}f(x_i)\Delta x.$$

But this doesn’t tell the full story – the rectangles don’t capture all the area under the curve in the figure above. For other setups you could imagine the rectangles capturing too much area. How can this be a definition of the integral if it doesn’t give the right answer?

The solution? The more rectangles you use, the closer you get to the exact answer. So just use infinitely many rectangles! Of course, to do this, each one will need to be infinitely thin: $\Delta x$ needs to become zero, and you need to evaluate the function at every point along the curve between $a$ and $b$ (all infinity of them). This is impossible with a normal sum, so the clever ideas behind Riemann’s sum (going off ideas invented by Newton) involve mathematical tricks to make sense of a sum over infinitely many infinitely thin rectangles.

In this sum, the $\Delta x$ is replaced with $dx$, which represents an infinitely thin slice, and the sum symbol $\sum$ is replaced with an integral symbol $\int$. The integration symbol was invented to look like an elongated letter s – to show that it’s just a different type of sum. That’s also why you need to write $dx$  in all integrals – you need to multiply the function by the infinitely thin slice. When you do all of this, your inexact approximation becomes the exact area. The everyday rules for integrating functions like $x^2$ can be derived from this definition.

Integration is hard. That means it’s often not possible to work out the exact integral of a function. When that’s the case, mathematicians and scientists need to approximate the integral. This is called numerical integration. It’s used by everyone from weather forecasters, to quantum physicists, to stock market traders, to nuclear fusion researchers. They all use it to find solutions to equations which are impossible to solve exactly.

The Riemann sum gives an easy-to-use formula to do this approximation (it’s often called the ‘rectangle rule’). One problem with it, however, is that it’s inefficient. You need lots of rectangles to get a good approximation. (The figure above demonstrates how much space is ‘wasted’ with each rectangle.) So, over the years people invented more efficient techniques to approximate integrals. The trapezium rule (or trapezoidal rule for all you Yanks reading this) is the next stage up for accuracy.

The basic idea behind the trapezium rule is you add right-angled triangles on top of all the rectangles, like so:

The trapezium rule. Image credit Wikimedia

Now, instead of adding the areas of loads of rectangles, you add loads of trapeziums (a rectangle with a triangle on top). Again, the more trapeziums you add, the more accurate your sum is, but the difference is that you need fewer trapeziums to get an accurate answer. Comparing the two figures above: the same number of trapeziums fits the curve much better than the rectangles do. This is important because we want to work out the area as accurately as possible using as few computations as possible, so any method that gives you better accuracy for the same ‘price’ is preferable.

There’s a whole universe of weird and wild numerical integration techniques out there. The trapezium rule draws straight lines between points on the function. It might be better in some cases to draw curves between points: the simplest version of this is called Simpson’s rule. More complicated versions (using higher orders of a Taylor expansion) are called Newton-Coates formulas, or Gaussian quadratures, or countless others. Some approximate areas by picking points at random and using statistics. Some use points which aren’t uniformly spaced between the end points. Some are better at integrating in higher dimensions.

Implementing the right method for the function you’re integrating is as much a craft as it is a science. An expert in numerical integration is like a blacksmith forging a weapon: a keen eye is needed to know the right tools for each job, and a lifetime of experience is needed to get numerical integration working just right.

 

This post is part of a series for the UCL Year 12 Maths Research Summer Programme where year 12 students investigate an area of maths under the guidance of a Chalkdust member and PhD student at UCL.The closing event will celebrate the work of the year 12 students and will feature a talk from Prof. Lucie Green, a space scientist and TV & radio presenter. The closing event is on Thursday 12th July and is open to the public. If you would like more information about the programme or to attend the closing event please contact  Dr Luciano Rila l.rila@ucl.ac.uk .

Tom is a PhD student in the UCL Physics Department, simulating atomic collisions. He likes to think that what he does ‘technically counts as maths.’
Facebook Twitter  @TomRivlin   Website  tomrivlin.com    + More articles by Tom

You might also like…