Rational approximations to π

This is a nice way to calculate π. Consider a 30-60-90 triangle in a unit circle. The acute angle, as shown in the diagram, is π/6 radians and its sine is x=1/2. The approximations come from a Maclaurin series for this angle developed around x=0.

The successive non-zero terms in the series give 3, 3+1/8, 3+89/640, 3+5059/35840...


Unit circle and triangle for development of successive rational approximations to π

Start with the implicit derivative based on the relationship between x and θ.

sin θ = x cos θ = dx dx = 1 cosθ = 1 1-x2

The first two terms of the Maclaurin series are

θ = sin-1(0) + [ 1 1-x2 ]x=0x +

Evaluating these two terms with θ=π/6 and x=1/2, we get π3. More accurate rational approximations follow with each additional term in the Maclaurin series. For the next derivative, we have

d2θ dx2 = x (1-x2)3/2

This derivative vanishes when we set x to zero, so it makes no contribution. The next approximation comes from the next derivative.

d3θ dx3 = 1 (1-x2)3/2 + 3x2 (1-x2)5/2

This third derivative is one when evaluated at x equals zero. So to this order, the Maclaurin series is

θ = x + x36 +

Now we approximate π at this order

π 6 12 + 148 π 258

The even derivatives are all odd in x. Only the odd derivatives will contribute. The next odd derivative is

d5θ dx5 = 9 (1-x2)5/2 + 90x2 (1-x2)7/2 + 105x4 (1-x2)9/2

This derivative evaluated at x=0 is 9. For the next term in the series we have

θ = x + x36 + 9x5 5! +

The next rational approximation to π is

π 6 12 + 148 + 31280 π 2009640

This rational number gives us a value of 3.1390625. The next odd derivative is

d7θ dx7 = 225 (1-x2)7/2 + 4725x2 (1-x2)9/2 + 14175x4 (1-x2)11/2 + 10395x6 (1-x2)13/2

This derivative is 225 and the series becomes

θ = x + x36 + 9x5 5! + 225x7 7! +

The corresponding rational approximation to π is

π 6 12 + 148 + 31280 + 514336 π 3+505935840

So to this order, we have π3.1412, compared to the precise value rounded to this number of digits, 3.1416.

The derivatives become tedious, but we find the next one to be 11025 such that the series is

θ = x + x36 + 9x5 5! + 225x7 7! + 11025x9 9! +

The following approximation gives 3.1415 when rounded to four decimal places.

The derivatives get tedious by hand so I wrote a short program to calculate them to higher order. The eleventh derivative is 893,025, which gives an approximation of 3.14158. The thirteenth derivative is 108,056,025 and the corresponding approximation is 3.14159. The fifteenth derivative is 18,261,468,225. Its accurate approximation is 3.141592, a few parts in ten million from the true value. The seventeenth derivative is about four trillion and the value becomes 3.1415925. The twenty first derivative gives us 3.14159265. (!)