---
tag: 2703AZH0B6
kind: proof
name: Proof of the Leibniz formula for pi by integrating a finite geometric sum
msc: [40A05]
proves: 037FD5NBRT
uses: [0PK8QH1W1V, 0C1VYVNV2N, 065XW2V6C3, 06T0HS14PP, 0WB57D9488, 028XEQCE88, 00KAFBR32E, 00R4MWW532, 0BARQY52N5, 05P4B4Q22V, 07ZMX4ANJS, 06SESV7GQY, 0XYAFCN0PT, 05APWSX53S, 080RWVVSB6, 0Q3HYFT9RQ, 0MBWQKM8QR, 0XKWSSY8P2]
sources:
  - url: https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80
    locator: Proof 1
---

## Proof

Let $s_N = \sum_{n=0}^{N} \frac{(-1)^n}{2n+1}$ be the partial sums.

1. The numbers $b_n = 1/(2n+1)$ are positive, decreasing, and tend to $0$. By the [[alternating series test|0PK8QH1W1V]], the series converges.
2. We compute $\arctan 1$. By the definition of [[pi|0C1VYVNV2N]], $\pi/2$ is the only zero of $\cos$ in $[0, 2]$. Also $\pi/2 \ne 0$, since $\cos 0 = 1$ by the definition of [[sine and cosine|0WB57D9488]].
3. The function $\cos$ is continuous and $\cos 0 = 1 > 0$. If $\cos x \le 0$ for some $x \in [0, \pi/2)$, the [[intermediate value theorem|00KAFBR32E]] would give a zero of $\cos$ in $(0, x]$. This zero would lie in $[0, 2]$ and differ from $\pi/2$, which is impossible. So $\cos x > 0$ on $[0, \pi/2)$.
4. By the [[mean value theorem|0BARQY52N5]] and the [[derivative of sine|00R4MWW532]], $\sin(\pi/4) - \sin 0 = \frac{\pi}{4} \cos \xi$ for some $\xi \in (0, \pi/4)$. By step 3 this is positive, and $\sin 0 = 0$, so $\sin(\pi/4) > 0$.
5. By the [[angle addition formulas|028XEQCE88]], $0 = \cos(\pi/2) = \cos^2(\pi/4) - \sin^2(\pi/4)$. Since $\sin(\pi/4)$ and $\cos(\pi/4)$ are both positive, they are equal.
6. So $\tan(\pi/4) = 1$, by the definition of the [[tangent function|06T0HS14PP]]. Since $\pi/4 \in (-\pi/2, \pi/2)$, the definition of the [[arctangent|065XW2V6C3]] gives $\arctan 1 = \pi/4$.
7. Also $\tan 0 = \sin 0 / \cos 0 = 0$, so $\arctan 0 = 0$.
8. The arctangent is differentiable with derivative $1/(1+x^2)$, by the [[derivative of arctangent|05P4B4Q22V]]. So it is [[continuous|07ZMX4ANJS]]. Its derivative is a quotient of continuous functions with $1 + x^2 > 0$, so it is continuous, hence [[Riemann integrable|06SESV7GQY]] on $[0, 1]$.
9. By the [[second fundamental theorem of calculus|0XYAFCN0PT]] and steps 6 and 7,
$$\int_0^1 \frac{dt}{1 + t^2} = \arctan 1 - \arctan 0 = \frac{\pi}{4}.$$
10. Let $n \ge 1$ and $t \in [0, 1]$. Apply the [[sum of a finite geometric series|05APWSX53S]] with $r = -t^2 \ne 1$. It gives $\sum_{k=0}^{n-1} (-1)^k t^{2k} = \frac{1 - (-1)^n t^{2n}}{1 + t^2}$.
11. Rearranging step 10 gives
$$\frac{1}{1 + t^2} = \sum_{k=0}^{n-1} (-1)^k t^{2k} + (-1)^n \frac{t^{2n}}{1 + t^2}.$$
12. All functions in step 11 are continuous on $[0,1]$, hence integrable. By [[linearity of the integral|080RWVVSB6]] and the [[integral of a power|0Q3HYFT9RQ]], $\int_0^1 t^{2k}\, dt = \frac{1}{2k+1}$. Integrating step 11 over $[0, 1]$ and using step 9 gives
$$\frac{\pi}{4} = s_{n-1} + (-1)^n R_n, \qquad R_n = \int_0^1 \frac{t^{2n}}{1 + t^2}\, dt.$$
13. For $t \in [0, 1]$, $0 \le \frac{t^{2n}}{1 + t^2} \le t^{2n}$. By [[monotonicity of the integral|0MBWQKM8QR]] and the integral of a power, $0 \le R_n \le \frac{1}{2n+1}$.
14. By steps 12 and 13, $\abs{\pi/4 - s_{n-1}} = R_n \le \frac{1}{2n+1}$ for every $n \ge 1$.
15. Let $\varepsilon > 0$, and take $n_0$ with $1/(2n_0 + 1) < \varepsilon$. For $N \ge n_0 - 1$, step 14 with $n = N + 1$ gives $\abs{\pi/4 - s_N} \le 1/(2N+3) < \varepsilon$.
16. So $s_N \to \pi/4$ by the definition of the [[limit|0XKWSSY8P2]]. Hence $1 - \frac13 + \frac15 - \frac17 + \cdots = \frac{\pi}{4}$.

## Idea

Since $\arctan' = 1/(1+t^2)$, the number $\pi/4 = \arctan 1$ is the integral of $1/(1+t^2)$ over $[0,1]$. Expanding $1/(1+t^2)$ as a finite geometric sum in $-t^2$ plus a remainder, and integrating term by term, gives a partial sum of the series. The remainder integral is at most $1/(2n+1)$, so it tends to $0$.
