# Finding Pi to more decimal places

Hits: 118

##### Introduction

, or the circle constant, is a number that is irrational. Irrational numbers consist of infinitely many decimal places which never repeat. This assures that you can never convert it into an exact fraction. But is worse than that. It is also a transcendental number, meaning that it will never be the solution of a polynomial with integer coefficients and a finite number of terms. By the year 1400, the greatest advances in the accuracy of was made by the Chinese, who were able to work it out to 6 decimal places.

##### Circles.

You can come up with a lower and upper bound for if you consider a circle of radius , and take the area of an inscribed polygon of sides whose corners touch the circles’ edge; and then the area of a circumscribed polygon, with the same number of sides, whose sides touch the circle’s edge. This was the tactic used by the Greek philosopher Archimedes about 2400 years ago, around 350 BC. Archimedes observed that the circle constant can be had by dividing the circle’s area by the radius squared . But to get a circle area of any accuracy you had to have an accurate value for . Since he could find the areas of polygons with much greater accuracy, Archimedes decided to circumscribe a polygon of n sides, whose sides touched the circle’s edge. But these areas were always too big. So, he also tried to find the area of the inscribed polygon of the same n sides. Of course, these areas were smaller than the circle’s area. He knew that lay between these areas, or rather that: , where represents the area of the inscribed polygon and represents the area of the circumscribed polygon. Another way of expressing this inequality may be more familiar to some: . In fact, for a unit circle, this gets really simple: , since for a unit circle.

So, to increase the accuracy of , all Archimedes had to do was increase the number of sides of the two polygons. You would achieve full accuracy for if the number of sides goes to infinity, where you would then have: . For over 2000 years, this was the holy grail for achieving to perfect accuracy. Using this tedious method, Archimedes calculated polygon areas of up to 96 sides, so he was able to say , or to at least estimate that was about equal to 3.14 (decimals were also not known to the Greeks, so 3.14 is a modern estimate). Remeber that this was before computers or even before the discovery of irrational numbers. Square roots were known in his day, so his own calculations would involve fractions and nested square roots, which didn’t necesarily have integer or rational solutions, so an expression like was left as it was. What was clear from his calculations, was that it was not possible to express as a rational number, or an exact ratio of whole numbers. The good news is, the estimation of 3.14 is good enough for quick calculations today.

But of course, there was frustration in not being able to resolve to a rational number, and so over the next 2000 years, across China, India, Persia, northern Africa and Europe, as we acquired more and more mathematical knowledge (including acquiring the decimal system), we could increase the number of sides of the polygon to a greater and greater number of sides. In France, François Viète used polygons of 393,216 sides in the year 1593, but could only achieve an accuracy of 10 decimals that way: 3.1415926536 (decimals were known by then). This would be a level of accuracy found on most inexpensive scientific calculators, and looked like a small prize given the number of sides in Viète’s polygon. But this was not state of the art in the early days of the Renaissance. Ludolph van Ceulen, a Dutchman in the late 1600s, who used a polygon of sides, or 4,611,686,018,427,387,904, or exceeding 4.6 quintillion sides. In these days before computers, or even electricity, this took van Ceulen 25 years as his lifetime achievement, but only generated to 35 decimals: 3.141 592 653 589 793 238 462 643 383 279 502 88. There were those who surpassed this as well, but not by a lot.

##### Sir Isaac Newton, or, what were you doing during the pandemic?

1666 was the year that Isaac Newton, a young Cambridge University undergrad student, was sitting at home, quarantining himself (as was everyone else) as the Bubonic Plague was raging through Europe. During his two years of social distancing, among his discoveries in optics, mechanics and Calculus was his method of computing the value of . For this, the 23 year-old Newton used integration (which he called “fluxions”) on a polynomial with rational coefficients. He acquired accuracy to 9 decimals with only a 12-term polynomial. This was achieved by combining the circle formula with the binomial theorem. The circle formula for a unit circle is:

Solving for y in terms of x, we get . It would be a good idea to find the area of the circle going from 0 to 1 (a quarter circle), so we would only need the “positive” version of this formula: . The integral would look like:

[
\int^1_0 \left(1 – x^2\right)^{\frac{1}{2}} dx
]

But because this only gets us the area of a quarter of the unit circle, we need to multiply the integral by 4 to get the exact answer :

[
4\int^1_0 \left(1 – x^2\right)^{\frac{1}{2}} dx = \pi
]

While we have a good idea that this will get us , it doesn’t yet yield any decimals, since must be expanded into a polynomial. For that, you have to break some rules about the Binomial Theorem.

The binomial theorem applies to the expansions of binomials such as: , where it is normally understood that n is a whole number greater than or equal to 1 (or ). The coefficients of a general binomial expasion go as follows:

[
\left(1 + x\right)^n = {n \choose 0}+{n \choose 1}x+{n \choose 2}x^2 + … + {n \choose k}x^k + … + {n \choose n}x^n
]

Squaring makes the expression . Its expansion looks like this:

[
\left(1 + x^2\right)^n = {n \choose 0}+{n \choose 1}x^2+{n \choose 2}x^4 + … + {n \choose k}x^{2k} + … + {n \choose n}x^{2n}
]

Now turning this into , where we subtract instead of add, gives us a similar polynomial, but this time with alternating plus and minus signs:

[
\left(1 – x^2\right)^n = {n \choose 0}-{n \choose 1}x^2+{n \choose 2}x^4 – … \pm {n \choose k}x^{2k} \pm … \pm {n \choose n}x^{2n}
]

So, the strange thing Newton did with this is that he broke the rule that be a natural number. Instead, for the purpose of finding the area of a unit circle (that is, , to as many decimals as possible), he had to go back to the formula for combinations, that is, to see what would happen if . The reason for this is because it fit in with the circle formula of .

, called “n-factorial”, is normally the whole number , multiplied by all of its integer predecessors down to 1, as in: . You stop multiplying when you reach 1. But what if ? For normal counting numbers, subtracting 1 gets you to the next lower whole number. At some point, you will reach 1 if you keep subtracting 1. But if , then subtracting 1 will always yield a fraction, and you never reach 1. In fact, you proceed forever into the negative numbers. Thus, a number like 1/2, when the formula is applied, leads to: going forever. Is this useful?

It turns out, it does have  a use when placed in the formula for , because, for example, the first term is 1, due to . The next term has the coefficient:

[
{n \choose 1} = \frac{n(n-1)(n-2)…(3)(2)(1)}{(n-1)(n-2)…(3)(2)(1)\times 1} = n
]

So, after all that, if , then this coefficient becomes 1/2 so that the second term is . The third term has the coefficient:

[
{n \choose 2} = \frac{n(n-1)(n-2)…(3)(2)(1)}{(n-2)(n-3)…(3)(2)(1)\times 2} = \frac{n(n-1)}{2} = \frac{n^2 – n}{2}
]

So, for :

[
\frac{\left(\frac{1}{2}\right)^2-\frac{1}{2}}{2} = \frac{\frac{1}{4}-\frac{1}{2}}{2} = \frac{-1}{4}\times\frac{1}{2}=\frac{-1}{8}
]

The first 12 terms in the infinite expansion are given in the above illustration at the start of this section.

How much of could we get “on the cheap” by performing integration on only the first 7 terms?

\begin{align}
\pi &= 4\int_0^1 \left( 1-\frac{x^2}{2}+\frac{x^4}{8}-\frac{x^6}{16}+\frac{15x^8}{384}-… \right) dx \
&= 4\left( x-\frac{x^3}{6}-\frac{x^5}{40}-\frac{x^7}{112}-\frac{5x^9}{1152}-\frac{7x^{11}}{2816}-\frac{7x^{13}}{1024}-… \right) \Big|_0^1 \
&= 4\left[1-\frac{1}{6}-\frac{1}{40}-\frac{1}{112}-\frac{5}{1152}-\frac{7}{2816}-\frac{7}{1024}-…\right] \
&= 3.14297
\end{align
}

7 polynomial terms is all it takes to get the same accuracy Archimedes once had when he attempted to average out the areas of a 96-sided polygon both inscribed and circumscribed around a circle.

There is an even better calculus-based solution, which has greater accuracy in fewer terms. What you want to do is to calculate the area under the same curve over 0 to 1/2 instead of 0 to 1. Substituting allows each term to shrink faster, and thus to obtain accurate results with less work. Newton knew that on a unit circle centered at the origin, is actually . The y-value, by extension, is . The area he is calculating describes a sector of the circle   from the perpendicular (this is 1/12th of the total area of the circle, and so its area is ). Added to this sector is a right triangle whose base is 1/2 and whose height is . The triangle would have an area of by the area formula . It would be useful to get only the sector and subtract out the right triangle from the integral. So we will illustrate the first 5 terms of what Newton did:

\begin{align}
\pi &= 12 \left(\int_0^{\frac{1}{2}} (1-x^2)^{1/2} dx – \frac{\sqrt{3}}{8}\right) \
&= 12\int_0^{\frac{1}{2}} (1-x^2)^{1/2} dx – \frac{12\sqrt{3}}{8} \
&=12\left( x-\frac{x^3}{6}-\frac{x^5}{40}-\frac{x^7}{112}-\frac{5x^9}{1152}\right)\Big|_0^{\frac{1}{2}} – \frac{12\sqrt{3}}{8} \
&= 12\left(\frac{1}{2}-\frac{1}{48}-\frac{1}{1280}-\frac{1}{14336}-\frac{5}{589284}\right)-\frac{12\sqrt{3}}{8} \
&= 3.14161
\end{align
}

That is an accuracy within , which is impressive for a mere 5 terms. If you wanted more accuracy, just add more terms. Applying 7 terms as we did above would give us , or an accuacy of within .

##### Modern calculations reflect the power of computers rather than the power of human calculation

Not much progress was observed after that until the invention of computers. So by 1949, the invention of the ENIAC computer gave us 1,120 decimal places, taking 70 hours. By 1973, the CDC-7600, or Cray computer was the first device to give more than 1 million decimal places in 23.3 hours. August 1989 was when the 1 billion digit barrier was broken, using an IBM mainframe. became known to 1 trillion digits in 2002, by a Japanese team using a Hitachi supercomputer, after taking 25 days. Since then the orders of magnitude and computational time appeared to have plateaued somewhat. The latest world record, according to The Guiness Book of World Records, was in November 2020, when 50 trillion digits were found over a period of 8 months of computation. If printed in a normal sized font on letter-sized paper, it would require nearly 28 billion pages to contain the constant at 1800 characters per page. The supercomputer used 4 Intel Xeon processors (15 cores per CPU) running at 2.5GHz each, had 320 GB DDR3 RAM, and 336 terabytes across 60 hard drives, most of them used for computation.

As of 2021, a claim has been made of 62 trillion digits in a little over 3 months. The Swiss-based computer was able to find more digits, faster because of slightly more advanced hardware: Two AMD Epyc 7542 32-core processors at 2.9 GHz each, 1 terabyte of RAM, and 510 terabytes of storage across 38 hard drives, most used for swapping data with the RAM. Their “book” would be over 34 billion pages long if the digits were printed out. It was never made clear what kind of RAM was used. It is assumed they used DDR4.

The current computation of to ever more digits has become a quasi-annual event; an opportunity for computer companies to flex their technological muscle and promote their brand. These impressive calculations are not so much human achievements in the sense of Newton or van Ceulen, but are really achievements of computer engineers and software programmers.

But how many digits do we really need? Even to express the diameter of the universe to within a Planck length ( meters), we would only require 62 digits of .

This article is based on a video by YouTube vlogger Veritasum, plus some additional sources, such as the University of St. Andrews department of Math History.