nav.gif (1245 bytes)creative memory improvement

Ken Ward's Mathematics Pages

Various Machin Formula

Section Contents

Page Contents

  1. The Machin Formula
  2. Finding a candidate formula
  3. Computing the Second Tangent
  4. Terms For 14 Decimal Places

The Machin Formula

John Machin (1680-1751) is distinguished as an influential mathematician, who contributed to Newton's work, and gave Taylor the insight on what is now known as Taylor's Theorem.

Machin's pi formula is:
machinFormula1.gif [1.1]

The starting point is the Gregory Series, by which the arctans are calculated:
machinFormula2.gif [1.2]
The class of formulae, of which the Machin is probably the best, is:
machinFormula3.gif [1.3]

Naturally, as there are 4 unknowns, we need to do some trial and error.

Finding a candidate formula

This is not the way that Machin discovered his formula. It is a way to search for candidate formula of this kind, which need to be verified by working out the formula using vulgar fractions to preserve absolute accuracy.
Because many of these formulae were to be used with pencil and paper, the easier numbers are to be preferred. We therefore, consider that pi/4 is about 0.78, which is about 41/5. This means we can take m=4 and a=1/5. We can also take n=1, for the first try and then do some trigonometry to solve the equation.

So 2.1 below is a candidate formula:
machinFormula4.gif [2.1]
We need to solve this equation in one unknown (b).

Computing the Second Tangent

machinFormula5.gif [2.2]

Substituting in 2.1 and rearranging:
machinFormula.gif [2.3]

Take tangents both sides:
machinFormula6.gif [2.4]

Using the tan(A-B) formula,
machinFormula7.gif [2.5]
We note the formula for tan2θ:
machinFormula8.gif [2.6]

From 2.2 we know that tanθ=1/5. Substituting in 2.6, we get:
machinFormula9.gif [2.7]

We note the formula for tan4θ:

And substitute tan2θ in 2.8:
machinFormula10.gif  [2.9]
Substituting this value for tan4θ, and tan(π/4)=1  in 2.5
machinFormula7.gif [2.5, repeated]

We get:
machinFormula12.gif [2.10]

Noting that arctan(-1/239)=-arctan(1/239), and substituting the latter into our equation
machinFormula4.gif [2.1, repeated]

We obtain the Machin Formula:
machinFormula1.gif [1.1, repeated]

Terms For 14 Decimal Places

The number of terms required for 4 decimals accuracy with the Machin is 4 (k=3). Compare this with the Gregory Series with x=1, which is 10,000 (ignoring rounding errors).

The Machin Formula:
Is composed of two arctans, and we can see that the first will converge more slowly than the second. We therefore seek the number of terms for the first to be accurate to 14 decimal places, ignoring rounding errors. The general term for the first arctan is: machin14dec1.gif [3.1]

The maximum error in the sum of an alternativing and converging series, such as the Gregory Series is no greater than the value of the first omitted term in the series.

Writing k+1=p, for convenience, and ignoring the sign, because it does not affect value of the error, we seek a term such that:
machin14dec2.gif [3.2]
This will be the first term we can omit. We require 14 decimals, so need to be accurate to 0.000000000000005 or 1/(21014)

Multiplying throughout by p:
machin14dec3.gif [3.3]
Take logs:

Substituting x=1/5, log(16)=1.204, log(0.2)=.301 in 3.4:
machin14dec5.gif [3.5]
Which gives:
machin14dec6.gif [3.6]
Multiplying throughout by -1:
machin14dec7.gif [3.7]

Ignoring logp, as being small compared with p, p≅22 (22.182).
2k+1≅22, k=10.5, say 11 (because it must be an integer)

As this is the first omitted terms, then the last k we need to compute is k=10, which means we need 11 terms, approximately (The correct answer is k=9, and we need 10 terms).

We can be more accurate by transforming 3.7 to :
f(p)=machin14dec8.gif [3.8]

When p=22, 3.8 is 1.22, which means it might be too big. Just choosing p=20, f(20)=-0.22, which means it is too small. Writing this in the table below, and taking the differences between the values:

p f(p) (16xp)/p Required
20 -0.22 8x10-15 5x10-15
22 1.22 3x10-16 5x10-15
Difference 2 1.44

Using simply proportion x:2::0.22:1.44, or x=0.31, say 1. So we take p=21.

2k+1=21, k=10, and this is the first omitted term, so our k=9, and the number of terms is 10. We note that this is the maximum error!

π3.14159265358984 3.14159265358979

Ken Ward's Mathematics Pages

Faster Arithmetic - by Ken Ward

Ken's book is packed with examples and explanations that enable you to discover more than 150 techniques to speed up your arithmetic and increase your understanding of numbers. Paperback and Kindle:
Buy now at
Faster Arithmetic for Adults