ExplorationsA proof that squeezes and a simulation that only ever guesses

Two Ways to Corner π

Exhaustively checkedpicertified boundsexact arithmeticintermediate

The number is a circle’s divided by its . For a circle of diameter 1, an inscribed regular hexagon has perimeter 3, so π must be greater than 3. Add sides to inside and outside the circle to narrow guaranteed bounds, then compare them with a statistical estimate from randomly dropped needles and their line crossings.

Current view: The polygons

The construction itself: a circle with a polygon inside it and a polygon outside it, and the two perimeters that trap π between them.

The polygons · 6 sides3.000000000 … 3.464101616
diameter 1

6 sides

  • at least3.000000000
  • at most3.464101616

The two ends do not yet agree on a single decimal place. The inscribed hexagon is three diameters round exactly, because each of its sides is a radius. That is the left-hand end with nothing computed.

The perimeters behind this figure
Inscribed and circumscribed perimeters, divided by the diameter, at every rung the ladder draws
SidesInscribed perimeterCircumscribed perimeterGap between them
63.00000003.46410170.4641017
123.10582853.21539040.1095618
243.13262863.15966000.0270314
483.13935023.14608630.0067361
963.14103193.14271460.0016827
1923.14145243.14187310.0004206
3843.14155763.14166280.0001052
7683.14158383.14161020.0000263
1,5363.14159043.14159710.0000066
the circle
the circle of diameter 1, whose way round is π
the inner polygon
corners on the circle, so shorter round than it
the outer polygon
sides touching the circle, so longer round than it

The circle has diameter 1, so its circumference is π and the two polygon perimeters are the two numbers in the bracket. The inner polygon has its corners on the circle and is therefore shorter than it; the outer polygon has its sides touching the circle and is therefore longer. Every press of Step doubles the number of sides, both perimeters move toward the circle from their own side, and the pair of numbers beneath the figure closes in. What you are watching is not an approximation getting better. It is two statements that were true at every stage getting closer together.

The 6-gon proves π is between 3.000000000 and 3.464101616, which settles not one decimal place.

Sides
6
π is at least
3.000000
π is at most
3.464102

Sides of the polygons

The hexagon, where the inscribed perimeter is exactly three diameters and no arithmetic has happened yet. π > 3, proved by a picture.

6 sides, not one decimal place settled. Every doubling costs one square root and narrows the bracket by roughly a factor of four, which is about one decimal place for every two rungs.

Step by step

Use Step for one change you can inspect, or Run to watch the changes accumulate.

Speed

Step doubles the number of sides. Run walks the whole ladder from the hexagon to the 1536-gon, one rung at a time.

The needles

Advanced parameters

Cases worth seeing

Try this

Before you move the slider: how many doublings do you think it takes to prove the first five digits of π, that is, to get both ends of the bracket to agree on 3.1415?

1/4

What is going on

Each explanation begins with a worked example and follows the same operation through intuition, formal statements and proofs. Later sections distinguish what is established from questions that remain open, so you can follow the level of detail useful to you.

Worked by handThe inscribed perimeter doubled four times, from the hexagon's 3.0000000 to the 96-gon, every value a rigorous lower bound on .
  1. 3.0000000√(3.2153903 × 3.0000000)3.105828512 sides, and the first on the ladder
  2. 3.1058285√(3.1596599 × 3.1058285)3.132628624 sides
  3. 3.1326286√(3.1460862 × 3.1326286)3.139350248 sides
  4. 3.1393502√(3.1427145 × 3.1393502)3.141031996 sides, and is now proved larger than this

The laboratory runs exactly this, both halves of it, with the circumscribed coming down to meet the inscribed one from above. Press Step and the sides double; the two numbers beneath the figure are the ends of the bracket you have just read down the left of.

The first line took no arithmetic. Six equal of a circle are each as long as the , so the inscribed hexagon is three round, exactly, and is bigger than 3 before anything has been computed. Four later it is bigger than 3.1410319 and smaller than 3.1427146, and both halves of that are as certain as the first one.

01

What you are seeing

A plain description of the process

Begin with a circle of 1. Draw a inside it, with all its corners on the circle, and another regular polygon outside it, with all its sides touching the circle.

The inner is shorter round than the circle, because a straight line between two points on the circle is shorter than the arc between them. The outer polygon is longer round than the circle, for a similar reason. So if the circle has 1, its is and

(inner perimeter) < < (outer perimeter).

That is the whole idea, and it is already a of something. With six sides the inner perimeter is exactly 3, so is bigger than 3, and no computation was involved in establishing that.

Double the number of sides in each . Both polygons hug the circle more closely, both perimeters move toward from their own side, and the two statements above stay true the whole time. Six sides, twelve, twenty-four, forty-eight, ninety-six: at ninety-six the bracket is 3.1410319 to 3.1427146, which is where Archimedes stopped and which is usually quoted as 223/71 < pi < 22/7.

The third view on this page does something entirely different. It drops needles on a floor ruled with parallel lines and counts how many cross a line. The that cross is related to , so the count produces a number near it. That number is not a bound and never becomes one, no matter how many needles fall, and holding the two kinds of answer next to each other is what this page is for.

02

Why it starts to make sense

Intuition, before any algebra

Why the hexagon is exactly 3. Take a regular hexagon inscribed in a circle and join its corners to the centre. You get six triangles, each with two sides equal to the and the between them equal to a sixth of a full turn, which is sixty degrees. A triangle with two equal sides and sixty degrees between them is equilateral, so the third side, which is one side of the hexagon, is also a radius. Six radii is three . There is no approximation anywhere in that paragraph.

Why doubling is easy. Doubling the sides of a sounds like it should need new geometry each time, and it does not. If is the circumscribed perimeter and the inscribed one, both divided by the , then doubling the sides gives

The first is a harmonic mean and the second a geometric mean, and neither knows anything about circles: they are two lines of trigonometry, done once in layer 5 and then applied over and over. So the whole ladder is one per rung and nothing else.

Where the difficulty actually is. That . Every other operation is exact arithmetic on , so a computer can do it with whole numbers and no error at all. A square root of a fraction is almost never a fraction, so something has to give, and what most programs do is take a floating-point square root and hope. That turns a bracket into an estimate without changing anything you can see on the screen.

What this page does instead is refuse to compute the . It computes two with the root between them, rounded so that the lower one is definitely below and the upper one is definitely above, and carries both. The bracket then stays a bracket for the whole ladder, and the only thing the rounding costs is a slightly wider interval than the perfect one.

Why the needles are different. A needle of length dropped on lines a distance apart crosses a line with , when . Turn that around and you can estimate from a shower of needles: throw , count the that crossed, and should be near pi. It is near pi. It is never provably near pi, and the difference between those two sentences is the reason this page has three views instead of two.

03

The key idea

Two numbers that look the same and are not

Put these two lines side by side.

3.1410319 < < 3.1427146, from four doublings of a hexagon.

is about 3.1405, from two hundred thousand needles.

The second is closer. The first is worth more, and the gap between what they are worth is not a matter of degree.

The first line is a statement. It can be checked, it can be argued with, and it happens to be true, with a that fits on this page. If you doubt it, there is something specific to doubt: the geometry, the , the direction of the rounding. Every one of those is written down.

The second line is a number. There is nothing in it to doubt and nothing to check. It came from a particular shower of needles and a different shower gives a different number. Ask how close it is to and the honest answer is that nobody knows without already knowing pi. Ask again after a hundred times as many needles and the answer is the same: still no bound, and now ten times more work for one more likely digit.

A computation that produces a number has not produced a bound. A computation that produces two numbers and a that the answer is between them has produced something else entirely, even when the two numbers are further apart than the one number was.

This is the same distinction the rest of this site keeps running into from the other direction. Goldbach's conjecture has been checked past four quintillion and that is evidence rather than . Here, four doublings of a hexagon check nothing at all and prove a . The size of the computation was never what settled it.

And there is a second lesson in the needles, which is quieter. Make the needle longer than the gap between the lines and the formula goes on producing numbers. They are near 4 rather than near 3.14, which is obvious here only because you already know the answer. A formula outside its does not fail loudly; it just stops meaning anything while continuing to compute.

04

Formal statement

Precisely what is being claimed

Let be the perimeter of the regular circumscribed -gon and that of the regular inscribed -gon, both around a circle of 1. Then:

  1. for every , and with and . Proved, in layer 5.
  2. . Proved, as the case of 1, and reproduced by this page in exact arithmetic.
  3. Every bracket this laboratory prints for the ladder contains . Exhaustively checked over the nine rungs it draws, against fifty places of entered by hand, and separately against the enclosure of 5. Not proved: 1 is the , this is a statement about a program.
  4. , and truncating each series after terms leaves an error smaller in size than the first omitted term and of that term's sign. Proved, in layer 5, for the bound.
  5. A needle of length dropped with position and independent and uniform on lines a distance apart crosses a line with . Proved, in layer 5. The of the resulting estimate of from throws is proportional to . Proved, cited, not reproduced here.
  6. For the formula estimates nothing. Proved, in layer 5, by identifying the step of the argument that fails.
  7. is , and indeed transcendental. Proved, cited, not reproduced, and no part of this page is evidence for either.

Statement 3 is the one that is easiest to overstate and it is deliberately the weakest here. The is 1. What a test suite can establish about an implementation of it is that these particular printed numbers are right, which is a different and much smaller thing.

05

Proof

Of the bracket, the bound and the needle

The bracket the circle. The inscribed polygon's perimeter is a sum of , and each chord is shorter than the arc it subtends, so . The circumscribed polygon contains the circle as a convex region contains a convex region, and the perimeter of a convex region containing another is at least as large, so . Both inequalities hold for every , which is what makes every rung of the ladder a statement rather than a stage. ∎

The two recurrences. With the circle of 1, a regular -gon inscribed has perimeter and circumscribed has . Write , so that and . Then

using and ; and

so , both quantities being positive. The starting values are the hexagon: from the equilateral triangles of layer 2, and . ∎

The rounding keeps the bracket true. Both recurrences are strictly increasing in each of their arguments: for positive and , , and the is increasing. So if and , feeding the low pair through gives a value at or below and the high pair a value at or above it. The square root of a is bracketed by writing and taking as an exact square root; then , and squaring gives as an inequality between whole numbers. Finally each low bound is rounded down onto the grid and each high bound up, which can only widen an interval that already contains the truth. By every rung brackets . ∎

This is the step where a page like this usually goes wrong, so it is worth saying what the failure would look like: a single floating-point anywhere in that leaves every printed digit unchanged and every claim on this page false. The kernel is checked by a test that reads it as text and fails if the string appears in it.

The alternating . For , , whose terms decrease strictly in size and alternate in sign. For such a series the straddle the : when is even and the reverse when is odd, since and the bracketed quantity lies strictly between and . So the remainder after terms is smaller in size than the first omitted term and has its sign, which is a bound and not an estimate. Applying that to and separately and combining with gives an interval, provided the subtraction takes the upper bound of the term being removed to make the lower bound of the difference. ∎

The needle. Let the needle have length and the lines be apart. Let be the distance from the needle's centre to the nearest line, uniform on , and its acute to the lines, uniform on , independent. The needle crosses exactly when . So

Where that stops being true. The integral above computes the expected number of crossings, and the last line silently identifies it with the of at least one. Those agree only when the needle cannot cross twice, that is when . For a longer needle the expected count is strictly larger than the probability, so the of needles observed to cross is smaller than , and therefore comes out too large. Nothing in the arithmetic notices: it returns a number near 4 with exactly the same confidence it returns one near 3.14159. ∎

06

Limits and frontier

Where this page stops being able to help

What this laboratory computes. Nine rungs of the ladder, from six sides to 1536, in exact arithmetic on arbitrary-precision , with every bound rounded outward onto a grid of by default. Twenty terms of the Machin series, also exact. Up to two million needles, in ordinary double precision, which is entirely adequate because nothing about the needles is a bound.

Why the ladder stops at 1536. Not for want of arithmetic. Each doubling buys about a of four in the width of the bracket, so roughly one digit every two rungs, and eight rungs have bought five digits. Getting twenty digits this way means about thirty more doublings and a with more sides than there are atoms in a teaspoon of water. This is why the arctangent formulae replaced polygons in 1706 and never gave the ground back, and why the modern computations use neither.

Why the needles will not get better. The error of an average of independent trials shrinks like . To gain one digit you need a hundred times as many needles. The two million this page will throw are worth about three digits on a good day, and there is no seed and no patience that turns that into a bound: every one of those digits is a digit that happens to be right, not a digit that is known to be.

What is not settled anywhere. Nothing about the bracket, which has been closed for two thousand years, and nothing about 's irrationality or transcendence, which are . What is genuinely open is smaller and stranger than either: whether pi is normal, meaning that every string of digits appears in it with the frequency chance would predict. Billions of digits have been examined and they look normal. Nobody has proved that any digit appears infinitely often. That is the same shape of gap this whole site keeps arriving at, and it is worth noticing that even pi, the most computed number in mathematics, has one.

Read this next to 1, 2, 4, 8, 16, and Then Not 32. The other page here that proves its own formula in front of the reader rather than citing it, on the same circle with straight lines drawn across it. One is about a count that a pattern gets wrong at the sixth term; this one is about a number no pattern reaches at any term.

What is actually established

Every statement on this page, with its status, its exact scope, and the date that status was last checked.

Proved

223/71 < π < 22/7.

Scope
A statement about π itself, with no range and no computation attached. Proved by the inscribed and circumscribed 96-gons, and reproduced exactly on this page by running that ladder in exact rational arithmetic.
Why
This is Archimedes’ result and the argument is given in full in layer 5: the two polygon perimeters bracket the circumference at every number of sides, both recurrences are exact, and the only inexact step is the square root, which is replaced here by a pair of rationals rounded in the direction that keeps the bracket true. The laboratory’s 96-gon rung gives 3.1410319 < π < 3.1427146, which is inside 223/71 < π < 22/7, so the classical bracket follows from it. The citation is for the attribution; the proof is on the page.
Status checked
Exhaustively checked

Every bracket this page prints for the polygon ladder, from the hexagon to the 1536-gon, really does contain π.

Scope
The nine rungs the laboratory draws, at the rounding precisions it offers, and no others. The general statement that the recurrence brackets π at every number of sides is proved in layer 5; what is checked here is that this implementation of it is correct.
Why
The distinction is worth being pedantic about. That the polygons bracket the circle is a theorem. That these particular printed numbers do is a fact about a program, and a program can round the wrong way. So every rung is checked in the test suite against fifty digits of π typed in by hand from a reference, as an inequality between exact rationals rather than a comparison of doubles, and the ladder is checked again against the Machin enclosure, which shares no arithmetic with it beyond the rational type. A separate test reads the kernel as text and fails if the string "Math.sqrt" appears in it, because a single floating-point square root would leave every number on this page looking exactly as it does now and none of them certified.
Computation (exact)
Nine rungs, from 6 sides to 1536. All arithmetic is exact rationals on arbitrary-precision integers; no floating-point value enters the bound path at any point. The only inexact operation is the square root, which returns a pair of rationals with the true root between them, obtained from an exact integer square root and never from Math.sqrt. After every doubling each lower bound is rounded down and each upper bound is rounded up onto a grid of 10^-25 by default, adjustable from 10^-6 to 10^-40; rounding outward can widen a true bracket and cannot falsify one. Checked against π to 50 decimal places, entered by hand from a reference rather than computed here. Algorithm pi-bounds-1.
Status checked
Proved

Truncating Machin’s series at any number of terms gives an interval that contains π, not merely an approximation to it.

Scope
Every whole number of terms from one upwards, for the formula π/4 = 4·arctan(1/5) − arctan(1/239). The identity itself is stated here and its verification is routine; what is proved on this page is the remainder bound that turns the truncation into an enclosure.
Why
Proved in layer 5. The arctangent series for a reciprocal below one alternates with strictly decreasing terms, so the remainder after any number of terms is smaller in size than the first term omitted and carries that term’s sign. That is a bound on the error rather than an estimate of it, which is the entire difference between this and a floating-point sum. The subtraction of the two arctangents needs care in the same direction: a lower bound on the difference uses the low end of the term added and the high end of the term taken away.
Status checked
Proved

A needle of length l dropped on lines a distance d apart, with l no greater than d, crosses a line with probability 2l/(πd); and the error of an estimate of π from N throws shrinks like 1/√N.

Scope
Needles no longer than the gap, dropped with the position and angle independent and uniform, which is what this laboratory does. The 1/√N rate is the standard deviation of the estimator and is a statement about the typical size of the error, not a bound on any particular run.
Why
The crossing probability is proved in layer 5 in three lines. The rate is the central limit theorem applied to a count of independent events and is cited rather than proved here. Neither of them says anything about the number this page happens to produce: the first says what would happen on average over every possible floor, and the second says how slowly the spread of those floors shrinks. The distance between "the expected value is π" and "this run gives π" is what the failure preset at a hundred throws is for.
Status checked
Observed in this run

From seed 12345, two hundred thousand needles at a length equal to the gap crossed a line 127,367 times, giving an estimate of 3.1405.

Scope
Exactly that seed, that many throws and that needle length, under this page’s pseudo-random generator. Not a statement about π and not evidence for the claim above it: change the seed and the number changes.
Why
Recorded because a seeded page has to be reproducible, and reproducible means the number is pinned somewhere a reader can check it against what their browser shows. It is one draw from a distribution whose mean is π, and no part of it is a bound: the estimate could have been 3.15 with the same method and a different seed, and nothing available to this page would have said so. That is the whole reason it sits in the ledger under a different status from the two brackets above.
Computation (approximate)
Two hundred thousand throws from the mulberry32 generator in src/math/core/prng.ts, seeded with 12345. Two uniform draws per needle: distance from the nearest line and angle. Double-precision arithmetic throughout, which is entirely adequate because nothing here is a bound. Algorithm pi-bounds-1.
Status checked
Proved

For a needle longer than the gap the formula 2lN/(dC) is not an estimate of π at all, and the number it returns is systematically too large.

Scope
Every needle length strictly greater than the gap between the lines. A statement about the derivation, not about how far wrong any particular run comes out.
Why
The proof in layer 5 computes the expected number of crossings and then identifies it with the probability of crossing, which is legitimate only when a needle can cross at most once. A longer needle can cross two lines, so the expected count exceeds the probability, the observed fraction of needles that crossed is smaller than the formula assumes, and the estimate comes out too large. The laboratory keeps computing in that case and refuses to call the result an estimate, because the arithmetic gives no sign whatever that anything has gone wrong.
Status checked
Proved

π is irrational.

Scope
π itself. Lambert’s argument appeared in the academy volume for 1761, published in 1768, and shorter proofs followed. The result is cited here, not reproduced or established by this laboratory.
Why
It matters here for one reason: it is why no rung of the polygon ladder will ever close. Both ends of every bracket on this page are rational, so if the two ever met, π would be rational. They never meet, and the ladder is not merely slow but incapable of finishing.
Status checked
Proved

π is transcendental: it is not a root of any polynomial with whole-number coefficients.

Scope
π itself. Proved by Lindemann in 1882. Stated here and cited, not reproduced, and nothing on this page is evidence for it.
Why
The stronger fact behind the irrationality, and the one that settles the ancient question of squaring the circle, since a construction with straight edge and compasses can only produce numbers that are algebraic. It is also the reason the numbers in the interval view will never simplify into anything: every bound printed here is a rational number that is not π, and there is no closed form waiting at the end of the ladder.
Status checked

Sources

Review notes show which bibliographic details Mathomaly has checked and which remain unresolved. Checking a publication record does not independently verify its proof.

  1. Archimedes, Measurement of a Circle, In T. L. Heath (ed.), The Works of Archimedes, Cambridge University Press, 1897. Link

    The classical polygon argument gives 223/71 < π < 22/7. The laboratory computes this bracket with exact rational bounds rather than reproducing Archimedes' handwritten square-root approximations.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: publisher record.

    Publisher identifies the chapter and original 1897 Heath edition.

  2. Petr Beckmann, A History of Pi, St. Martin’s Press, 1971. Link

    A general history of π, used for historical context rather than as the laboratory's numerical method.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: library record.

    National academic catalogue confirms Beckmann, St. Martin's Press and 1971.

  3. Jonathan M. Borwein, Peter B. Borwein, Pi and the AGM: A Study in Analytic Number Theory and Computational Complexity, Wiley, 1987. Link

    A reference on algorithms for π, including arithmetic-geometric mean methods. The laboratory's polygon and series computations do not implement the full range of methods in the book.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: author record.

    Author's university page lists Pi and the AGM, Wiley, 1987.

  4. Georges-Louis Leclerc, Comte de Buffon, Essai d’arithmétique morale, Supplément à l’Histoire Naturelle, vol. 4, 1777. Link

    Historical source for the needle problem. The page derives the crossing probability for a needle no longer than the gap independently.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: library record.

    University historical collection identifies the 1777 Supplement IV essay and provides source texts.

  5. William Feller, An Introduction to Probability Theory and Its Applications, Volume I, Wiley, third edition, 1968. Link

    A probability reference for independent trials and sampling error. Under the stated model, the standard error decreases in proportion to 1/√N.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: publisher record.

    Publisher confirms author, volume I, third edition and 1968.

  6. Johann Heinrich Lambert, Mémoire sur quelques propriétés remarquables des quantités transcendantes circulaires et logarithmiques, Mémoires de l'Académie royale des sciences de Berlin, année 1761, pp. 265–322, 1768. Link

    Lambert's irrationality argument appeared in the academy volume for 1761, published in 1768. The laboratory does not reproduce this proof.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: library record.

    Collected-works record distinguishes the 1761 academy year from publication in 1768.

  7. Ivan Niven, A simple proof that π is irrational, Bulletin of the American Mathematical Society 53(6), p. 509, 1947. Link

    A short proof of the irrationality of π. The laboratory cites the result but does not reproduce this proof.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: source text.

    University-hosted original confirms Niven's one-page proof; journal is Bulletin of the AMS 53 (1947), p. 509.

  8. Ferdinand von Lindemann, Ueber die Zahl π, Mathematische Annalen, 1882. Link

    Pi is transcendental, which settles the squaring of the circle and is the reason no polygon ladder of any length can ever terminate in an exact value. Stated here, cited, and not reproduced.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: library record.

    Digital mathematical library confirms title, author and 1882 journal record.

Connected by how they work, not by sharing a topic label.