# Calculus/Leibniz' formula for pi

In mathematics, the Madhava-Leibniz formula for π, was discovered in India by Indian mathematician and astronomer Madhava of Sangamagrama, Kerala in 14th or 15th century. It was rediscovered and named after 17th century mathematician Gottfried Wilhelm Leibniz, states that

an alternating series. While the series is easy to write and calculate, it is a very inefficient method for calculating , so it is seldom used in modern calculations of .

## Proof[edit | edit source]

By the alternating series test, this series converges. It satisfies both of the test's criteria:

- I) The terms decrease monotonically in absolute value.
- II) The terms tend to 0 as the index tends to infinity.

Leibniz' formula for is a special case of the Gregory's series for the arctangent,

,

discovered by mathematician James Gregory in 1668.

Since , and thus, , the formula is derived, and proved, by plugging into Gregory's series.

It is worth noting that lies on the boundary of the circle of convergence for Gregory's series. For , the alternating series fails both criteria: for , the terms *increase* in absolute value, and the terms tend to *infinity*, the opposite of what needs to be true for an alternating series to converge. Even a value of very close to 1, but still greater than it, such as , still lies outside the series' radius of convergence.

## Table[edit | edit source]

The following is a table of the first 10 partial sums and a selected list of other notable partial sums. This series converges to which to 16 significant figures, is 0.7853981633974483. The approximations for itself, found by multiplying the partial sums by four, are also shown. To 16 significant figures, .

Note: The second and third partial sums are exactly and , respectively. Both decimals feature a repeating "6"; for these entries, only the first three sixes are shown, followed by three dots to show that the sixes repeat endlessly. For all later terms, the sums are rounded to 9 digits after the decimal point, or the nearest billionth.

n | Partial Sum | Approximation for pi | |
---|---|---|---|

1 | 1 | 1 | |

2 | 0.666... | 2.666... | |

3 | 0.8666... | 3.4666... | |

4 | 0.723809524 | 2.895238095 | |

5 | 0.834920635 | 3.339682540 | |

6 | 0.744011544 | 2.976046176 | |

7 | 0.820934621 | 3.283738484 | |

8 | 0.754267954 | 3.017071817 | |

9 | 0.813091484 | 3.252365935 | |

10 | 0.760459905 | 3.041839619 | |

11 | 0.808078952 | 3.232315809 | |

12 | 0.764600691 | 3.058402766 | |

50 | 0.780398663 | 3.121594653 | |

100 | 0.782898226 | 3.131592903 | |

250 | 0.784398167 | 3.137592670 | |

500 | 0.784898164 | 3.139592656 | |

1000 | 0.785148163 | 3.140592654 | |

5000 | 0.785348163 | 3.141392654 | |

10000 | 0.785373163 | 3.141492654 | |

25000 | 0.785388163 | 3.141552654 |

### An interesting curiosity[edit | edit source]

You may have noticed that the later partial sums chosen at "round" numbers like 100 or 5000, look very similar to the limiting sums. For example, the partial sum of 3.131592903 at 100 terms, even after disagreeing with "3.14159265..." with a "3" instead of a "4" on the second digit, agrees for the next four digits, sharing the "1592" part. And the partial sum of 3.140592654 at 1000 terms differs on the third digit, but then goes on to agree with pi on the "59265" part. Similar behavior can also be seen in the second column of partial sums, such as the 250th term, which disagrees on the third digit but agrees from the fourth digit to the eighth digit (0.78**4**39816 instead of 0.78**5**39816). This pattern is very consistent throughout the remaining partial sums in the table. This is not an accident. This can be predicted using the Euler numbers. For any positive integer , one can get a very close approximation of the th approximation for with the following formula:

- If is odd, the th approximation for is approximately , and the th partial sum is approximately .
- If is even, the th approximation for is approximately , and the th partial sum is approximately .

The error of this approximation is on the order of so this approximation is remarkably accurate even for relatively small values of . Even after only four terms, the approximation of 0.722898163 predicted by the formula differs from the true partial sum of 0.723809524 by only about , which is less than 10^{−3}. The error is less than 10^{−6} for all and less than 10^{−10} for all .