Display pi to up to 100 decimal places, calculate circle circumference and area using pi, explore pi approximations and their accuracy, and learn the fascinating history and properties of the most famous number in mathematics.
Pi (π, pronounced "pie") is the ratio of a circle's circumference to its diameter. For any circle in Euclidean geometry, regardless of its size, if you divide the circumference by the diameter you always get the same number: approximately 3.14159265...
Pi is one of the most important and celebrated numbers in all of mathematics. It appears not just in circles and spheres, but throughout physics, engineering, statistics, and pure mathematics in contexts far removed from simple geometry β in the normal distribution, Fourier analysis, quantum mechanics, and even the frequency of prime numbers.
Pi has two important mathematical properties that make it special:
π = 3.14159265358979323846264338327950288419716939937510 58209749445923078164062862089986280348253421170679...
The Babylonians used π β 3.125 (25/8) around 1900β1600 BCE. The Rhind Mathematical Papyrus (c.1650 BCE) shows the Egyptians used π β 3.1605 (256/81). The Bible (1 Kings 7:23) describes a circular basin as "ten cubits in diameter and thirty cubits in circumference," implying π β 3 β an approximation for practical purposes.
The Greek mathematician Archimedes established the first rigorous bounds on pi: 3 + 10/71 < π < 3 + 1/7, or approximately 3.1408 < π < 3.1429. He did this by computing the perimeters of inscribed and circumscribed polygons with up to 96 sides. This approach gives 3.14159... correctly to at least 4 decimal places.
Zu Chongzhi (429β501 CE) in China computed π β 355/113 = 3.14159292..., accurate to 6 decimal places β a remarkable achievement not surpassed in Europe for nearly 900 years. In India, Madhava of Sangamagrama (c.1400) developed the first infinite series for pi (the Leibniz formula): π/4 = 1 - 1/3 + 1/5 - 1/7...
Srinivasa Ramanujan (1887β1920) developed several extraordinarily rapidly converging series for pi, including one that adds about 8 correct digits per term. The Chudnovsky brothers used a related formula in 1987 to compute pi to over one billion digits, and similar algorithms are still used in modern record computations.
The record for computing pi digits has grown dramatically with computers. Some milestones:
Pi Day is celebrated on March 14 in the United States because Americans write dates as month/day: 3/14 corresponds to the first three digits of pi (3.14). The US Pi Day is March 14, and at 1:59 PM on that date, the time matches even more digits: 3/14 1:59.
In the United Kingdom and most of Europe, dates are written as day/month: 14/3 means 14 March. This means 3.14 doesn't map to a meaningful UK date. Some UK schools and mathematicians celebrate "Pi Approximation Day" on July 22 (22/7) instead, since 22/7 β 3.14286 is a common fraction approximation of pi. This illustrates the broader US/UK date format difference (MM/DD vs DD/MM) that affects calendars, legal documents, software, and international communication.
| Approximation | Value | Error vs π | Correct Digits |
|---|---|---|---|
| 3 | 3.000000... | +0.04507 | 1 |
| 22/7 | 3.142857... | β0.00126 | 2 |
| 3.14 | 3.14000... | +0.00159 | 2 |
| 333/106 | 3.141509... | +0.000083 | 4 |
| 355/113 | 3.141592920... | β0.0000003 | 6 |
| 3.14159 | 3.14159... | +0.0000027 | 5 |
| Math.PI (JS) | 3.141592653589793 | <10β»ΒΉβ΅ | 15 |
Euler's identity is often called the most beautiful equation in mathematics: e^(iπ) + 1 = 0. It connects five of the most fundamental constants in mathematics: e (Euler's number, β 2.71828), i (the imaginary unit, β-1), π (pi), 1, and 0. The fact that these seemingly unrelated constants combine so elegantly is considered profound evidence of a deep underlying mathematical structure.
Pi appears throughout physics and engineering:
Several beautiful infinite series converge to pi:
One popular method for memorising pi uses "piphilology" β sentences or poems where the number of letters in each word corresponds to a digit of pi. "How I wish I could calculate pi" gives 3.1415926 (3 letters in How, 1 in I, 4 in wish, 1 in I, 5 in could, 9 in calculate, 2 in pi). The world record for memorising and reciting pi digits is held by Rajveer Meena of India, who recited 70,000 digits in 2015.
Pi to 10 decimal places is 3.1415926536. The full 10-decimal sequence is: 3.1415926535 8979... Note that the 11th decimal place (8) causes rounding of the 10th position from 5 to 6 when displaying exactly 10 places.
No. 22/7 β 3.142857..., which differs from pi (3.141592...) in the fourth decimal place. It is a useful approximation β accurate to about 0.04% β but pi is irrational and cannot be expressed as any exact fraction. 355/113 is a far better approximation, accurate to about 0.00008%.
Pi Day is celebrated on March 14 (3/14) in the USA because American dates are written month/day, and 3.14 matches pi's first three digits. In the UK, dates are written day/month, so 14/3 means 14 March. The fraction approximation 22/7 gives "Pi Approximation Day" on 22 July (22/7 in DD/MM format), which some UK schools use instead. This reflects the fundamental MM/DD vs DD/MM format difference between US and UK date conventions.
Circumference = 2πr (where r is the radius) or πd (where d is the diameter). Area = πrΒ². These formulas are exact β pi appears because it IS the ratio of circumference to diameter. For a circle with radius 5 cm: circumference = 2π Γ 5 = 31.416 cm and area = π Γ 25 = 78.540 cmΒ².
No β pi has infinitely many decimal digits and can never be fully computed. What computers calculate are progressively longer prefixes of pi's decimal expansion. As of 2024, over 105 trillion (1.05 Γ 10ΒΉβ΄) digits have been computed. However, for virtually all practical applications, 15β20 decimal places provide more than sufficient precision.
Euler's identity is e^(iπ) + 1 = 0. It arises from Euler's formula e^(ix) = cos(x) + iΒ·sin(x). Substituting x = π: e^(iπ) = cos(π) + iΒ·sin(π) = -1 + 0 = -1, so e^(iπ) + 1 = 0. Pi appears because it is the half-period of the sine and cosine functions β at angle π radians, a full half-turn, the cosine reaches -1.
Remarkably few. NASA's Jet Propulsion Laboratory uses only 15 decimal places of pi for interplanetary navigation. With 39 decimal places, you can calculate the circumference of the observable universe to within the width of a hydrogen atom. For construction and engineering, 5β10 decimal places provide far more precision than any physical measurement can achieve.
The Bailey-Borwein-Plouffe (BBP) formula (1995): π = Ξ£ (1/16^k) Γ (4/(8k+1) - 2/(8k+4) - 1/(8k+5) - 1/(8k+6)), summed from k=0 to infinity. Its remarkable property is that it allows direct calculation of the nth hexadecimal digit of pi without calculating the preceding n-1 digits β a "digit extraction" algorithm with no precedent in mathematics before this discovery.
Pi digits above 15 decimal places are stored as a fixed reference string. JavaScript floating-point arithmetic is limited to approximately 15β17 significant digits. Circle calculations use JavaScript's Math.PI (15 significant digits), which is sufficient for all practical engineering and educational purposes.