32 \(\pi\)
Highlights of this Chapter: we prove that \(\pi\) - defined in our final project as the first zero of the sine function - is the area of the unit circle. We then look at several means of approximating the value of \(\pi\); from computing Riemann sums to integrating power series. In the end, we derive a relatively efficient means of calculating \(\pi\), which gets 15 digits after adding only 22 terms.
32.1 \(\pi\) and the Circle
In the second project, we have defined \(\pi\) as the first zero of the sine function - a definition, and as a final computation in this class, we will show that this is equal to the geometric definition - 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 32.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 4.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.
32.2 Integrals and Inverse Trigonometry
Since \(\pi\) is defined as the half period of the trigonometric functions, we can not hope to get its value as the output of a trigonometric calculation (rather, it lies in the inputs). This signals that it may prove useful to investigate the inverse trigonometric functions. For example, because \(\sin(\pi/2)=1\) we expect \(\arcsin(1)=\pi/2\), and finding a way to numerically approximate \(\arcsin(x)\) at \(x=1\) would yield the value we seek. While we can do this, the sine turns out not to be the best trigonometric function for this purpose, and it is much more productive to investigate the tangent. For practice both are computed below, but feel free to skip the first.
32.2.1 \(\bigstar\) The ArcSine
Thus, we find ourselves interested in calculating these functions. Inspired by our previous treatment of logarithms (where we were able to find the derivative of \(L(x)\) using that it was the inverse of an exponential, without actually knowing a formula for \(L\)) we seek to begin our study of inverse trigonometry via differentiation:
Proposition 32.1 The derivative of the inverse sine function is \[(\arcsin x)^\prime = \frac{1}{\sqrt{1-x^2}}\]
Proof. Let \(f(x)=\arcsin(x)\). Then where defined, \(f(\sin(\theta))=\theta\) by definition, and we may differentiate via the chain rule: on the left side \[\frac{d}{d\theta}f(\sin(\theta))=f^\prime(\sin(\theta))\cos(\theta)\] and on the right \(\frac{d}{d\theta} \theta=1\). Equating these and solving for \(f^\prime\) yields \[f^\prime(\sin(\theta))=\frac{1}{\cos(\theta)}\] The only remaining problem is that we want to know \(f^\prime\) as a function of \(x\) and we only know its value implicitly, as a function of \(\sin(\theta)\). But setting \(x=\sin\theta\) we can express \(\cos\theta = \sqrt{1-x^2}\) via the pythagorean identity \(\sin^2\theta+\cos^2\theta =1\). Thus
\[f^\prime(x)=\frac{1}{\sqrt{1-x^2}}\]
Before integration this would have been a mere curiosity. But, armed wtih the fundamental theorem this is an extremely powerful fact: indeed, it directly gives us a representation as an integral:
Corollary 32.1 The inverse sine function is defined on the interval \([0,1]\) by the integral \[\arcsin(x)=\int_{[0,x]}\frac{1}{\sqrt{1-x^2}}\,dx\]
Proof. Since \((\arcsin x)^\prime =\frac{1}{\sqrt{1-x^2}}\), the inverse sine is an antiderivative of \(\frac{1}{\sqrt{1-x^2}}\), and also \(\sin(0)=0\) implies \(\arcsin(0)=0\), so it is zero at \(x=0\). Thus, it is exactly the area function \[\arcsin(x)=\int_{[0,x]}\frac{1}{\sqrt{1-t^2}}\,dt\]
One may use this to get another integral representation of \(\pi\). Perhaps the most natural thought is to use that \(\sin(\pi/2)=1\), and attempt to claim
\[\frac{\pi}{2}=\arcsin(1)\stackrel{?}{=}\int_{[0,1]}\frac{1}{\sqrt{1-x^2}}\,dx\]
Where there is a question over the equals here to signify we do not actually have the tools to conclude this: the integrand is not defined at \(x=1\), and even though it is continuous on \([0,1)\) it is unbounded on that interval! With more work one can overcome these obstacles (the equality is true) but we are already uninterested
Remark 32.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}}\,dx\]
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.
The same trouble plagues the cosine function, so we turn their ratio - the tangent - to seek something better for computational purposes. In fact, things work out much nicer for the arctangent.
32.2.2 The ArcTangent
Proposition 32.2 \[(\arctan x)^\prime=\frac{1}{1+x^2}\]
Proof. We again proceed by differentiating the identity \(\arctan(\tan\theta)=\theta\). This yields \(\arctan^\prime(\tan\theta)\frac{1}{\cos^2\theta}=1\) and multiplying through by \(\cos^2\) we can solve for the derivative of arctangent: \[\arctan^\prime(\tan\theta)=\cos^2\theta\]
The only problem is again we have the derivative as a function implicitly of of \(\tan\theta\), and we need it in terms of just an abstract variable \(x\). Setting \(x=\tan\theta\) we see that \(x^2=\tan^2\theta\) and (using the pythagorean identity) \(x^2+1=\tan^2\theta+1 =\frac{1}{\cos^2\theta}\). Thus \[\cos^2\theta = \frac{1}{1+x^2}\] and putting these two together, we reach what we are after
\[\arctan^\prime(x)=\frac{1}{1+x^2}\]
Proposition 32.3 The inverse function \(\arctan(x)\) to the tangent \(\tan(x)=\sin(x)/\cos(x)\) admits an integral representation \[\arctan(x)=\int_{[0,x]}\frac{1}{1+t^2}\]
Proof. This follows as \(\arctan^\prime(x)=1/(1+x^2)\), so both \(\arctan\) and this integral have the same derivative. As antiderivatives of the same function this means that they differ by a constant. Finally, this constant is equal to zero as \(\arctan(0)=0\) and \(\int_{[0,0]}\frac{1}{1+x^2}\,dx =0\) as it is an integral over a degenerate interval.
This gives us a much better opportunity to get an explicit formula for \(\pi\). 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 32.2 \[\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 32.1 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*}\]
\[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!
Luckily, the theory we have developed over the semester allows us to do better.
32.3 Series with ArcTan
Instead of trying to evaluate the arctangent integral representation via a Riemann sum, we could attempt to find a power series representation. Like the exponential, we could find such a series via Taylor’s formula, and prove convergence with the Taylor Error formula. But here there is an easier way!
Recall the geometric series \[\frac{1}{1-x}=\sum_{n\geq 0}x^n\]
We can substitute \(-x^2\) for the variable here to get a series for \(1/(1+x^2)\):
\[\frac{1}{1+x^2}=\sum_{n\geq 0}(-x^2)^n=\sum_{n\geq 0}(-1)^nx^{2n}\] \[=1-x^2+x^4-x^6+x^8-\cdots\]
This power series has radius of convergence \(1\) (inherited from the original geometric series) and converges at neither endpoint. We know from the above that this function is the derivative of the arctangent, so we should integrate it!
\[\arctan(x)=\int_{[0,x]}\frac{1}{1+t^2}\,dt = \int_{[0,x]} \sum_{n\geq 0}(-1)^nt^{2n}\,dt\]
Inside its radius of convergence we can exchange the order of the sum and the integral:
\[\begin{align*} \int_{[0,x]} \left(\sum_{n\geq 0}(-1)^nt^{2n}\right)\,dt&=\sum_{n\geq 0}\int_{[0,x]}(-1)^nt^{2n}\,dt\\ &=\sum_{n\geq 0}(-1)^n\int_{[0,x]}t^{2n}dt\\ &=\sum_{n\geq 0}(-1)^n \frac{x^{2n+1}}{2n+1} \end{align*}\]
Theorem 32.2 For \(x\in(0,1)\), \[\arctan(x)=\sum_{n\geq 0}(-1)^n\frac{x^{2n+1}}{2n+1}\] \[=x-\frac{x^3}{3}+\frac{x^5}{5}-\frac{x^7}{7}+\frac{x^9}{9}-\cdots\]
After integrating the series, the result has the same radius of convergence, but now converges at the endpoint \(x=1\) by the Alternating Series Test. Hence, its tempting to write
\[\frac{\pi}{4}=\arctan(1)\stackrel{?}{=}\sum_{n\geq 0}\frac{(-1)^n}{2n+1}\]
But again there’s a pesky question mark over the equals signaling that our theory isn’t actually strong enough to conclude this! We only know that we can switch the sum and integral inside the radius of convergence. At the boundary this doesn’t even make sense, as the original series diverges there!
Remark 32.2. It turns out that it is true - a theorem of Abel guarantees that if a power series converges at a boundary point to its radius of convergence, then it is continuous there. Together with dominated convergence, this lets one compute as \[\begin{align*} \arctan(1)&=\lim_{x\to 1}\arctan(x)\\ &=\lim_{x\to 1}\sum_{n\geq 0}\frac{(-1)^nx^{2n+1}}{2n+1}\\ &=\sum_{n\geq 0}\lim_{x\to 1}\frac{(-1)^nx^{2n+1}}{2n+1}\\ &=\sum_{n\geq 0}\frac{(-1)^n}{2n+1} \end{align*}\]
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.
Instead, like we did for the sine function, we need to seek a different point to evaluate \(\arctan\) (here, inside the radius of convergence). This will make sure our argument is rigorous, and have the added benefit of being much more efficient than the series in the remark above (plugging in any \(x<1\) will have the series converging geometrically - that is, exponentially fast!)
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 32.4 \[\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 32.3 \[\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\).
The End
Example 32.2 (Epilog) 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