Madhava's correction term

Madhava's correction term is a mathematical expression attributed to Madhava of Sangamagrama (c. 1340 – c. 1425), the founder of the Kerala school of astronomy and mathematics, that can be used to give a better approximation to the value of the mathematical constant $\pi$ (pi) than the partial sum approximation obtained by truncating the Madhava–Leibniz infinite series for π. The Madhava–Leibniz infinite series for π is


 * $$\frac{\pi}{4}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+ \cdots$$

Taking the partial sum of the first $$n$$ terms we have the following approximation to π:


 * $$\frac{\pi}{4} \approx 1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+ \cdots + (-1)^{n-1}\frac{1}{2n-1}$$

Denoting the Madhava correction term by $$F(n)$$, we have the following better approximation to π:


 * $$\frac{\pi}{4} \approx 1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+ \cdots + (-1)^{n-1}\frac{1}{2n-1} + (-1)^n F(n)$$

Three different expressions have been attributed to Madhava as possible values of $$F(n)$$, namely,


 * $$F_1(n)=\frac{1}{4n}$$
 * $$F_2(n)=\frac{n}{4n^2+1}$$
 * $$F_3(n)=\frac{n^2+1}{4n^3+5n}$$

In the extant writings of the mathematicians of the Kerala school there are some indications regarding how the correction terms $$F_1(n)$$ and $$F_2(n)$$ have been obtained, but there are no indications on how the expression $$F_3(n)$$ has been obtained. This has led to a lot of speculative work on how the formulas might have been derived.

Correction terms as given in Kerala texts
The expressions for $$F_2(n)$$ and $$F_3(n)$$ are given explicitly in the Yuktibhasha, a major treatise on mathematics and astronomy authored by the Indian astronomer Jyesthadeva of the Kerala school of mathematics around 1530, but that for $$F_1(n)$$ appears there only as a step in the argument leading to the derivation of $$F_2(n)$$.

The Yuktidipika–Laghuvivrthi commentary of Tantrasangraha, a treatise written by Nilakantha Somayaji an astronomer/mathematician belonging to the Kerala school of astronomy and mathematics and completed in 1501, presents the second correction term in the following verses (Chapter 2: Verses 271–274):


 * Madhava Correction Terms 1 and 2.jpg

English translation of the verses:


 * "To the diameter multiplied by 4 alternately add and subtract in order the diameter multiplied by 4 and divided separately by the odd numbers 3, 5, etc. That odd number at which this process ends, four times the diameter should be multiplied by the next even number, halved and [then] divided by one added to that [even] number squared. The result is to be added or subtracted according as the last term was subtracted or added. This gives the circumference more accurately than would be obtained by going on with that process."

In modern notations this can be stated as follows (where $$d$$ is the diameter of the circle):


 * Circumference $$ = 4d - \frac{4d}{3} + \frac{4d}{5}- \cdots \pm \frac{4d}{p}  \mp \frac{ 4d\left(p+1\right) / 2 }{1 + (p+1)^2}$$

If we set $$p=2n-1$$, the last term in the right hand side of the above equation reduces to $$4d F_2(n)$$.

The same commentary also gives the correction term $$F_3(n)$$ in the following verses (Chapter 2: Verses 295–296):


 * Madhava Correction Term 3.jpg

English translation of the verses:


 * "A subtler method, with another correction. [Retain] the first procedure involving division of four times the diameter by the odd numbers, 3, 5, etc. [But] then add or subtract it [four times the diameter] multiplied by one added to the next even number halved and squared, and divided by one added to four times the preceding multiplier [with this] multiplied by the even number halved."

In modern notations, this can be stated as follows:



\text{Circumference} = 4d - \frac{4d}3 + \frac{4d}5 - \cdots \pm \frac{4d}p \mp \frac{4dm}{\left(1 + 4m\right)(p+1)/2},$$

where the "multiplier" $m = 1 + \left((p+1)/2\right)^2.$ If we set $$p=2n-1$$, the last term in the right hand side of the above equation reduces to $$4d F_3(n)$$.

Accuracy of the correction terms
Let


 * $$s_i = 1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+ \cdots + (-1)^{n-1}\frac{1}{2n-1} + (-1)^n F_i(n)$$.

Then, writing $$p=2n+1$$, the errors $$\left|\frac{\pi}{4}-s_i(n)\right|$$ have the following bounds:


 * $$\begin{align}&\begin{align}

\frac{1} {p^3 - p} - \frac{1} {(p+2)^3-(p+2)} &< \left| \frac{\pi}{4}-s_1(n)\right| < \frac{1}{p^3 - p}, \\[10mu] \frac{4}{p^5 + 4p} - \frac{4}{(p+2)^5+4(p+2)} &< \left| \frac{\pi}{4}-s_2(n)\right| < \frac{4}{p^5 +4 p }, \end{align}\\[20mu] &\begin{align} &\frac{36}{p^7+7p^5+28p^3-36p} - \frac{36}{(p+2)^7+7(p+2)^5+28(p+2)^3-36(p+2)} \cdots \\[10mu] &\phantom{\frac{4}{p^5 + 4p} - \frac{4}{(p+2)^5+4(p+2)}} < \left| \frac{\pi}{4}-s_3(n)\right| < \frac{36}{p^7+7p^5+28p^3-36p}. \end{align}\end{align}

$$

Numerical values of the errors in the computation of π
The errors in using these approximations in computing the value of π are


 * $$E(n) = \pi - 4\left( 1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+ \cdots + (-1)^{n-1}\frac{1}{2n-1} \right)$$
 * $$E_i(n) = E(n) - 4\times (-1)^n F_i(n)$$

The following table gives the values of these errors for a few selected values of $$n$$.

Continued fraction expressions for the correction terms
It has been noted that the correction terms $$F_1(n), F_2(n), F_3(n)$$ are the first three convergents of the following continued fraction expressions:


 * $$ \cfrac{1}{4n + \cfrac{1}{n + \cfrac{1}{n + \cdots}}} $$


 * $$ \cfrac{1}{4n + \cfrac{1^2}{  n + \cfrac{2^2}{ 4n + \cfrac{3^2}{ n + \cfrac{\cdots}{\cdots + \cfrac{r^2}{ n[4 - 3(r \bmod 2)] +\cdots}}}}}}= \cfrac{1}{4n + \cfrac{2^2}{4n + \cfrac{4^2}{4n + \cfrac{6^2}{4n + \cfrac{8^2}{4n +\cdots}}}}}$$

The function $$f(n)$$ that renders the equation
 * $$ \frac{\pi}{4} = 1 - \frac{1}{3}+\frac{1}{5} - \cdots \pm \frac{1}{n} \mp f(n+1)$$

exact can be expressed in the following form:


 * $$ f(n) = \frac{1}{2}\times \cfrac{1}{ n + \cfrac{1^2}{n + \cfrac{2^2}{ n + \cfrac{3^2}{n + \cdots}}}}$$

The first three convergents of this infinite continued fraction are precisely the correction terms of Madhava. Also, this function $$f(n)$$ has the following property:


 * $$f(2n) = \cfrac{1}{4n + \cfrac{2^2}{4n + \cfrac{4^2}{4n + \cfrac{6^2}{4n + \cfrac{8^2}{4n +\cdots}}}}}$$

Speculative derivation by Hayashi et al.
In a paper published in 1990, a group of three Japanese researchers proposed an ingenious method by which Madhava might have obtained the three correction terms. Their proposal was based on two assumptions: Madhava used $$355/113$$ as the value of π and he used the Euclidean algorithm for division.

Writing


 * $$ S(n) = \left| 1 - \frac{1}{3} +\frac{1}{5}-\frac{1}{7}+ \cdots +\frac{(-1)^{n-1}}{2n-1} - \frac{\pi}{4}\right|$$

and taking $$\pi=355/113,$$ compute the values $$S(n),$$ express them as a fraction with 1 as numerator, and finally ignore the fractional parts in the denominator to obtain approximations:


 * $$\begin{alignat}{3}

S(1) &= \ \ \,\frac{97}{452} &&= \ \ \ \frac{1}{4 + \frac{64}{97}} &&\approx \frac{1}{4},  \\[6mu] S(2) &= \ \ \frac{161}{1356} &&= \ \ \,\frac{1}{8 + \frac{68}{161}} &&\approx \frac{1}{8}, \\[6mu] S(3) &= \ \ \frac{551}{6780} &&= \ \,\frac{1}{12 +\frac{168}{551}} &&\approx \frac{1}{12}, \\[6mu] S(4) &= \ \frac{2923}{47460} &&= \ \frac{1}{16 +\frac{ 692}{2923}} &&\approx \frac{1}{16}, \\[6mu] S(5) &= \frac{21153}{427140} &&= \frac{1}{20 +\frac{ 4080}{21153}} &&\approx \frac{1}{20}. \end{alignat}$$

This suggests the following first approximation to $$S(n)$$ which is the correction term $$F_1(n)$$ talked about earlier.


 * $$ S(n) \approx \frac{1}{4n}$$

The fractions that were ignored can then be expressed with 1 as numerator, with the fractional parts in the denominators ignored to obtain the next approximation. Two such steps are:


 * $$\begin{alignat}{5}

\frac{64}{97}        &= \ \,\frac{1}{1 + \frac{33}{64}} &&\approx \frac{1}{1}, & \frac{33}{64}        &= \,\frac{1}{1 + \frac{31}{33}}   &&\approx \frac{1}{1}, \\[6mu] \frac{68}{161}       &= \ \,\frac{1}{2 + \frac{25}{68}} &&\approx \frac{1}{2}, & \frac{25}{68}        &= \,\frac{1}{2 + \frac{18}{25}}   &&\approx \frac{1}{2}, \\[6mu] \frac{168}{551}      &= \ \frac{1}{3 + \frac{47}{168}}  &&\approx \frac{1}{3}, & \frac{47}{168}       &= \,\frac{1}{3 + \frac{27}{47}}   &&\approx \frac{1}{3}, \\[6mu] \frac{ 692}{2923}      &= \frac{1}{4 + \frac{155}{692}}   &&\approx \frac{1}{4}, & \frac{155}{692}      &= \frac{1}{4 + \frac{72}{155}}    &&\approx \frac{1}{4}, \\[6mu] \frac{4080}{21153}   &= \frac{1}{5 + \frac{753}{4080}}  &&\approx \frac{1}{5}, &\quad \frac{753}{4080} &= \frac{1}{5 + \frac{315}{753}}  &&\approx \frac{1}{5}. \end{alignat}$$

This yields the next two approximations to $$S(n),$$ exactly the same as the correction terms $$F_2(n),$$


 * $$S(n)\approx \frac{1}{4n+\dfrac{1}{n}} = \frac{n}{4n^2+1},$$

and $$F_3(n),$$


 * $$ S(n) \approx \dfrac{1}{4n + \dfrac{1}{n+\dfrac{1}{n}}} = \frac{n^2+1}{n(4n^2+5)},$$

attributed to Madhava.