Pi Formulas
There are many formulas of ๐ pi
of many types. Among others, these include series, products, geometric constructions,
limits, special values, and pi iterations.
๐ pi
is intimately related to the properties
of circles and spheres. For a circle of radius ๐ r
, the circumference and area are given by
Similarly, for a sphere of radius ๐ r
, the surface area and volume enclosed are
An exact formula for ๐ pi
in terms of the inverse tangents of unit
fractions is Machin's formula
There are three other Machin-like formulas, as well as thousands of other similar formulas having more terms.
Gregory and Leibniz found
(Wells 1986, p. 50), which is known as the Gregory series and may be obtained by plugging ๐ x=1
into the Leibniz series
for ๐ tan^(-1)x
. The error after the ๐ n
th term of this series in the Gregory
series is larger than ๐ (2n)^(-1)
so this sum converges so slowly that 300 terms are not sufficient to calculate ๐ pi
correctly to two decimal places! However,
it can be transformed to
where ๐ zeta(z)
is the Riemann zeta function (Vardi 1991,
pp. 157-158; Flajolet and Vardi 1996), so that the error after ๐ k
terms is ๐ approx (3/4)^k
.
An infinite sum series to Abraham Sharp (ca. 1717) is given by
(Smith 1953, p. 311). Additional simple series in which ๐ pi
appears are
(Wells 1986, p. 53).
In 1666, Newton used a geometric construction to derive the formula
| ๐ pi | ๐ = | ๐ 3/4sqrt(3)+24int_0^(1/4)sqrt(x-x^2)dx |
(18)
|
| ๐ Image | ๐ = | ๐ (3sqrt(3))/4+24(1/(12)-1/(5ยท2^5)-1/(28ยท2^7)-1/(72ยท2^9)-...), |
(19)
|
which he used to compute ๐ pi
(Wells 1986, p. 50; Borwein et al. 1989; Borwein and Bailey 2003, pp. 105-106).
The coefficients can be found from the integral
| ๐ I(x) | ๐ = | ๐ intsqrt(x-x^2)dx |
(20)
|
| ๐ Image | ๐ = | ๐ 1/4(2x-1)sqrt(x-x^2)-1/8sin^(-1)(1-2x) |
(21)
|
by taking the series expansion of ๐ I(x)-I(0)
about 0, obtaining
(OEIS A054387 and A054388). Using Euler's convergence improvement transformation gives
(Beeler et al. 1972, Item 120).
This corresponds to plugging ๐ x=1/sqrt(2)
into the power series
for the hypergeometric function ๐ _2F_1(a,b;c;x)
,
| ๐ (sin^(-1)x)/(sqrt(1-x^2))=sum_(i=0)^infty((2x)^(2i+1)i!^2)/(2(2i+1)!)=_2F_1(1,1;3/2;x^2)x. |
(26)
|
Despite the convergence improvement, series (โ) converges at only one bit/term. At the cost of a square root, Gosper has noted that
๐ x=1/2
gives 2 bits/term,
and ๐ x=sin(pi/10)
gives almost 3.39 bits/term,
where ๐ phi
is the golden ratio. Gosper also obtained
Various limits also converge to ๐ pi
, a simple example being
More interesting examples are given by
and
where ๐ B_n
is a Bernoulli number (Plouffe 2022). These formulas
can be used as a digit-extraction algorithm
for pi digits.
A spigot algorithm for ๐ pi
is given by Rabinowitz and Wagon (1995; Borwein and Bailey
2003, pp. 141-142).
A closed form expression giving another digit-extraction algorithm which produces digits of ๐ pi
(or ๐ pi^2
) in base-16 was discovered by Bailey et al. (Bailey
et al. 1997, Adamchik and Wagon 1997),
This formula, known as the BBP formula, was discovered using the PSLQ algorithm (Ferguson et al. 1999) and is equivalent to
There is a series of BBP-type formulas for ๐ pi
in powers of ๐ (-1)^k
, the first few independent formulas of which are
Similarly, there are a series of BBP-type formulas for ๐ pi
in powers of ๐ 2^k
, the first few independent formulas of which are
F. Bellard found the rapidly converging BBP-type formula
A related integral is
(Dalzell 1944, 1971; Le Lionnais 1983, p. 22; Borwein, Bailey, and Girgensohn 2004, p. 3; Boros and Moll 2004, p. 125; Lucas 2005; Borwein et al.
2007, p. 14). This integral was known by K. Mahler in the mid-1960s
and appears in an exam at the University of Sydney in November 1960 (Borwein, Bailey,
and Girgensohn, p. 3). Beukers (2000) and Boros and Moll (2004, p. 126)
state that it is not clear if these exists a natural choice of rational polynomial
whose integral between 0 and 1 produces ๐ pi-333/106
, where 333/106 is the next convergent. However, an
integral exists for the fourth convergent, namely
(Lucas 2005; Bailey et al. 2007, p. 219). In fact, Lucas (2005) gives a few other such integrals.
Backhouse (1995) used the identity
for positive integer ๐ m
and ๐ n
and where ๐ a
, ๐ b
,
and ๐ c
are rational constant to generate a number
of formulas for ๐ pi
.
In particular, if ๐ 2m-n=0 (mod 4)
,
then ๐ c=0
(Lucas 2005).
A similar formula was subsequently discovered by Ferguson, leading to a two-dimensional lattice of such formulas which can be generated by these two formulas given by
for any complex value of ๐ r
(Adamchik and Wagon), giving the BBP formula as the
special case ๐ r=0
.
An even more general identity due to Wagon is given by
(Borwein and Bailey 2003, p. 141), which holds over a region of the complex plane excluding two triangular portions symmetrically placed about the real axis, as illustrated above.
A perhaps even stranger general class of identities is given by
which holds for any positive integer ๐ n
, where ๐ (x)_n
is a Pochhammer symbol
(B. Cloitre, pers. comm., Jan. 23, 2005). Even more amazingly, there is
a closely analogous formula for the natural logarithm
of 2.
Following the discovery of the base-16 digit BBP formula and related formulas, similar formulas in other bases were investigated. Borwein,
Bailey, and Girgensohn (2004) have recently shown that ๐ pi
has no Machin-type BBP arctangent formula that is not binary,
although this does not rule out a completely different scheme for digit-extraction
algorithms in other bases.
S. Plouffe has devised an algorithm to compute the ๐ n
th digit of ๐ pi
in any base in ๐ O(n^3(logn)^3)
steps.
A slew of additional identities due to Ramanujan, Catalan, and Newton are given by Castellanos (1988ab, pp. 86-88), including several involving sums of Fibonacci numbers. Ramanujan found
(Hardy 1923, 1924, 1999, p. 7).
Plouffe (2006) found the beautiful formula
An interesting infinite product formula due to Euler which relates ๐ pi
and the ๐ n
th
prime ๐ p_n
is
| ๐ pi | ๐ = | ๐ 2/(product_(n=1)^(infty)[1+(sin(1/2pip_n))/(p_n)]) |
(63)
|
| ๐ Image | ๐ = | ๐ 2/(product_(n=2)^(infty)[1+((-1)^((p_n-1)/2))/(p_n)]) |
(64)
|
(Blatner 1997, p. 119), plotted above as a function of the number of terms in the product.
A method similar to Archimedes' can be used to estimate ๐ pi
by starting with an ๐ n
-gon and then relating the area of
subsequent ๐ 2n
-gons.
Let ๐ beta
be the angle
from the center of one of the polygon's segments,
then
(Beckmann 1989, pp. 92-94).
Vieta (1593) was the first to give an exact expression for ๐ pi
by taking ๐ n=4
in the above expression, giving
which leads to an infinite product of nested radicals,
(Wells 1986, p. 50; Beckmann 1989, p. 95). However, this expression was not rigorously proved to converge until Rudio in 1892.
A related formula is given by
which can be written
where ๐ pi_n
is defined using the iteration
with ๐ pi_0=sqrt(2)
(J. Munkhammar, pers. comm., April 27, 2000). The formula
is also closely related.
A pretty formula for ๐ pi
is given by
where the numerator is a form of the Wallis formula for ๐ pi/2
and the denominator is a telescoping
sum with sum 1/2 since
(Sondow 1997).
A particular case of the Wallis formula gives
| ๐ pi/2=product_(n=1)^infty[((2n)^2)/((2n-1)(2n+1))]=(2ยท2)/(1ยท3)(4ยท4)/(3ยท5)(6ยท6)/(5ยท7)... |
(75)
|
(Wells 1986, p. 50). This formula can also be written
| ๐ lim_(n->infty)(2^(4n))/(n(2n; n)^2)=pilim_(n->infty)(n[Gamma(n)]^2)/([Gamma(1/2+n)]^2)=pi, |
(76)
|
where ๐ (n; k)
denotes a binomial coefficient and ๐ Gamma(x)
is the gamma function
(Knopp 1990). Euler obtained
which follows from the special value of the Riemann zeta function ๐ zeta(2)=pi^2/6
.
Similar formulas follow from ๐ zeta(2n)
for all positive integers ๐ n
.
An infinite sum due to Ramanujan is
(Borwein et al. 1989; Borwein and Bailey 2003, p. 109; Bailey et al. 2007, p. 44). Further sums are given in Ramanujan (1913-14),
and
| ๐ 1/pi | ๐ = | ๐ sqrt(8)sum_(n=0)^(infty)((1103+26390n)(2n-1)!!(4n-1)!!)/(99^(4n+2)32^n(n!)^3) |
(80)
|
| ๐ Image | ๐ = | ๐ (sqrt(8))/(9801)sum_(n=0)^(infty)((4n)!(1103+26390n))/((n!)^4396^(4n)) |
(81)
|
(Beeler et al. 1972, Item 139; Borwein et al. 1989; Borwein and Bailey 2003, p. 108; Bailey et al. 2007, p. 44). Equation (81) is derived from a modular identity of order 58, although a first derivation was not presented prior to Borwein and Borwein (1987). The above series both give
(Wells 1986, p. 54) as the first approximation and provide, respectively, about 6 and 8 decimal places per term. Such series exist because of the rationality of various modular invariants.
The general form of the series is
where ๐ t
is a binary quadratic form discriminant,
๐ j(t)
is the j-function,
| ๐ b(t) | ๐ = | ๐ sqrt(t[1728-j(t)]) |
(84)
|
| ๐ a(t) | ๐ = | ๐ (b(t))/6{1-(E_4(t))/(E_6(t))[E_2(t)-6/(pisqrt(t))]}, |
(85)
|
and the ๐ E_i
are Eisenstein series. A class
number ๐ p
field involves ๐ p
th
degree algebraic integers of the constants ๐ A=a(t)
, ๐ B=b(t)
, and ๐ C=c(t)
. Of all series consisting of only integer terms, the
one gives the most numeric digits in the shortest period of time corresponds to the
largest class number 1 discriminant of ๐ d=-163
and was formulated by the Chudnovsky brothers (1987).
The 163 appearing here is the same one appearing in the fact that ๐ e^(pisqrt(163))
(the Ramanujan
constant) is very nearly an integer. Similarly,
the factor ๐ 640320^3
comes from the j-function identity for ๐ j(1/2(1+isqrt(163)))
. The series is given
by
(Borwein and Borwein 1993; Beck and Trott; Bailey et al. 2007, p. 44). This series gives 14 digits accurately per term. The same equation in another form
was given by the Chudnovsky brothers (1987) and is used by the Wolfram
Language to calculate ๐ pi
(Vardi 1991; Wolfram Research),
where
| ๐ A | ๐ = | ๐ 13591409 |
(89)
|
| ๐ B | ๐ = | ๐ -1/(151931373056000) |
(90)
|
| ๐ C | ๐ = | ๐ (30285563)/(1651969144908540723200). |
(91)
|
The best formula for class number 2 (largest discriminant ๐ -427
) is
where
| ๐ A | ๐ = | ๐ 212175710912sqrt(61)+1657145277365 |
(93)
|
| ๐ B | ๐ = | ๐ 13773980892672sqrt(61)+107578229802750 |
(94)
|
| ๐ C | ๐ = | ๐ [5280(236674+30303sqrt(61))]^3 |
(95)
|
(Borwein and Borwein 1993). This series adds about 25 digits for each additional term. The fastest converging series for class number
3 corresponds to ๐ d=-907
and gives 37-38 digits per term. The fastest converging class
number 4 series corresponds to ๐ d=-1555
and is
where
This gives 50 digits per term. Borwein and Borwein (1993) have developed a general algorithm for generating such series for arbitrary class number.
A complete listing of Ramanujan's series for ๐ 1/pi
found in his second and third notebooks is given by Berndt
(1994, pp. 352-354),
These equations were first proved by Borwein and Borwein (1987a, pp. 177-187). Borwein and Borwein (1987b, 1988, 1993) proved other equations of this type, and Chudnovsky and Chudnovsky (1987) found similar equations for other transcendental constants (Bailey et al. 2007, pp. 44-45).
A complete list of independent known equations of this type is given by
for ๐ m=1
with nonalternating signs,
for ๐ m=1
with alternating signs,
| ๐ (128)/(pi^2) | ๐ = | ๐ sum_(n=0)^(infty)((-1)^n(1/2)_n^5(820n^2+180n+13))/(32^(2n)(n!)^5) |
(126)
|
| ๐ (32)/(pi^2) | ๐ = | ๐ sum_(n=0)^(infty)((-1)^n(1/2)_n^5(20n^2+8n+1))/(2^(2n)(n!)^5) |
(127)
|
for ๐ m=2
(Guillera 2002, 2003, 2006),
for ๐ m=3
(Guillera 2002, 2003, 2006), and no
others for ๐ m>3
are known (Bailey et al. 2007, pp. 45-48).
Bellard gives the exotic formula
where
Gasper quotes the result
where ๐ _1F_2
is a generalized hypergeometric
function, and transforms it to
A fascinating result due to Gosper is given by
๐ pi
satisfies the inequality
D. Terr (pers. comm.) noted the curious identity
involving the first 9 digits of pi.
See also
BBP Formula, Digit-Extraction Algorithm, Pi, Pi Approximations, Pi Continued Fraction, Pi Digits, Pi Iterations, Pi Squared, Spigot AlgorithmExplore with Wolfram|Alpha
More things to try:
References
Adamchik, V. and Wagon, S. "A Simple Formula for ๐ pi." Amer. Math. Monthly 104, 852-855, 1997.Adamchik, V. and Wagon, S. "Pi: A 2000-Year Search Changes Direction." http://www-2.cs.cmu.edu/~adamchik/articles/pi.htm.Backhouse, N. "Note 79.36. Pancake Functions and Approximations to ๐ pi
." Math. Gaz. 79, 371-374, 1995.Bailey, D. H. "Numerical Results on the Transcendence of Constants Involving ๐ pi
, ๐ e
, and Euler's Constant." Math. Comput. 50, 275-281, 1988a.Bailey, D. H.; Borwein, J. M.; Calkin, N. J.; Girgensohn, R.; Luke, D. R.; and Moll, V. H. Experimental Mathematics in Action. Wellesley, MA: A K Peters, 2007.Bailey, D. H.; Borwein, P.; and Plouffe, S. "On the Rapid Computation of Various Polylogarithmic Constants." Math. Comput. 66, 903-913, 1997.Beck, G. and Trott, M. "Calculating Pi: From Antiquity to Moderns Times." http://documents.wolfram.com/mathematica/Demos/Notebooks/CalculatingPi.html.Beckmann, P. A History of Pi, 3rd ed. New York: Dorset Press, 1989.Beeler, M. et al. Item 140 in Beeler, M.; Gosper, R. W.; and Schroeppel, R. HAKMEM. Cambridge, MA: MIT Artificial Intelligence Laboratory, Memo AIM-239, p. 69, Feb. 1972. http://www.inwap.com/pdp10/hbaker/hakmem/pi.html#item140.Berndt, B. C. Ramanujan's Notebooks, Part IV. New York: Springer-Verlag, 1994.Beukers, F. "A Rational Approximation to ๐ pi
." Nieuw Arch. Wisk. 5, 372-379, 2000.Blatner, D. The Joy of Pi. New York: Walker, 1997.Boros, G. and Moll, V. Irresistible Integrals: Symbolics, Analysis and Experiments in the Evaluation of Integrals. Cambridge, England: Cambridge University Press, 2004.Borwein, J. and Bailey, D. Mathematics by Experiment: Plausible Reasoning in the 21st Century. Wellesley, MA: A K Peters, 2003.Borwein, J.; Bailey, D.; and Girgensohn, R. Experimentation in Mathematics: Computational Paths to Discovery. Wellesley, MA: A K Peters, 2004.Borwein, J. M. and Borwein, P. B. Pi & the AGM: A Study in Analytic Number Theory and Computational Complexity. New York: Wiley, 1987a.Borwein, J. M. and Borwein, P. B. "Ramanujan's Rational and Algebraic Series for ๐ 1/pi
." Indian J. Math. 51, 147-160, 1987b.Borwein, J. M. and Borwein, P. B. "More Ramanujan-Type Series for ๐ 1/pi
." In Ramanujan Revisited: Proceedings of the Centenary Conference, University of Illinois at Urbana-Champaign, June 1-5, 1987 (Ed. G. E. Andrews, B. C. Berndt, and R. A. Rankin). New York: Academic Press, pp. 359-374, 1988.Borwein, J. M. and Borwein, P. B. "Class Number Three Ramanujan Type Series for ๐ 1/pi
." J. Comput. Appl. Math. 46, 281-290, 1993.Borwein, J. M.; Borwein, P. B.; and Bailey, D. H. "Ramanujan, Modular Equations, and Approximations to Pi, or How to Compute One Billion Digits of Pi." Amer. Math. Monthly 96, 201-219, 1989.Borwein, J. M.; Borwein, D.; and Galway, W. F. "Finding and Excluding ๐ b
-ary Machin-Type Individual Digit Formulae." Canad. J. Math. 56, 897-925, 2004.Castellanos, D. "The Ubiquitous Pi. Part I." Math. Mag. 61, 67-98, 1988a.Castellanos, D. "The Ubiquitous Pi. Part II." Math. Mag. 61, 148-163, 1988b.Chudnovsky, D. V. and Chudnovsky, G. V. "Approximations and Complex Multiplication According to Ramanujan." In Ramanujan Revisited: Proceedings of the Centenary Conference, University of Illinois at Urbana-Champaign, June 1-5, 1987 (Ed. G. E. Andrews, B. C. Berndt, and R. A. Rankin). Boston, MA: Academic Press, pp. 375-472, 1987.Dalzell, D. P. "On 22/7." J. London Math. Soc. 19, 133-134, 1944.Dalzell, D. P. "On 22/7 and 355/113." Eureka 34, 10-13, 1971.Ferguson, H. R. P.; Bailey, D. H.; and Arno, S. "Analysis of PSLQ, An Integer Relation Finding Algorithm." Math. Comput. 68, 351-369, 1999.Finch, S. R. Mathematical Constants. Cambridge, England: Cambridge University Press, 2003.Flajolet, P. and Vardi, I. "Zeta Function Expansions of Classical Constants." Unpublished manuscript. 1996. http://algo.inria.fr/flajolet/Publications/landau.ps.Gasper, G. "Re: confluent pi." math-fun@cs.arizona.edu posting, Aug. 18, 1996.Gosper, R. W. posting, Sept. 1996.Gosper, R. W. "a product." posting, Sept. 27, 1996.Gourdon, X. and Sebah, P. "Collection of Series for ๐ pi
." http://numbers.computation.free.fr/Constants/Pi/piSeries.html.Guillera, J. "Some Binomial Series Obtained by the WZ-Method." Adv. Appl. Math. 29, 599-603, 2002.Guillera, J. "About a New Kind of Ramanujan-Type Series." Exp. Math. 12, 507-510, 2003.Guillera, J. "Generators of Some Ramanujan Formulas." Ramanujan J. 11, 41-48, 2006.Hardy, G. H. "A Chapter from Ramanujan's Note-Book." Proc. Cambridge Philos. Soc. 21, 492-503, 1923.Hardy, G. H. "Some Formulae of Ramanujan." Proc. London Math. Soc. (Records of Proceedings at Meetings) 22, xii-xiii, 1924.Hardy, G. H. Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work, 3rd ed. New York: Chelsea, 1999.Le Lionnais, F. Les nombres remarquables. Paris: Hermann, 1983.Lucas, S. K. "Integral Proofs that ๐ 355/113>pi
." Austral. Math. Soc. Gaz. 32, 263-266, 2005.MathPages. "Rounding Up to Pi." http://www.mathpages.com/home/kmath001.htm.Plouffe, S. "Identities Inspired from Ramanujan Notebooks (Part 2)." Apr. 2006. http://www.lacim.uqam.ca/~plouffe/inspired2.pdf.Plouffe, S. "A Formula for the ๐ n
'th Decimal Digit or Binary of ๐ pi
and ๐ pi^n
." https://arxiv.org/abs/2201.12601. 29 Jan 2022.Rabinowitz, S. and Wagon, S. "A Spigot Algorithm for the Digits of ๐ pi
." Amer. Math. Monthly 102, 195-203, 1995.Ramanujan, S. "Modular Equations and Approximations to ๐ pi
." Quart. J. Pure. Appl. Math. 45, 350-372, 1913-1914.Sloane, N. J. A. Sequences A054387 and A054388 in "The On-Line Encyclopedia of Integer Sequences."Smith, D. History of Mathematics, Vol. 2. New York: Dover, 1953.Sondow, J. "Problem 88." Math Horizons, pp. 32 and 34, Sept. 1997.Sondow, J. "A Faster Product for ๐ pi
and a New Integral for ๐ ln(pi/2)
." Amer. Math. Monthly 112, 729-734, 2005.Vardi, I. Computational Recreations in Mathematica. Reading, MA: Addison-Wesley, p. 159, 1991.Vieta, F. Uriorum de rebus mathematicis responsorum. Liber VII. 1593. Reprinted in New York: Georg Olms, pp. 398-400 and 436-446, 1970.Wells, D. The Penguin Dictionary of Curious and Interesting Numbers. Middlesex, England: Penguin Books, 1986.Wolfram Research, Inc. "Some Notes On Internal Implementation: Mathematical Constants." http://reference.wolfram.com/language/tutorial/SomeNotesOnInternalImplementation.html.
Referenced on Wolfram|Alpha
Pi FormulasCite this as:
Weisstein, Eric W. "Pi Formulas." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/PiFormulas.html
