# Ken Ward's Mathematics Pages

## Various Machin Formula

Section Contents

### 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:
[1.1]

The starting point is the Gregory Series, by which the arctans are calculated:
[1.2]
The class of formulae, of which the Machin is probably the best, is:
[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 4·1/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:
[2.1]
We need to solve this equation in one unknown (b).

### Computing the Second Tangent

[2.2]

Substituting in 2.1 and rearranging:
[2.3]

Take tangents both sides:
[2.4]

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

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

We note the formula for tan4θ:
[2.8]

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

We get:
[2.10]

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

We obtain the Machin Formula:
[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: [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:
[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/(2·1014)

Multiplying throughout by p:
[3.3]
Take logs:
[3.4]

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

Ignoring logp, as being small compared with p, p≅22 (22.182).
Therefore,
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)= [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!

 k 8 9 π 3.14159 3.14159

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: