How are the known digits of $\pi$ guaranteed?

5.6k Views Asked by At

When discussing with my son a few of the many methods to calculate the digits of $\pi$ (15 yo school level), I realized that the methods I know more or less (geometric approximation, Monte Carlo and basic series) are all convergent but none of them explicitly states that the $n$-th digit calculated at some point is indeed a true digit (that it will not change in further calculations).

To take an example, the Gregory–Leibniz series gives us, for each step:

$$ \begin{align} \frac{4}{1} & = 4\\ \frac{4}{1}-\frac{4}{3} & = 2.666666667...\\ \frac{4}{1}-\frac{4}{3}+\frac{4}{5} & = 3.466666667...\\ \frac{4}{1}-\frac{4}{3}+\frac{4}{5}-\frac{4}{7} & = 2.895238095... \end{align} $$

The integer part has changed four times in four steps. Why would we know that $3$ is the correct first digit?

Similarly in Monte Carlo: the larger the sample, the better the result but do we mathematically know that "now that we tried [that many times], we are mathematically sure that $\pi$ starts with $3$".

In other words:

  • does each of the techniques to calculate $\pi$ (or at least the major ones) have a proof that a given digit is now correct?
  • if not, what are examples of the ones which do and do not have this proof?

Note: The great answers so far (thank you!) mention a proof on a specific technique, and/or a proof that a specific digit is indeed the correct one. I was more interested to understand if this applies to all of the (major) techniques (= whether they all certify that this digit is guaranteed correct).

Or that we have some which do (the ones in the two first answers for instance) and others do not (the further we go, the more precise the number but we do not know if something will not jump in at some step and change a previously stable digit. When typing this in and thinking on the fly, I wonder if this would not be a very bad technique in itself, due to that lack of stability)

11

There are 11 best solutions below

0
On BEST ANSWER

I think the general answer you're looking for is:

Yes, proving that a method for calculating $\pi$ works requires also describing (and proving) a rule for when you can be sure of a digit you have produced. If the method is based on "sum such-and-such series", this means that one needs to provide an error bound for the series. Before you have that, what you're looking at is not yet a "method for calculating $\pi$".

So the answer to your first question is "Yes; because otherwise they wouldn't count as techniques for calculating $\pi$ at all".

Sometimes the error bound can be left implicit because the reader is supposed to know some general theorems that leads to an obvious error bound. For example, the Leibniz series you're using is an absolutely decreasing alternating series, and therefore we can avail ourselves of a general theorem saying that the limit of such a series is always strictly between the last two partial sums. Thus, if you get two approximations in succession that start with the same $n$ digits, you can trust those digits.

(The Leibniz series is of course a pretty horrible way to calculate $\pi$ -- for example you'll need at least two million terms before you have any hope of the first six digits after the point stabilizing, and the number of terms needed increases exponentially when you want more digits).

In other cases where an error bound is not as easy to see, one may need to resort to ad-hoc cleverness to find and prove such a bound -- and then this cleverness is part of the method.

13
On

The simplest method to explain to a child is probably the polygon method, which states that the circumference of a circle is bounded from below by the circumference of an inscribed regular $n$-polygon and from above by the circumference of a circumscribed polygon.

Once you have a bound from below and above, you can guarantee some digits. For example, any number between $0.12345$ and $0.12346$ will begin with $0.1234$.

4
On

Note that $\pi=6\arcsin\left(\frac12\right)$. So, since$$\arcsin(x)=\sum_{n=0}^\infty \frac1{2^{2n}}\binom{2n}n\frac{ x^{2n+1}}{2n+1},$$you have$$\pi=\sum_{n=0}^\infty\frac6{2^{4n+1}(2n+1)}\binom{2n}n.$$Now, for each $N\in\mathbb{Z}^+$, let$$S_N=\sum_{n=0}^N\frac6{2^{4n+1}(2n+1)}\binom{2n}n\text{ and let }R_N=\sum_{n=N+1}^\infty\frac6{2^{4n+1}(2n+1)}\binom{2n}n.$$Then:

  • $(\forall N\in\mathbb{Z}^+):\pi=S_N+R_N$;
  • the sequence $(S_N)_{N\in\mathbb{Z}_+}$ is strictly increasing and $\lim_{N\to\infty}S_N=\pi$. In particular, each $S_N$ is a better approximation of $\pi$ than the previous one.

Since$$(\forall n\in\mathbb N):\binom{2n}n<4^n=2^{2n},$$you have$$R_N<\sum_{n=N+1}^\infty\frac6{2^{2n+1}}=\frac1{4^N}.$$So, taking $N=0$, you get that $\pi=S_0+R_0$. But $S_0=3$ and $R_0<1$. So, the first digit of $\pi$ is $3$. If you take $N=3$, then $\pi=S_3+R_3$. But $S_3\approx3.14116$ and $R_3<0.015625$. So, the second digit is $1$. And so on…

2
On

No method gives $\pi$ exactly, i.e. all digits of $\pi$, in finite time. But many methods give arbitrarily close approximations of $\pi$ if they run long enough. Such methods construct a sequence of values $x_n$ whose limit as $n\to\infty$ is $\pi$. For example, the technique you've mentioned has $x_1=4,\,\,x_2=4-\frac{4}{3}$ etc.

Now, among the sequences satisfying $\lim_{n\to\infty}x_n=\pi$, some are "faster" than others. For example, the aforementioned sequence has $|x_n-\pi|$ roughly proportional to $\frac{1}{n}$, so the number of correct decimal places in approximating $\pi$ as $x_n$ is approximately $\log n$, for $n$ large. For example it takes about a million ($400,000$ in fact) terms to get $6$ decimal places right.

The good news is there are much better sequences than that; for example, this method gets a number of correct decimal place approximately proportional to $9^n$. All we have to do to be sure of specific digits is use appropriate mathematical theory to know how far to run a technique for our purposes. The bad news is this theory gets a little thorny, but I'll try to keep it simple. (If you feel i've made it too simple, see here to learn more.)

If $x_n$ is a sequence of limit $L$, and some $K,\,p$ exist with the large-$n$ approximation $|\epsilon_{n+1}|\approx K|\epsilon_n|^p$ with $\epsilon_n:=x_n-L$, there are three separate cases to consider:

  • $p=K=1$, resulting in very slow convergence such as our original example;
  • $p=1,\,K<1$, so $|\epsilon_n|$ is approximately proportional to $K^n$, and the number of correct decimal places is approximately proportional to $n$;
  • $p>1$, so $\log|\epsilon_{n+1}|\approx p|\epsilon_n|+\log K$, and the number of correct decimal places is approximately proportional to $p^n$.

The first case is called logarithmic convergence; the second is called linear convergence; the third is called superlinear convergence. Note that among superlinearly convergent algorithms increasing $p$ only causes a fractional reduction in the value of $n$ needed to get a given number of decimal places right, and often high-$p$ algorithms have such complicated steps they aren't worth it. The real question is whether some $p>1$ is achievable.

I linked before to a $p=9$ example of superlinear convergence, but it's very complicated. Depending on your son's ambition in self-education, he may be able to understand how this $p=2$ superlinear method works. In fact I probably should have focused on $p=2$ from the start, since calculus lessons often cover a (usually) $p=2$ technique for solving equations called the Newton-Raphson method. Somewhat easier, since it only requires a few basic facts about complex numbers, is understanding certain linear methods such as this work.

0
On

In his answer, José shows how to calculate $\pi$ via a specific approximation and why that works. I believe the why is rather overlooked there and I wanted to clarify and make it less specific to the computation of $\pi$.

Imagine you compute; $$S = \sum_{n=0}^{\infty} a_n$$ for some series $a_n$. And, after summing the first few terms, let's say; $${\overline{S}}_{i} = \sum_{0}^{i} a_n,$$ you can also prove that the rest of the sum is below some bounds; $$R_i^- \le \sum_{i + 1}^\infty a_n \le R_i^+.$$

Then you know also that $\overline{S}_i + R_i^- \le S \le \overline{S}_i + R_i^+$. See how that bounds the exact sum $S$ from above and below? If now both above and below have the same leading digits, we can be sure that those are also the leading digits of $S$, because $S$ lies between the two.

Now, have another look at what José does: he computes the sum over a series up to term $N$ - the exact series is not important here. He approximates the errors $R_N^- = 0$ - all terms are positive - and $$R_N^+ = \frac{1}{4^N}.$$

So after you summed the first $N$ terms (what I called $\overline{S}_N$) you can definitely say that; $$\overline{S}_N \leq S \le \overline{S}_N + \frac{1}{4^N}.$$

0
On

I wish to remind you of this formula: pi/4 = arctan(1) = 4 * arctan(1/5) - 1 * arctan(1/239) . This is easily proven with highschool math. Then with the Taylor formula for the arctan() function you can see that this converges quickly (much quicker than arctan(1) itself), and you can even calculate how many digits you gain (on average) for each iteration. It all depends on starting with a good formula !

3
On

The answers so far to this great question illustrate a problem that we should redress in this forum: We rush in good faith to say something smart, something that other mathematicians may enjoy for its cleverness, but something which often is difficult to digest to the OP.

*steps off the soap box

Let me try a different take that will be of use to a 15 yo. There are two parts to the question: a) Do all known methods get arbitrarily many digits correct, b) how to tell that a digit is already correct.


a) Throughout history, people have found many ingenious ways to approximate $\pi$, say as $22/7$ or $\sqrt{10}$. Sometimes they knew they had an approximation, sometimes they mistakenly assumed they had the actual value. When in modern mathematics a formula is presented for $\pi$, it is guaranteed to give (eventually) as many digits as desired. The keyword is to say that the formula converges.

Please note that mathematicians word things differently; we do not care that “we get arbitrarily many digits correctly”, but rather that the value computed “is arbitrarily close to the target value”. These are equivalent, but the second is not dependent on writing numbers in base 10.

b) Every formula converges at its own pace, so there is no universal way to decide when a digit given by one or another is settled. However, there are general techniques to prove convergence, and often it is possible to see at a glance (or after a brief computation) that the formula converges. Other times it is not so straightforward...

So let’s take a look at only one example; namely the formula mentioned in the question: $$4-4/3+4/5-4/7+\ldots$$

This is particularly slow, but offers a great insight into convergence. It is an example of an alternating series; i.e., you add, then subtract, then add, then subtract, in perfect alternation. Moreover, each term is smaller than the previous one, as in $4/3>4/5>4/7>\ldots$. Moreover, these terms get arbitrarily small, as in $$4/4000001 < 4/4000000 = 0.000001$$

Now given these three conditions, we know the infinite sum will converge to a final vale (which we are told is $\pi$). Why? Plot the consecutive sums on the real line to see what happens. You get 4, then 2.6666, then 3.46666, etc. More, then less, then more, so that the values are nested (because each term is smaller than the previous), and overshoot the final value of $\pi$. Since the terms get small, the sums are forced to get closer and closer to the final value.

Here is the kicker: when you add $4/41$ (for instance), you overshot your mark, so the current sum is closer to $\pi$ than $4/41$, and similarly for any other summand.

In particular, when you add $4/4000001$, you are closer to target than 0.000001, and the first 5 digits will be guaranteed.

Disclaimer. This does not show that the final value is $\pi$. That requires more math. The argument only shows that the sum converges to a final value.

0
On

The Monte Carlo method is a stochastic method, so it does not provide certain proof. All it can do is say that the probability of having a particular result, if it were wrong about the first $k$ digits of $\pi$, goes to zero.

For a sequence that converges to $\pi$, however, we have that there is some function $f(k)$ such that for any $k$ and $n>f(k)$, the $n$-th term is correct to $k$ digits (barring the .9999.... issue). That's just from the definition of "converges"; one formulation of what it means to converge that is equivalent to the standard definition is that given any number of digits, there is some point in the sequence such that all the terms after that point are accurate to that number of digits. So any time someone claims that a sequence converges to $\pi$, they are claiming that for each digit, there is some point at which it is certain (however, some people are loose with stochastic terminology, giving such formulations as "converges with probability one", which is not a precise formulation). Generally, proofs of convergence, even if they do not explicitly construct a function $f(k)$, can be easily modified to generate such a function.

For any approximation based on a Taylor series, the is the Lagrange error bound.

0
On

We can apply Dalzell's idea to prove $\pi<\frac{22}{7}$ to decimal approximations as well.

The first digit of $\pi$ is guaranteed by the inequality $$3<\pi<4,$$

which can be proven from integrals $$\pi=3+2\int_0^1\frac{x(1-x)^2}{1+x^2}dx$$

and

$$\pi=4-4\int_0^1 \frac{x^2}{1+x^2}dx$$

Similarly, the second digit being $1$ is equivalent to

$$3.1<\pi<3.2$$

or

$$\frac{31}{10}<\pi<\frac{16}{5},$$

which is proven by

$$\pi=\frac{31}{10}+2\int_0^1 \frac{x^2(1-x)^2(1-x+x^2)}{1+x^2}dx$$

and

$$\pi=\frac{16}{5}-\int_0^1 \frac{x^2(1-x)^2(1+2x+x^2)}{1+x^2}dx$$

Similar double inequalities can be written for every digit. For example, the answer https://math.stackexchange.com/a/2485646/134791 shows an integral for $\pi>3.14$.

3
On

Assuming you can explain to you kid that:

$$ a_n \rightarrow\pi \iff \exists n_0 \, \text{such that} \, n>n_0 \rightarrow |\pi -a_n|<\varepsilon $$

Then it is possible to state that $\varepsilon$ is the precision of the "approximation" $a_n$.

Thus, you can compare the digits of $a_n+\varepsilon$ and of $a_n-\varepsilon$. All unchanged digits are certain.

3
On

The question was:

        Why would we know that 3 is the correct first digit?

Following Archimedes, the regular hexagon inscribed into the unit circle has circumference $\ =\ 6\cdot 1\ = 6,\ $ hence $$ 3\ <\ \pi $$ Next, the hexagon circumscribed around the unit circle has circumference $\ =\ 6\cdot\frac 2{\sqrt 3},\ $ hence

$$ \pi\ <\ \frac 6{\sqrt 3} $$

i.e.

$$ \pi^2\ <\ 12\ < 4^2 $$

Thus,

$$ 3\ <\ \pi\ <\ 4 $$

Great!