De formule van Leibniz is een heel inefficiënte maar makkelijke manier om π te berekenen.
\(\tan{\theta}\) is gedefinieerd als \(\frac{\sin(\theta)}{\cos(\theta)}\).
De afgeleide, \(\frac{d\tan(\theta)}{d\theta}\) is
\(\frac{\cos(\theta)\sin'(\theta)-\cos'(\theta)\sin(\theta)}{\cos^2(\theta)}=\frac{\cos^2(\theta)+\sin^2(\theta)}{\cos^2(\theta)}=1+\tan^2(\theta)\).
De inverse van \(\tan(\theta)\) is \(\arctan(x)\), dus als \(x =\tan(\theta)\), dan is \(\theta=\arctan(x)\).
De afgeleide van \(\arctan(x)\), namelijk \(\frac{d\arctan(x)}{dx}\), ook wel \(\frac{d\theta}{d\tan(\theta)}\) blijkt gelijk te zijn aan de afgeleide van \(\tan(\theta)\) tot de macht min-één,
ofwel \(\frac{1}{1+\tan^2(\theta)}\) ofwel \(\frac{1}{1+x^2}\). De primitieve van \(\frac{1}{1+x^2}\) is dus \(\arctan(x)\).
\(\int_0^a\frac{1}{1+x^2}dx=\arctan(a)-\arctan(0)=\arctan(a)\).
Toevallig kun je \(\frac{1}{1+x^2}\) ook schrijven als een convergerende somrij, mits \(|−x^2|<1\).
\(\frac{1}{1+x^2}=1-x^2+x^4-x^6+x^8\dots\)
Aangezien links en rechts hetzelfde staat, maar anders opgeschreven, zijn de integraal van links en die van rechts ook gelijk.
\(\int_0^a\frac{1}{1+x^2}dx=\int_0^a 1-x^2+x^4-x^6+x^8\dots dx\), met als voorwaarde dat \(a<1\).
\(\arctan(a)=a-\frac{a^3}{3}+\frac{a^5}{5}-\frac{a^7}{7}+\frac{a^9}{9}\dots\)
Nu hoef je het alleen nog maar voor \(a=1\) in te vullen, omdat \(\arctan(1)=\frac{\pi}{4}\), want \(\tan\left(\frac{\pi}{4}\right)=1\).
Probleem: \(a\) was gedefinieerd als \(<1\). Dit kan worden opgelost door de limiet te nemen als \(a\to 1\).
\(\frac{\pi}{4}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}\dots\)