How to add up quickly
Submitted by Marianne on March 14, 2013One of my favourite mathematical results is the famous formula
As far as I’m concerned, all of maths is here, and if this formula doesn’t blow you away then you simply have no soul. What the formula does is to connect two quite different concepts, the geometry linked to the number and the simplicity of the odd numbers. The result is truly magical and surprising, and exactly illustrates the extraordinary way that maths can link patterns together. Whenever I am asked to define mathematics I simply write down equation (1). Those of you who think that maths is just a language, think again.
How quickly do these series converge to a value involving π?
This formula has a splendid history. It was derived in the West in 1671 by James Gregory from the formula for arctan(x) and slightly later and independently by Gottfried Leibniz. However, the same formula (along with many other results involving infinite series) was discovered long before in the 1300s by the great Indian mathematician Madhava. Similar results of equal beauty are the convergent series given by
and
However, in one sense, these formulae are disappointing. If you want to actually calculate or then you probably would not reach for one of these formulae. The reason is that they converge very slowly. If you take formula (1), add up 100 terms and multiply by 4, you get 3.146567747182956, which whilst fairly close to is not a particularly accurate estimate given the effort involved in adding up 100 terms. If you wanted to calculate or to an accuracy of six decimal places, you would have to take on the order of terms of either series (1) or (2), and long before you have added up all of the terms in the series, the rounding errors associated with computer calculations will have accumulated to the point where the accuracy of the answer is severely degraded.
The world needs pi
So what, you (and many pure mathematicians) might say. Surely you don’t need to know the value of that accurately, after all the Bible was content to give it to just one significant figure. However, is not any number. It lies at the heart of any technology that involves rotation or waves, and that is much of mechanical and electrical engineering. If rotating parts in, say, a typical jet engine are not manufactured to high tolerance, then the parts simply won’t rotate. This typically involves measurements correct to one part in and, as these measurements involve , we require a value of to at least this order of accuracy to prevent errors. In medical imaging using CAT or MRI scanners, the scanning devices move on a ring which has to be manufactured to a tolerance of one part in , requiring an even more precise value of .
However, even this level of accuracy pales into insignificance when we look at modern electrical devices. In high frequency electronics, with frequencies in the order of 1GHz (typical for mobile phones or GPS applications), electrical engineers have to work with functions of the form where and is a number close to one. To get the accuracy in the function needed for GPS to work requires a precision in the value used for in the order of one part in .
So, to live in the modern world we really do need to know very accurately.
So, what can we do? One possibility is to take a vast number of terms of the series for etc. above, book lots of time on a very expensive computer, sit back and wait (and wait, and wait). Or we can try and accelerate their convergence. So that with only a small number of terms (say 10) we can get 10 significant figures for . The nice thing about this method is that the derivation of the formulae is very transparent (well within the reach of a first year undergraduate or even a good Alevel student). In principle this method can also be used to find the sum of other slowly convergent series.
Accelerating the convergence of a series
Let’s suppose that we have a series
and we define the sum by
We will assume that this series converges. This means there is a limiting sum so that
If we want to work out the value of then we can simply take the values and let get very large. However, just adding up a series loses quite a lot of the information contained within it, and is really a very crude thing to do. Maybe we can squeeze more information out of the series and use this information to accelerate the convergence of . This means that we add a correction term to so that it approaches much more rapidly. What is nice about this approach is that it is quite easy to work out the correction terms.
To illustrate this idea we will take series (2) for . Let’s define
As increases, also increases steadily towards the value of . In figure 1 we plot the values of which you can see are increasing towards the value of .
Figure 1: The sum S_{n} which monotonically increases to π^{2}/6.
Suppose that we next look at the difference . A plot of is given in figure 2(a) and we can see that this decreases to zero as increases. But how fast?
To estimate this we plot in figure 2(b) the values of . It is clear from these figures that while as , approaches a constant that looks suspiciously like one.Figure 2: (a) The error E_{n} tending to zero. (b) nE_{n} which tends to one.
From this, we might guess that so that to a first approximation
We can improve on this guess by assuming that there is a sequence of numbers such that as
If we can calculate the terms for then we can estimate from the value of by the expression
But what are the B_{r}?
It turns out that the B_{r} are a very wellknown set of numbers. There is a nice and systematic way to calculate their values (but if you want you can skip this calculation and go straight to the result).
If we take (6) and replace by then we get
so that
Also, from the definition of we know that
Combining these two expressions we get
We can now find the values of each of the terms recursively by expanding each of these expressions in powers of and considering to be very large. For example
and
More generally
where
These are the socalled Taylor series expansions for the above expressions.
Now, we can combine these expressions with the equation (9). This gives
To find the value of each of the terms we compare the expressions involving terms of the form for . For example, the coefficient of on the left of the above equation is 1 and on the right it is . Hence
If we next look at the terms in and we get (respectively)
Substituting the value of into the first equation gives and knowing this we can then find from the second equation. This gives
Jakob Bernoulli, 1654 – 1705.
These numbers are famous and are called the Bernoulli numbers. They come up everywhere, from number theory to mechanics and beyond. Jakob Bernoulli described them in the book Ars Conjectandi (published posthumously in 1713) in connection with sums of powers of integers and they were discovered almost simultaneously by a number of other mathematicians. Since then, they have played a starring role in mathematical history. For example they are very important in the understanding of both Fermat's last theorem and the Riemann zeta function, and the first computer program written by Ada Lovelace in 1842 was designed to compute them.
Doing a quick sum
Putting this all together, for any fixed values of and we can add up terms of the original series to find and then add up terms of the series
to get the correction. We can then estimate by
The error between this approximation and is approximately given by the next term in the series which is given by For example, if then
where the last term expresses the fact that the error we expect to see is proportional to . For terms this would mean an error of which is a huge improvement over the error of about that we would get from naively adding up the series.
So, what’s the catch with doing this? Well the problem with this approach is that as the Bernouili numbers increase rapidly as increases, then ultimately the correction term gets rather large. In fact if is fixed then the individual terms in tend to infinity as . For an optimal error for a given value of it generally works best to truncate the series for the correction and to take , estimating by . This gives an error proportional to
We can easily play the same game with the other series mentioned in this article. See this appendix for details.
How well does this work?
Very! To show this we will look at a table of values of for and , and then the three corrections given by





1 
1 
2 
1.666666666666667 
1.623809523809524 
5 
1.463611111111111 
1.663611111111111 
1.644944444444445 
1.644934065473016 
10 
1.549767731166541 
1.649767731166541 
1.644934397833208 
1.644934066847493 
We can see that the approximation is a very good approximation indeed for with an error of only . This is especially impressive when we see that is a very poor approximation to . Note that we have only had to add in an extra terms to do this. To gain the same level of accuracy with we would have to have included another terms! Readers are invited to work out and to further test the impressive accuracy of this method.
Is this new?
Not at all. The basic idea of accelerating the convergence of a series certainly goes back to the extraordinary mathematician Leonhard Euler, if not earlier. Faced with an alternating series, such as the first one (1) that we looked at to calculate in which the terms alternate in sign, Euler devised a transformation, which instead of summing the series, summed the various divided differences of the series. This method does not work for series with all positive terms such as the series (2) to calculate . However, Euler needed to find the sum of this series as at the time (1735) its sum was unknown. The question of finding it (and finding a proof) was posed in 1644, and many distinguished mathematicians had tried, and failed, to find the sum. Euler’s idea was to compare the sum of terms of the form with the integral of the function . As was well known at the time
and the sum of the terms is an approximation to this integral. If you can find the error in this approximation then you can sum the series by comparing it to the known integral. In a (typical) tourdeforce, Euler was able to calculate this error deriving the (now famous) EulerMaclaurin (divergent) series for the error. If you take terms of the original series for the sum and terms of the EulerMaclaurin series then you get exactly our formula (13). It is pleasing (for a numerical analyst like me) to recount that Euler used his formula to calculate the sum of the series (2) correct to 20 decimal places (without of course the benefit of any form of caculator). From this calculation he was then able to guess that the sum of the series was . Knowing the answer he was then able to find a proof.
The problem was renamed the Basel problem in honour of the home town of both Euler and the Bernoullis, and Euler's reputation (at the age of only 28) was made for life.
By his method of attack, Euler anticipated a lot of modern mathematics, in which the computer is used as an experimental tool, to gain insight into the solution of a mathematical problem as a first stage in proving the result. Nowadays we use this method all the time, and it continues to rely making highly accurate calculations. But what is nice about the techniques I have described in this article is that we can see that by doing only a little extra mathematics we can do much better than even the most powerful computers.
About the author
Chris Budd is Professor of Applied Mathematics at the University of Bath, Vice President of the Institute of Mathematics and its Applications, Chair of Mathematics for the Royal Institution and an honorary fellow of the British Science Association. He is particularly interested in applying mathematics to the real world and promoting the public understanding of mathematics.
He has cowritten the popular mathematics book Mathematics Galore!, published by Oxford University Press, with C. Sangwin.