# Arctangent series

In mathematics, the arctangent series, traditionally called Gregory's series, is the Taylor series expansion at the origin of the arctangent function:
    $\arctan x=x-{\frac {x^{3}}{3}}+{\frac {x^{5}}{5}}-{\frac {x^{7}}{7}}+\cdots =\sum _{k=0}^{\infty }{\frac {(-1)^{k}x^{2k+1}}{2k+1}}.$
This series converges in the complex disk $|x|\leq 1,$ except for $x=\pm i$ (where $\arctan \pm i=\infty$).
It was first discovered in the 14th century by Indian mathematician Mādhava of Sangamagrāma (c. 1340 – c. 1425), the founder of the Kerala school, and is described in extant works by Nīlakaṇṭha Somayāji (c. 1500) and Jyeṣṭhadeva (c. 1530). Mādhava's work was unknown in Europe, and the arctangent series was independently rediscovered by James Gregory in 1671 and by Gottfried Leibniz in 1673. In recent literature the arctangent series is sometimes called the Mādhava–Gregory series to recognize Mādhava's priority (see also Mādhava series).
The special case of the arctangent of ⁠$1$⁠ is traditionally called the Leibniz formula for π, or recently sometimes the Mādhava–Leibniz formula:
    ${\frac {\pi }{4}}=\arctan 1=1-{\frac {1}{3}}+{\frac {1}{5}}-{\frac {1}{7}}+\cdots .$
The extremely slow convergence of the arctangent series for $|x|\approx 1$ makes this formula impractical per se. Kerala-school mathematicians used additional correction terms to speed convergence. John Machin (1706) expressed ⁠${\tfrac {1}{4}}\pi$⁠ as a sum of arctangents of smaller values, eventually resulting in a variety of Machin-like formulas for ⁠$\pi$⁠. Isaac Newton (1684) and other mathematicians accelerated the convergence of the series via various transformations.

## Proof

If $y=\arctan x$ then $\tan y=x.$ The derivative is
    ${\frac {dx}{dy}}=\sec ^{2}y=1+\tan ^{2}y.$
Taking the reciprocal,
    ${\frac {dy}{dx}}={\frac {1}{1+\tan ^{2}y}}={\frac {1}{1+x^{2}}}.$
This sometimes is used as a definition of the arctangent:
    $\arctan x=\int _{0}^{x}{\frac {du}{1+u^{2}}}.$
The Maclaurin series for x↦arctan$^′$⁡x=1/(1+x$^2$){\textstyle x\mapsto \arctan 'x=1{\big /}\left(1+x^{2}\right)} is a geometric series:
    ${\frac {1}{1+x^{2}}}=1-x^{2}+x^{4}-x^{6}+\cdots =\sum _{k=0}^{\infty }{\bigl{-x^{2}}{\bigr )}{\vphantom}}^{k}.$
One can find the Maclaurin series for $\arctan$ by naïvely integrating term-by-term:
    ${\begin{aligned}\int _{0}^{x}{\frac {du}{1+u^{2}}}&=\int _{0}^{x}\left(1-u^{2}+u^{4}-u^{6}+\cdots \right)du\\[5mu]&=x-{\frac {1}{3}}x^{3}+{\frac {1}{5}}x^{5}-{\frac {1}{7}}x^{7}+\cdots =\sum _{k=0}^{\infty }{\frac {(-1)^{k}x^{2k+1}}{2k+1}}.\end{aligned}}$
While this turns out correctly, integrals and infinite sums cannot always be exchanged in this manner. To prove that the integral on the left converges to the sum on the right for real $|x|\leq 1,$ $\arctan '$ can instead be written as the finite sum,
    ${\frac {1}{1+x^{2}}}=1-x^{2}+x^{4}-\cdots +{\bigl{-x^{2}}{\bigr )}{\vphantom}}^{N}+{\frac {{\bigl{-x^{2}}{\bigr )}^{N+1}}{1+x^{2}}}.$
Again integrating both sides,
    $\int _{0}^{x}{\frac {du}{1+u^{2}}}=\sum _{k=0}^{N}{\frac {(-1)^{k}x^{2k+1}}{2k+1}}+\int _{0}^{x}{\frac {{\bigl{-u^{2}}{\bigr )}^{N+1}}{1+u^{2}}}\,du.$
In the limit as $N\to \infty ,$ the integral on the right above tends to zero when $|x|\leq 1,$ because
    ${\begin{aligned}{\Biggl |}\int _{0}^{x}{\frac {{\bigl{-u^{2}}{\bigr )}^{N+1}}{1+u^{2}}}\,du\,{\Biggr |}\,&\leq \int _{0}^{1}{\frac {u^{2N+2}}{1+u^{2}}}\,du\\[5mu]&<\int _{0}^{1}u^{2N+2}du\,=\,{\frac {1}{2N+3}}\,\to \,0.\end{aligned}}$
Therefore,
    ${\begin{aligned}\arctan x=\sum _{k=0}^{\infty }{\frac {(-1)^{k}x^{2k+1}}{2k+1}}.\end{aligned}}$

## Convergence

The series for arctan$^′${\textstyle \arctan '} and $\arctan$ converge within the complex disk $|x|<1$, where both functions are holomorphic. They diverge for $|x|>1$ because when $x=\pm i$, there is a pole:
    ${\frac {1}{1+i^{2}}}={\frac {1}{1-1}}={\frac {1}{0}}=\infty .$
When $x=\pm 1,$ the partial sums ∑$_{k=0}$$^n$(−x$^2$)$^k${\textstyle \sum _{k=0}^{n}(-x^{2})^{k}} alternate between the values $0$ and $1,$ never converging to the value arctan$^′$⁡(±1)=1/2.{\textstyle \arctan '(\pm 1)={\tfrac {1}{2}}.}
However, its term-by-term integral, the series for arctan, {\textstyle \arctan , } (barely) converges when $x=\pm 1,$ because $\arctan '$ disagrees with its series only at the point $\pm 1,$ so the difference in integrals can be made arbitrarily small by taking sufficiently many terms:
    $\lim _{N\to \infty }\int _{0}^{1}{\biggl{\frac {1}{1+u^{2}}}-\sum _{k=0}^{N}(-u^{2})^{k}{\biggr )}du=0$
Because of its exceedingly slow convergence (it takes five billion terms to obtain 10 correct decimal digits), the Leibniz formula is not a very effective practical method for computing 1/4 π.{\textstyle {\tfrac {1}{4}}\pi .} Finding ways to get around this slow convergence has been a subject of great mathematical interest.

## Accelerated series

Isaac Newton accelerated the convergence of the arctangent series in 1684 (in an unpublished work; others independently discovered the result and it was later popularized by Leonhard Euler's 1755 textbook; Euler wrote two proofs in 1779), yielding a series converging for |x|<∞, {\textstyle |x|<\infty , }
    ${\begin{aligned}\arctan x&={\frac {x}{1+x^{2}}}\sum _{n=0}^{\infty }\prod _{k=1}^{n}{\frac {2k}{2k+1}}\,{\frac {x^{2}}{1+x^{2}}}\\[10mu]&={\frac {x}{1+x^{2}}}+{\frac {2}{3}}{\frac {x^{3}}{(1+x^{2}){\vphantom {l}}^{2}}}+{\frac {2\cdot 4}{3\cdot 5}}{\frac {x^{5}}{(1+x^{2}){\vphantom {l}}^{3}}}+{\frac {2\cdot 4\cdot 6}{3\cdot 5\cdot 7}}{\frac {x^{7}}{(1+x^{2}){\vphantom {l}}^{4}}}+\cdots \\[10mu]&=C(x)\left(S(x)+{\frac {2}{3}}S(x)^{3}+{\frac {2\cdot 4}{3\cdot 5}}S(x)^{5}+{\frac {2\cdot 4\cdot 6}{3\cdot 5\cdot 7}}S(x)^{7}+\cdots \right),\end{aligned}}$
where |C(x)=1/√(1+x$^2$)={\textstyle {\vphantom {\Big |}}C(x)=1{\big /}\!{\sqrt {1+x^{2}}}=}$\cos(\arctan x)$ and |S(x)=x/√(1+x$^2$)={\textstyle {\vphantom {\Big |}}S(x)=x{\big /}\!{\sqrt {1+x^{2}}}=} sin⁡(arctan⁡x).{\textstyle \sin(\arctan x).}
Each term of this modified series is a rational function with its poles at $x=\pm i$ in the complex plane, the same place where the arctangent function has its poles. By contrast, a polynomial such as the Taylor series for arctangent forces all of its poles to infinity.

## History

The earliest person to whom the series can be attributed with confidence is Mādhava of Sangamagrāma (c. 1340 – c. 1425). The original reference (as with much of Mādhava's work) is lost, but he is credited with the discovery by several of his successors in the Kerala school of astronomy and mathematics founded by him. Specific citations to the series for $\arctan$ include Nīlakaṇṭha Somayāji's Tantrasaṅgraha (c. 1500), Jyeṣṭhadeva's Yuktibhāṣā (c. 1530), and the Yukti-dipika commentary by Sankara Variyar, where it is given in verses 2.206 – 2.209.