# How do mathematicians know that they have the correct Nth digit of pi calculated?

370 views

I’m not sure if I worded this correctly but I’ll try to elaborate more. I know that there are formulas that can calculate pi to the Nth digit. But my question is how can we be certain that the formulas accurately calculate the Nth digit of pi when we have nothing to compare it to since pi is an irrational number that keeps on going?

For example if I discovered a new formula than can calculate pi to 1 higher digit than what we currently know and the value I got was 4. How do I confirm that it is indeed 4 and not any other number? I have nothing else to compare it to?

I hope this makes sense

In: Mathematics

The formulas for pi come with a mathematical **proof**. An irrefutable argument from basic logics and our agreed-upon meaning of arithmetic. Everyone can check and verify it, and many indeed did already; nowadays computers can verify such proofs, too. Altogether a _lot_ of very good people would need to have overlooked an error if there is any.

And that’s not even where it stops: we can use another formula derived in a completely independent way. If it spits out the very same digits then we are even more certain that we didn’t screw up.

If your own formula disagrees you have to show not only it but also the proof of correctness to experts; and they very likely will spot the error very quickly.

Actually the by far largest chances for errors are in the hard- and software. There can be a coding mistake, which however usually gets spotted quickly when it goes off the rails; but nonetheless such codes often get verified by several programmers and even specialized programs. Hardware usually is fine, but there was a case (early 90s I think) where a rare and previously unknown fault in some intel CPU was found when people calculated pi on it and something like the million-th digit was wrong.

There are lots of infinite sums that we know converge to multiples of pi for a variety of geometric reasons. For each of them, you can determine how close you are to pi based on how many terms you’ve added. So if the terms you have left to add, which keep getting smaller, have some upper bound, then you know how many decimal places you can count on.

[Matt Parker](https://youtube.com/@standupmaths) uses one of them each Pi Day to calculate pi in some goofy manner.

If all of those series produced different values for pi, then we’d have a problem. But they don’t.

If you came up with a new series for calculating pi, then first you’d want to prove it actually does work out to pi. After that, whatever new decimal place you got would be correct, assuming you did the sum right.

Two things.

First, because we can prove analytically that some formulae *must* be equal to π, or some multiple of π, even though we don’t know what all the digits of π are. As long as we precisely carry out those formulae, then there’s no need to “check” that it actually is π. We already know that analytically (meaning, based on the definitions of the things used, not on any *observations* about anything.)

Second, there are multiple distinct formulas that all get us π. The sum of 1/n² from 1 to infinity is ~~π/6~~ *π²/6*. The integral from -1 to 1 of √(1-x²) is π/2. Etc. By using different formulae, even if there were any uncertainty, we could check with a different calculation.

We have formulas, more specifically usually some kind of infinite sum that we can prove will converge towards pi. Often we can also say something about how quickly it converges. The fact that they converge to pi can be proven without having to know the digits of pi, with the same tools we use to prove other things in mathematics. For examples you can check out [https://en.wikipedia.org/wiki/Pi#Rapidly_convergent_series](https://en.wikipedia.org/wiki/Pi#Rapidly_convergent_series)

If you want to see what a proof might look like, you can look at the proofs for the [Leibnitz Formula](https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80#Proof_1)

The formulas are derived from known mathematical relationships.

A example is drawn regular polygon with n sides inside and outside a circle with a diameter of 1. You know by definition the circumference is pi.

You know the circumference of the circle is larger then the one indide and smaller then the one on the outside.  Add enough sides so the polygon are equal in length o the third decimal and you know pi also have the same decimal.

That is not in any way a efficient way to calculate pi but it is something that is easy to visualise and understand without a lot of mathematical knowledge

Because whatever method is being used to calculate pi has a rigorous proof proving its accuracy. AFAIK, for pi specifically, it’s not so much about developing new methods to calculate new digits, but about producing more computing power to actually be able to calculate new digits using the same methods.

Theoretically, I suppose the new digits could be wrong somehow, but it’s actually totally irrelevant. You only need 15 digits or something to calculate the size of the Universe with a margin of error the width of a single atom. Or something preposterous like that. Knowing an extra trillion digits of pi is meaningless. Again, if you something about this in a headline, it’s not really about pi; it’s about the computer.

A method could work like this:

We have a circle with radius 1, we know its surface is pi.

We start by drawing a square inside of it, and then a square that’s completely outside of it. We know that pi is smaller than the big square, and bigger than the small square.

Now, for the smaller square we start adding smaller squares in the leftover areas but still within the circle, and for the bigger square we start removing squares that are just outside the circle.

Step by step, as we add/remove smaller squares, we approach pi closer and closer.

At some point, we can say that pi is bigger than one bunch of squares, and smaller than another bunch of squares.

If we have calculated the smaller squares to have an area of 3.13, and the larger squares an area of 3.15, we can be confident that the first to digits of pi are 3.1

If we continue adding/removing smaller squares,  and we end up finding out that pi lies between 3.14152 and 3.14163, we can be sure that pi has digits 3.141.

There are formulas for describing these smaller and smaller squares, allowing us to calculate pi to arbitrary precission.

(There are also other methods used, and formulas for e.g. calculating the 10000th digit of pi are often slightly different, but they still use similar tricks, where we can be sure that the value is correct.

> For example if I discovered a new formula than can calculate pi to 1 higher digit than what we currently know

It’s not about discovering a new formula, it’s about how long you want to spend calculating it. All our existing formulas can calcaulate pi to infinity given infinite time, but we don’t give them infinite time.

So the current “record” of pi is just whoever has the most efficient formula and spent the most time calculating extra digits.

We have sequences that we know converge to pi, and in particular we know we have some sequences that give you a number greater than pi and a number less than pi in succession

So one of these, not the best but it illustrates the point, is the sequence

pi = 4 * (1/1 – 1/3 + 1/5 – 1/7 + 1/9 – 1/11…)

So the true value of pi must always be between 2 consecutive values in the sequence… any two values as you expand the sequence yield an upper and lower bound for pi

Expanding this for a number of places yields

4.0000
2.666667
3.466667
2.895238
3.339683
2.976046
3.283738
3.017072
3.252366
3.04184
3.232316
3.058403
3.218403
3.070255
3.208186
3.079153
3.200366
3.08608
3.194188
3.091624
3.189185
3.096162
3.18505
3.099944
3.181577
3.103145
3.178617
3.10589
3.176065

After the 8th in the sequence we know that pi is between 3.283738 and 3.017072 so we know the first digit is 3

After the 26th in the sequence we know that pi is between 3.181577 and 3.103145 so we know the first 2 digits are 3.1

There are better faster ways to calculate pi but the sequence above shows how you can KNOW what the N’th digit is