$$ \newcommand{\RR}{\mathbb{R}} \newcommand{\QQ}{\mathbb{Q}} \newcommand{\CC}{\mathbb{C}} \newcommand{\NN}{\mathbb{N}} \newcommand{\ZZ}{\mathbb{Z}} \newcommand{\FF}{\mathbb{F}} \renewcommand{\epsilon}{\varepsilon} % ALTERNATE VERSIONS % \newcommand{\uppersum}[1]{{\textstyle\sum^+_{#1}}} % \newcommand{\lowersum}[1]{{\textstyle\sum^-_{#1}}} % \newcommand{\upperint}[1]{{\textstyle\smallint^+_{#1}}} % \newcommand{\lowerint}[1]{{\textstyle\smallint^-_{#1}}} % \newcommand{\rsum}[1]{{\textstyle\sum_{#1}}} \newcommand{\uppersum}[1]{U_{#1}} \newcommand{\lowersum}[1]{L_{#1}} \newcommand{\upperint}[1]{U_{#1}} \newcommand{\lowerint}[1]{L_{#1}} \newcommand{\rsum}[1]{{\textstyle\sum_{#1}}} % extra auxiliary and additional topic/proof \newcommand{\extopic}{\bigstar} \newcommand{\auxtopic}{\blacklozenge} \newcommand{\additional}{\oplus} \newcommand{\partitions}[1]{\mathcal{P}_{#1}} \newcommand{\sampleset}[1]{\mathcal{S}_{#1}} \newcommand{\erf}{\operatorname{erf}} $$

35  \(\pi\)

35.1 Area of a Circle

We have defined \(\pi\) as the first zero of the sine function - a definition, but have finally developed enough tools to relate it to the area of a circle. This provides a relationship between the modern, rigorous theory of trigonometric functions and the ancient quest of Archimedes to measure the area of the circle.

Indeed, since we have defined area rigorously with integration, we can now make sense of the area of the circle as long as we can express the unit circle as a function. While this is not directly possible, we can take the implicit equation \(x^2+y^2=1\) and solve for \(y\) giving two functions (one for the top half and one for the bottom). Then we can measure the area of the circle as twice the top half, or

\[\mathrm{Area}=2\int_{[-1,1]}\sqrt{1-x^2}\]

Now we compute this integral with our newfound integration techniques (substitution), and show it equals the half-period of our trigonometric functions in natural units.

Theorem 35.1 \[2\int_{[-1,1]}\sqrt{1-x^2}=\pi\]

Proof. By subsitution, we see that the following two integrals are equal \[\int_{[0,1]}\sqrt{1-x^2}=\int_{I}\sqrt{1-(\sin(t))^2}(\sin(t))^\prime\] Where \(I=[a,b]\) is the interval such that \([\sin(a),\sin(b)]=[0,1]\). Since \(\sin(0)=0\) and \(\sin(\pi/2)=1\) we see \(I=[0,\pi/2]\). Now we focus on simplifying the integrand:

By the Pythagorean identity, \(1-\sin^2(t)=\cos^2(t)\), thus by Example 2.3, \[\sqrt{1-\sin^2(t)}=\sqrt{\cos^2(t)}=|\cos(t)|\] and by definition we recall \((\sin t)^\prime = \cos t\). Thus \[\begin{align*} \int_{[0,\pi/2]}&=\int_{[0,\pi/2]}|\cos(t)|\cos(t)\\ &=\int_{[0,\pi/2]}\cos^2(t) \end{align*}\] Where we can drop the absolute value as \(\cos\) is nonnegative on \([0,\pi/2]\) (its first zero is at half the period, so \(\pi\)). We can simplify this using the “half angle formula” \(\cos^2(x)=(1+\cos(2x))/2\) \[\int_{[0,\pi/2]}\cos^2(t)=\int_{[0,\pi/2]}\frac{1+\cos(2t)}{2}\] Using the linearity of the integral, this reduces to

\[\begin{align*}\int_{[0,\pi/2]}\cos^2(t)&=\frac{1}{2}\int_{[0,\pi/2]}1+\frac{1}{2}\int_{[0,\pi/2]}\cos(2t)\\ &=\frac{\pi}{4}+\frac{1}{2}\int_{[0,\pi/2]}\cos(2t) \end{align*}\]

The first of these integrals could be immediately evaluated as the integral of a constant, but the second requires us to do another substitution. If \(u=2t\) then \[\int_{[0,\pi/2]}\cos(2t)=\frac{1}{2}\int_{[0,\pi]}\cos{u}\]

We recall again that by definition \(\cos u= (\sin u)^\prime\), so by the first fundamental theorem

\[\int_{[0,\pi]}\cos u = \int_{[0,\pi]}\left(\sin u\right)^\prime = \sin u\Big|_{[0,\pi/]}\]

But, \(\sin\) is equal to \(0\) both at \(0\) and \(\pi\)! So after all this work, this integral evaluates to zero. Thus

\[\begin{align*}\int_{[0,1]}\sqrt{1-x^2}&=\int_{[0,\pi/2]}\cos^2 t\\ &=\frac{\pi}{4}+\frac{1}{2}\int_{[0,\pi]}\cos(2t)\\ &=\frac{\pi}{4}+0 \end{align*}\]

Now, we are ready to assemble the pieces. Because \(x^2\) is an even function so is \(\sqrt{1-x^2}\), and so its integral over \([-1,1]\) is twice its integral over \([0,1]\). Thus

\[\mathrm{Area} = 2\int_{[-1,1]}\sqrt{1-x^2}=4\int_{[0,1]}\sqrt{1-x^2}=4\frac{\pi}{4}=\pi\]

This single result ties together so many branches of analysis, and proves a worthy capstone calculation for the course. However after all this work we shouldn’t let ourselves be satisfied too quickly! Now that we have related the area of a circle to trigonometry, we can hope to use other techniques from analysis to accurately calculate its value.

35.2 Calculating \(\pi\)’s Value

35.2.1 From the Area Integral

Having proven that \(\pi\) is the area of the circle, we may attempt to estimate its value by estimating the integral of \(\sqrt{1-x^2}\):

\[\frac{\pi}{4}=\int_{[0,1]}\sqrt{1-x^2}\]

Using the evenly spaced partition \(P_n\) with \(n\) bars of width \(\Delta=1/n\) and the fact that \(\sqrt{1-x^2}\) is monotone decreasing on \([0,1]\), we can evaluate this integral as a limit of upper sums:

\[\int_{[0,1]}\sqrt{1-x^2}=\lim U(\sqrt{1-x^2},P_n)=\sum_{i=1}^n\sqrt{1-(i\Delta)}\Delta\]

Simplifying gives an explicit limit of sums to compute:

Example 35.1 The following limit of infinite sums converges to \(\pi\). \[\pi= \lim 4\sum_{i=1}^n\sqrt{1-\frac{i^2}{n^2}}\frac{1}{n}=\lim 4\sum_{i=1}^n \frac{\sqrt{n^2-i^2}}{n^2}\]

This series is difficult to compute because it involves square roots: irrational quantities that we will also have to approximate in order to get a good approximate value for \(\pi\). It also converges slowly, so there’s many square roots to approximate! Using a computer to help we find

\[4\sum_{i=1}^{10}\frac{\sqrt{100-i^2}}{100}\approx 2.904\ldots\] \[4\sum_{i=1}^{100}\frac{\sqrt{10000-i^2}}{10000}\approx 3.120\ldots\] \[4\sum_{i=1}^{1000}\frac{\sqrt{1000000-i^2}}{1000000}\approx 3.139\ldots\]

35.2.2 From Inverse Trigonometry

One may use the inverse trigonometric functions to get integral representations of \(\pi\). Perhaps the most natural thought is to use that \(\sin(\pi/2)=1\), so \(\arcsin(1)=\pi/2\) or

\[\frac{\pi}{2}=\arcsin(1)=\int_{[0,1]}\frac{1}{\sqrt{1-x^2}}\]

This integral is improper as the integrand becomes unbounded in a neighborhood of \(x=1\): thus it must be calculated as a limit over intervals \([0,t]\) with \(t\to 1\) which is rather difficult in practice: certainly more involved than the calculation from the area integral above.

Remark 35.1. If we were not bothered by the square roots for our computation-focused goals, one could easily replace the problematic integral above with something avoiding its problems. For instance, since \(\sin(\pi/4)=1/\sqrt{2}\), we have

\[\frac{\pi}{4}=\int_{[0,1/\sqrt{2}]}\frac{1}{\sqrt{1-x^2}}\]

But this is much worse in terms of square roots: if you write out a Riemann sum here it’ll be a sum of nested roots, and still more complicated than the estimate from the area integral.

The same trouble plagues the cosine function, but things get much nicer with the tangent. We know that \(\sin\) and \(\cos\) are equal when evaluated at \(\pi/4\), which means their ratio is \(1=\tan\pi/4\). Inverting this,

Corollary 35.1 \[\frac{\pi}{4}=\arctan(1) = \int_{[0,1]}\frac{1}{1+x^2},dx\]

This function is integrable (its continuous), so we can compute its value as the limit of any shrinking sequence of Riemann sums. Below is an explicit example, given for evenly spaced partitions sampled at their right endpoints.

Example 35.2 The following infinite series converges to \(\pi\): \[\begin{align*}\pi&=\lim_{n}4\sum_{i=1}^n\frac{1}{1+(i\Delta)^2}\Delta\\ &=\lim_{n}4\sum_{i=1}^n\frac{n}{n^2+i^2} \end{align*}\]

This sequence of sums is much better to work with: each term is a rational number, so it can be computed exactly, giving a sequence of better and better rational approximations to \(\pi\).

\[4\sum_{i=1}^{10}\frac{10}{100+i^2}\approx 3.0395\ldots\] \[4\sum_{i=1}^{100}\frac{100}{10000+i^2}\approx 3.13155\ldots\] \[4\sum_{i=1}^{1000}\frac{1000}{1000000+i^2}\approx 3.140592\ldots\] \[4\sum_{i=1}^{1000000}\frac{1000000}{(1000000)^2+i^2}\approx 3.14159165359\ldots\]

This is great - these sums are trivial to do on a computer (I did these in a simple python for loop) and get us an accurate value for \(\pi\). But we shouldn’t be satisfied just yet! First of all, these sums take a while to converge - we need a thousand terms to get the first two digits after the decimal, and a million to get the first five!

35.2.3 From Series

Power series are much easier to deal with than the limits arising from integrals: to get a better approximation of a power series you keep the terms you have, and just add more whereas to compute better approximate Riemann sums you need to start all over from scratch! Thus its certainly advantageous from a computational perspective to look for series converging to \(\pi\).

A particularly nice example is given by the arctangent, whose series we computed in Theorem 34.1 to be \(\sum_{n\geq 0}(-1)^n\frac{x^{2n+1}}{2n+1}\) on the interval \((-1,1)\). Since \(\tan(\pi/4)=1\), we can calculate \(\pi\) as \(\pi/4=\arctan(1)\), which lies right at the boundary of the interval of convergence. Luckily, this proves not to be an issue

Proposition 35.1 \[\frac{\pi}{4}=\arctan(1)=\sum_{n\geq 0}\frac{(-1)^n}{2n+1}\]

Proof. The arctangent function is continuous on \(\RR\), so

\[\arctan(1)=\arctan(\lim_{x\to 1^-}x)=\lim_{x\to 1^-}\arctan(x)\]

For \(x\in(-1,1)\) the arctangent can be expressed as a power series, so

\[\lim_{x\to 1^-}\arctan(x)=\lim_{x\to 1^-}\sum_{n\geq 0}(-1)^n\frac{x^{2n+1}}{2n+1}\]

This series converges at \(x=\pm 1\) by the alternating series test. Hence, by Abel’s theorem (Theorem 20.4) it defines a continuous function on \([-1,1]\) and so the limit can be pulled inside:

\[\begin{align*} \lim_{x\to 1^-}\sum_{n\geq 0}(-1)^n\frac{x^{2n+1}}{2n+1}&=\sum_{n\geq 0 }(-1)^n\frac{(\lim_{x\to 1^-}x)^{2n+1}}{2n+1}\\ &= \sum_{n\geq 0}(-1)^n\frac{1^{2n+1}}{2n+1}\\ &=\sum_{n\geq 0}(-1)^n\frac{1}{2n+1} \end{align*}\]

Putting this all together yields the claim:

\[\frac{\pi}{4}=\arctan(1)=\sum_{n\geq 0}\frac{(-1)^n}{2n+1}\]

This formula is exceedingly beautiful, and worthy of writing out without summation notation to take in

\[\frac{\pi}{4}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}-\cdots\]

However, way out here at the endpoint the series converges very slowly. Using a computer to do a little experimenting:

\[4\sum_{n=0}^{10}\frac{(-1)^n}{2n+1}=3.2323\ldots\] \[4\sum_{n=0}^{100}\frac{(-1)^n}{2n+1}=3.1549\ldots\] \[4\sum_{n=0}^{1,000}\frac{(-1)^n}{2n+1}=3.1425\ldots\]

Like the Riemann sum approach, we needed a thousand terms to get the first two decimals right. This problem only occurs as we are evaluating a series at the very boundary of its interval of convergence: we know via comparison that power series converge exponentially quickly within their radius of convergence, so to get better behavior we should seek a point inside \((-1,1)\) at which the arctan will give us information aboout \(\pi\). How do we find such a value? Here’s one clever possibility: we actually realize \(\pi/4\) as the sum of two different arctangent values:

Proposition 35.2 \[\frac{\pi}{4}=\arctan\left(\frac{1}{2}\right)+\arctan\left(\frac{1}{3}\right)\]

Proof. Let \(\theta = \arctan(1/2)\) and \(\psi = \arctan(1/3)\). Now use the tangent addition law \(\tan(\theta +\psi)=\frac{\tan\theta +\tan\psi}{1-\tan\theta\tan\psi}\) to compute \(\theta+\psi\):

\[ \tan(\theta+\psi)=\frac{\frac{1}{2}+\frac{1}{3}}{1-\frac{1}{2}\frac{1}{3}}= \frac{\frac{5}{6}}{1-\frac{1}{6}}= 1 \]

Thus, \(\tan(\theta+\psi)=1\) so \(\theta+\psi=\pi/4\), as claimed.

Now, both \(1/2\) and \(1/3\) lie well within the radius of convergence of the arctangent, so we can add the two together to get a formula for \(\pi\). Since series converge absolutely within their radii of convergence, we can re-arrange terms as we please, even combining the two into a single sum:

Theorem 35.2 \[\frac{\pi}{4}=\sum_{k\geq 0}\frac{(-1)^k}{(2k+1)2^{2k+1}}+\sum_{n\geq 0}\frac{(-1)^k}{(2k+1)3^{2k+1}}\] \[=\sum_{k\geq 0 }\frac{(-1)^k}{2k+1}\left(\frac{1}{2^{2k+1}}+\frac{1}{3^{2k+1}}\right)\]

This series converges very quickly, as the exponents \(2^{2k+1}\) and \(3^{2k+1}\) in the denominators grow rapidly. Indeed, summing up to N = TWO already gives the first two decimal digits!

\[\left(\frac{1}{2}+\frac{1}{3}\right)-\frac{1}{3}\left(\frac{1}{8}+\frac{1}{27}\right)+\frac{1}{5}\left(\frac{1}{32}+\frac{1}{243}\right)=3.14558\]

Using up until \(N=10\) terms in this series gives the approximation \[\pi \approx 3.14159257960635\] Which is correct to 7 decimal digits. To get 15 significant digits using 22 terms in this series is enough!

This is truly a marvelous machine we have built - conjuring directly from the lowly geometric series an efficient formula for \(\pi\).

Example 35.3 Want to be even more clever? In 1796 John Machin showed the following identity:

\[\frac{\pi}{4}=4\arctan(1/5)-\arctan(1/239)\]

Note: If you wish to prove this, probably the easiest way is to notice that \((5 + i)^4(239−i) =−114244(1 + i)\) and use the polar form of complex numbers to get the result. See here: https://people.math.sc.edu/howard/Classes/555c/trig.pdf

This allows you to compute π to five or six decimals without much trouble. Just using the first five terms in the series gives \(\pi\approx 3.14159268240440\) so we are already good to seven decimals. Using nine terms in the series gives you 15 significant digits