29 min read

For five chapters you have built machinery and waited for it to pay off. Chapter 20 made sequences rigorous; Chapter 21 turned them into series; Chapter 22 handed you a toolkit of convergence tests; Chapter 23 gave you the crown jewel — Taylor...

Prerequisites

  • chapter-23-power-and-taylor-series

Learning Objectives

  • Derive Euler's formula from the Taylor series of e^x, sin x, cos x
  • State and appreciate Euler's identity e^{i pi} + 1 = 0
  • Preview Fourier series — periodic functions decomposed into sines and cosines
  • Recognize the Basel problem and Euler's solution
  • Identify probability generating functions and their uses

Chapter 24 — Applications of Series: From Calculation to Cosmology

24.1 The Payoff Chapter

For five chapters you have built machinery and waited for it to pay off. Chapter 20 made sequences rigorous; Chapter 21 turned them into series; Chapter 22 handed you a toolkit of convergence tests; Chapter 23 gave you the crown jewel — Taylor series, the idea that a function can be an infinite polynomial. Each of those chapters ended with a promise: this will matter. This is the chapter where it matters.

We are going to use infinite series to derive results that look like magic until you see the calculus underneath. The headline is Euler's identity,

$$e^{i\pi} + 1 = 0,$$

which Richard Feynman called "the most remarkable formula in mathematics." It welds together five fundamental constants — $e$, $i$, $\pi$, $1$, and $0$ — using nothing but addition, multiplication, and exponentiation. It looks like a riddle. By the end of Section 24.3 you will be able to prove it in four lines, using only the Taylor series you already know.

That is the emotional center of Part IV, and it deserves to be treated as such. But it is not an isolated trick. The same series machinery explains how your calculator finds $\sin 40°$, why every sound can be broken into pure tones, how Euler summed $1 + \tfrac14 + \tfrac19 + \cdots$ to a number nobody expected, and how probabilists encode an entire random variable in a single power series. This chapter is a tour of where infinite series actually live in science — and they live nearly everywhere.

The Key Insight. The exponential, sine, and cosine functions look like three unrelated curves. Their Taylor series reveal that they are three faces of one function — the complex exponential. Once you see that, Euler's identity is not a coincidence to be memorized but a consequence to be derived.

Three of our recurring themes run straight through this chapter: approximation is the soul of calculus (every transcendental value here is computed by truncating a series), geometry and algebra are inseparable (the complex exponential turns rotation into arithmetic), and calculus appears in every quantitative field (signal processing, number theory, probability, and physics all show up below). This chapter is also the climax of our fourth anchor example, Euler's formula, first hinted at back in Chapter 11.

24.2 The Setup: Three Series and One Bold Substitution

Recall the three Maclaurin series from Chapter 23. Each converges for every real number $x$ — their radius of convergence is infinite, which we proved with the ratio test in Chapter 22.

$$e^{x} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots = \sum_{n=0}^\infty \frac{x^n}{n!},$$

$$\sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots = \sum_{n=0}^\infty \frac{(-1)^n x^{2n+1}}{(2n+1)!},$$

$$\cos x = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \cdots = \sum_{n=0}^\infty \frac{(-1)^n x^{2n}}{(2n)!}.$$

Stare at these for a moment before we do anything clever. The exponential series uses every power of $x$ with all-positive coefficients $1/n!$. The sine series uses only the odd powers, with alternating signs. The cosine series uses only the even powers, again alternating. So $e^x$ contains all the terms that $\sin x$ and $\cos x$ contain — but the signs are wrong, and the odd/even pieces have been separated out.

The natural question — the one Euler asked — is: can we recover the alternating signs? What if we fed the exponential series an argument that, when raised to powers, produced the pattern $+,+,-,-,+,+,-,-$? There is exactly one such number, and you have known it since algebra: the imaginary unit $i$, with $i^2 = -1$.

Math Major Sidebar — Why we are allowed to substitute $i$. Substituting a complex number into a real power series is not a free move; it needs justification. The clean version: define $e^z$, $\sin z$, $\cos z$ for complex $z$ by their power series. Because each series converges absolutely for all real $x$ (Chapter 22), it converges absolutely for all complex $z$ with $|z|$ equal to any real value — the ratio test does not care whether the terms are real or complex, only about their magnitudes. Absolute convergence is exactly the property that lets us rearrange and regroup terms without changing the sum (Chapter 22's discussion of conditional vs. absolute convergence). So the manipulations below are rigorous, not merely suggestive. The full theory belongs to a course in complex analysis, but the convergence facts you already own are enough to make the derivation honest.

24.3 Euler's Formula

Substitute $x = i\theta$ into the exponential series, where $\theta$ is a real number:

$$e^{i\theta} = 1 + (i\theta) + \frac{(i\theta)^2}{2!} + \frac{(i\theta)^3}{3!} + \frac{(i\theta)^4}{4!} + \frac{(i\theta)^5}{5!} + \cdots.$$

Everything hinges on the powers of $i$, which cycle with period four:

$$i^0 = 1, \quad i^1 = i, \quad i^2 = -1, \quad i^3 = -i, \quad i^4 = 1, \quad i^5 = i, \quad \ldots$$

So $(i\theta)^n = i^n \theta^n$ runs through the pattern $\theta^0,\ i\theta^1,\ -\theta^2,\ -i\theta^3,\ \theta^4,\ i\theta^5,\ -\theta^6,\ \ldots$. Substituting term by term:

$$e^{i\theta} = 1 + i\theta - \frac{\theta^2}{2!} - i\frac{\theta^3}{3!} + \frac{\theta^4}{4!} + i\frac{\theta^5}{5!} - \frac{\theta^6}{6!} - i\frac{\theta^7}{7!} + \cdots.$$

Now comes the move that absolute convergence licenses: group the terms with $i$ separately from those without. The terms without $i$ are the even powers; the terms with $i$ are the odd powers:

$$e^{i\theta} = \underbrace{\left(1 - \frac{\theta^2}{2!} + \frac{\theta^4}{4!} - \frac{\theta^6}{6!} + \cdots\right)}_{\text{real part}} + i\underbrace{\left(\theta - \frac{\theta^3}{3!} + \frac{\theta^5}{5!} - \frac{\theta^7}{7!} + \cdots\right)}_{\text{imaginary part}}.$$

But we have seen both of those series before. The real part is exactly the Maclaurin series for $\cos\theta$. The imaginary part is exactly the Maclaurin series for $\sin\theta$. Therefore

$$\boxed{\,e^{i\theta} = \cos\theta + i\sin\theta.\,}$$

This is Euler's formula, published by Leonhard Euler in 1748 in his Introductio in analysin infinitorum. It is one of the great unifications in all of mathematics: the exponential function and the two basic trigonometric functions are revealed as the same object, just sorted into real and imaginary halves.

Geometric Intuition. Picture the complex plane, with the real axis horizontal and the imaginary axis vertical. The point $e^{i\theta} = \cos\theta + i\sin\theta$ has coordinates $(\cos\theta, \sin\theta)$ — which is precisely the point on the unit circle at angle $\theta$. So as $\theta$ increases, $e^{i\theta}$ marches counterclockwise around the unit circle at constant speed, completing one lap every $2\pi$. The exponential function, fed an imaginary argument, does not grow — it rotates. That single picture explains why oscillation (circular motion, waves, alternating current) and exponentials (growth, decay) are secretly the same phenomenon viewed along different axes.

Check Your Understanding. Using Euler's formula, what is $e^{i\theta}$ when $\theta = \pi/2$? Where does it sit in the complex plane?

Answer$e^{i\pi/2} = \cos(\pi/2) + i\sin(\pi/2) = 0 + i\cdot 1 = i$. It sits one unit straight up the imaginary axis — exactly the point on the unit circle at a quarter turn ($90°$) counterclockwise from $1$. So multiplying by $e^{i\pi/2} = i$ rotates any complex number by a quarter turn, which is the geometric meaning of $i$.

24.4 Euler's Identity: The Climax

Now set $\theta = \pi$. Geometrically, you are walking exactly halfway around the unit circle, from the point $1$ on the right to the point $-1$ on the left. Euler's formula says:

$$e^{i\pi} = \cos\pi + i\sin\pi = -1 + i\cdot 0 = -1.$$

Add $1$ to both sides:

$$\boxed{\,e^{i\pi} + 1 = 0.\,}$$

This is Euler's identity, and it is worth pausing over. It contains the five most important constants in mathematics, each arriving from a completely different province of the subject:

  • $e \approx 2.71828$, the base of natural growth, born from calculus and compound interest (Chapter 11);
  • $\pi \approx 3.14159$, the ratio of a circle's circumference to its diameter, born from geometry;
  • $i$, the imaginary unit with $i^2 = -1$, born from algebra and the demand that every polynomial have a root;
  • $1$, the multiplicative identity, and $0$, the additive identity — the two foundations of arithmetic.

It binds them with three operations — addition, multiplication, exponentiation — and an equals sign, with no extra clutter. Nothing is wasted. A poll of mathematicians conducted by David Wells in 1990 ranked it the most beautiful theorem in mathematics, and it has held that informal title ever since.

Historical Note. Euler (1707–1783) was the most prolific mathematician in history; the modern notation $e$, $i$, $f(x)$, $\Sigma$, and much of trigonometry's symbolism is his. He published Euler's formula in 1748, though special cases were known earlier (Roger Cotes had a logarithmic version by 1714). Euler did most of this work while progressively going blind — he was completely blind for the last seventeen years of his life and yet produced nearly half his output during that time, dictating to assistants. He once remarked that losing his sight would mean "fewer distractions."

What makes the identity genuinely profound, rather than merely pretty, is that it is true and provable, not a poetic flourish. The derivation you just read — three Taylor series, one substitution, one regrouping — is the whole proof. There is no sleight of hand. As Benjamin Peirce reportedly told his students after deriving it, "Gentlemen, that is surely true, it is absolutely paradoxical; we cannot understand it, and we don't know what it means, but we have proved it, and therefore we know it must be the truth."

Common Pitfall. Students sometimes read $e^{i\pi} = -1$ and conclude that $i\pi = \ln(-1)$ is the logarithm of $-1$, then try to manipulate it like a real logarithm — for instance writing $\ln(-1) = \tfrac12\ln(1) = 0$, a contradiction. The trap is that the complex exponential is not one-to-one: $e^{i\pi} = e^{3i\pi} = e^{-i\pi} = -1$, because adding any multiple of $2\pi i$ to the exponent lands you back at the same point on the unit circle. So the complex logarithm is multi-valued; $\ln(-1) = i\pi + 2\pi i k$ for every integer $k$. The familiar log laws are not safe in the complex world without care. Treat $e^{i\pi} = -1$ as a statement about one specific rotation, not an invitation to do real-variable algebra.

24.5 Striking Consequences

Euler's formula is not a museum piece — it is a working tool. Here are four immediate payoffs.

Other special values

Setting $\theta = \pi/2$ gave us $e^{i\pi/2} = i$. Raise both sides to the power $i$:

$$i^i = \left(e^{i\pi/2}\right)^i = e^{i \cdot i \cdot \pi/2} = e^{-\pi/2} \approx 0.20788.$$

This is one of the most disorienting facts in elementary mathematics: the imaginary unit raised to the imaginary power is a real number. (As the pitfall above warns, $i^i$ is multi-valued — $e^{-\pi/2 + 2\pi k}$ for each integer $k$ — but $e^{-\pi/2}$ is its principal value.)

Polar form of complex numbers

Every nonzero complex number $z$ can be written in polar form:

$$z = r\,e^{i\theta} = r(\cos\theta + i\sin\theta),$$

where $r = |z|$ is the modulus (distance from the origin) and $\theta = \arg z$ is the argument (angle from the positive real axis). Polar form turns multiplication into something almost trivial:

$$z_1 z_2 = r_1 r_2\, e^{i(\theta_1 + \theta_2)}.$$

Moduli multiply; arguments add. Multiplying complex numbers rotates and scales — a fact that is opaque in rectangular form $a + bi$ but obvious once you write things as $r e^{i\theta}$. We will lean on exactly this geometry when we reach polar coordinates in Chapter 26.

A direct corollary is de Moivre's formula, which falls out of raising $e^{i\theta}$ to the $n$th power:

$$(\cos\theta + i\sin\theta)^n = \left(e^{i\theta}\right)^n = e^{in\theta} = \cos(n\theta) + i\sin(n\theta).$$

Trigonometric identities for free

Many trig identities that once required clever diagrams become two-line algebra. Take the addition formulas. Start from $e^{i(\alpha+\beta)} = e^{i\alpha}e^{i\beta}$ and expand both sides with Euler's formula:

$$\cos(\alpha+\beta) + i\sin(\alpha+\beta) = (\cos\alpha + i\sin\alpha)(\cos\beta + i\sin\beta).$$

Multiply out the right-hand side and collect real and imaginary parts:

$$= \big(\cos\alpha\cos\beta - \sin\alpha\sin\beta\big) + i\big(\sin\alpha\cos\beta + \cos\alpha\sin\beta\big).$$

Matching real parts and imaginary parts gives both addition formulas at once:

$$\cos(\alpha+\beta) = \cos\alpha\cos\beta - \sin\alpha\sin\beta, \qquad \sin(\alpha+\beta) = \sin\alpha\cos\beta + \cos\alpha\sin\beta.$$

The Pythagorean identity is even faster: $|e^{i\theta}|^2 = e^{i\theta}\,\overline{e^{i\theta}} = e^{i\theta}e^{-i\theta} = e^0 = 1$, and since $|e^{i\theta}|^2 = \cos^2\theta + \sin^2\theta$, we get $\cos^2\theta + \sin^2\theta = 1$ instantly. Every trigonometric identity is, at heart, a statement about complex exponentials in disguise.

Sine and cosine are exponentials

Adding and subtracting $e^{i\theta} = \cos\theta + i\sin\theta$ and $e^{-i\theta} = \cos\theta - i\sin\theta$ solves for the trig functions themselves:

$$\cos\theta = \frac{e^{i\theta} + e^{-i\theta}}{2}, \qquad \sin\theta = \frac{e^{i\theta} - e^{-i\theta}}{2i}.$$

These two formulas are the gateway to all of Fourier analysis, because they let us trade messy sines and cosines for clean exponentials whenever we integrate.

Real-World Application — Electrical engineering (AC circuits). Engineers analyze alternating-current circuits using phasors: a voltage $V\cos(\omega t + \phi)$ is written as the real part of $V e^{i\phi} e^{i\omega t}$. Because differentiating $e^{i\omega t}$ just multiplies by $i\omega$, the calculus of inductors and capacitors collapses into algebra with complex numbers. The entire theory of impedance — why a capacitor "leads" and an inductor "lags" — is Euler's formula applied to circuits. Every power grid on Earth is designed with this trick.

24.6 How Calculators Actually Compute $\sin$, $\cos$, and $e^x$

Here is a question most people never ask: when you type $\sin(40°)$ into a calculator, how does it know the answer? There is no lookup table large enough to store every angle. The honest answer is that the machine evaluates a series — and this is the most quietly important application of Part IV in your daily life, used billions of times per second across the planet.

The naive approach: Taylor truncation

The most direct method is to truncate a Taylor series. To compute $\sin x$, the machine first uses periodicity and symmetry to reduce $x$ to a small angle near $0$ (say, in $[-\pi/4, \pi/4]$), where the series converges fast. Then it sums a handful of terms:

$$\sin x \approx x - \frac{x^3}{6} + \frac{x^5}{120} - \frac{x^7}{5040}.$$

The alternating series error bound from Chapter 22 tells the machine exactly when to stop: the error after a partial sum is no larger than the first omitted term. For $|x| \le \pi/4 \approx 0.785$, four or five terms already deliver double-precision (16-digit) accuracy. Range reduction first, then a short series — that is the recipe behind most software math libraries.

CORDIC: when you have no multiplier

Early calculators and many embedded chips could not multiply quickly — they only had hardware to add, subtract, and shift bits. For these, engineers invented CORDIC (COordinate Rotation DIgital Computer, Volder, 1959). The idea is pure Euler's formula: to compute $\cos x$ and $\sin x$, rotate the vector $(1, 0)$ through the angle $x$. CORDIC builds that rotation as a sum of progressively smaller fixed rotations $\arctan(2^{-k})$, each of which costs only a shift and an add because $\tan$ of those angles is a power of two. The running coordinates converge to $(\cos x, \sin x)$. It is the unit-circle picture of Section 24.3 turned into an algorithm that needs no multiplication at all.

Computational Note. Production math libraries rarely use a raw Taylor series in the end. They use minimax polynomials — polynomials of the same low degree whose coefficients are tuned (by the Remez algorithm) to minimize the worst-case error across the whole reduced interval, rather than just the error near $x = 0$ where Taylor is best. A degree-7 minimax polynomial for $\sin$ can beat a degree-11 Taylor polynomial on $[-\pi/4, \pi/4]$. The idea is still "approximate a transcendental function by a polynomial" — Chapter 23's central theme — but engineering squeezes out the last bits of accuracy by not insisting the polynomial match the derivatives at a single point.

Let us verify the truncated-series idea directly.

# Compute sin(x) from its truncated Taylor series and compare to the library value.
import numpy as np
from math import factorial

def sin_series(x: float, n_terms: int = 6) -> float:
    """Sum the first n_terms of the Maclaurin series for sin x."""
    total = 0.0
    for k in range(n_terms):
        term = (-1)**k * x**(2*k + 1) / factorial(2*k + 1)
        total += term
    return total

x = np.radians(40)            # reduce 40 degrees to radians ~ 0.6981
print(f"series  sin(40 deg) = {sin_series(x):.12f}")   # 0.642787609687
print(f"numpy   sin(40 deg) = {np.sin(x):.12f}")        # 0.642787609687
print(f"abs error           = {abs(sin_series(x) - np.sin(x)):.2e}")  # ~1e-13

Six terms of a series you derived by hand reproduce the calculator to thirteen digits. That is not a coincidence; it is essentially what the calculator did.

A graduated worked example — bounding the error before you compute it. Suppose you must guarantee $\sin(0.5)$ to within $10^{-9}$ and you want to know in advance how many terms suffice. Because $\sin x$ is an alternating series, Chapter 22's alternating-series error bound applies: the error after stopping at the term $\pm x^{2k+1}/(2k+1)!$ is no larger than the magnitude of the next term. With $x = 0.5$, the term $x^{7}/7! = 0.5^7/5040 \approx 1.55\times 10^{-6}$ is too big, but $x^{9}/9! = 0.5^9/362880 \approx 5.4\times 10^{-9}$ is almost there, and $x^{11}/11! \approx 1.2\times 10^{-11} < 10^{-9}$. So summing through the $x^9$ term — five terms total — provably meets the tolerance, no trial and error required. This is the three-rigor-levels pattern in miniature: intuitively "more terms means more accuracy," computationally "here is the partial sum," and formally "here is a proof that the error is below $10^{-9}$." The machine carries that proof inside its stopping rule.

24.7 A Preview of Fourier Series

Taylor series approximate a function near a single point using its derivatives there. Fourier series do something complementary: they represent a periodic function over its whole period as a sum of sines and cosines. Where Taylor series are local, Fourier series are global; where Taylor uses polynomials, Fourier uses waves.

For a function $f$ with period $2\pi$, the Fourier series is

$$f(x) = \frac{a_0}{2} + \sum_{n=1}^\infty \big(a_n \cos(nx) + b_n \sin(nx)\big),$$

with coefficients computed by integration (this is where Chapter 14's integral calculus reappears):

$$a_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\cos(nx)\,dx, \qquad b_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\sin(nx)\,dx.$$

Using the exponential forms from Section 24.5, the whole thing compresses into the elegant complex Fourier series

$$f(x) = \sum_{n=-\infty}^{\infty} c_n\, e^{inx}, \qquad c_n = \frac{1}{2\pi}\int_{-\pi}^{\pi} f(x)\, e^{-inx}\,dx,$$

which is a "power series in $e^{ix}$" rather than in $x$ — Euler's formula working quietly behind the scenes.

A worked example: the square wave

Take the square wave: $f(x) = +1$ on $(0, \pi)$ and $f(x) = -1$ on $(-\pi, 0)$, repeating with period $2\pi$. This is an odd function, so all the cosine coefficients $a_n$ vanish and only sines survive. Computing the integrals gives a beautiful result:

$$f(x) = \frac{4}{\pi}\left(\sin x + \frac{\sin 3x}{3} + \frac{\sin 5x}{5} + \frac{\sin 7x}{7} + \cdots\right) = \frac{4}{\pi}\sum_{k=0}^{\infty}\frac{\sin\big((2k+1)x\big)}{2k+1}.$$

A jagged, discontinuous step function equals an infinite sum of perfectly smooth sine waves. Add the first few harmonics and you watch a wobbly approximation sharpen into corners.

# Build a square wave from its first few Fourier harmonics.
import numpy as np

x = np.linspace(-np.pi, np.pi, 1000)
approx = np.zeros_like(x)
for k in range(8):                       # 8 odd harmonics: sin x, sin 3x, ...
    n = 2*k + 1
    approx += np.sin(n * x) / n
approx *= 4 / np.pi

# Check the value near the middle of the +1 plateau (x = pi/2):
mid = approx[np.argmin(np.abs(x - np.pi/2))]
print(f"8-harmonic approximation at x=pi/2: {mid:.4f}")  # ~0.99 -> approaching +1

Warning — the Gibbs phenomenon. No matter how many harmonics you add, the Fourier partial sums overshoot by about $9\%$ right next to each jump discontinuity, in a stubborn little spike. This is the Gibbs phenomenon, and it does not go away as $n \to \infty$ — the overshoot's height stays roughly constant even as its width shrinks to zero. At the jump itself, the series converges to the average of the left and right values (here, $0$), not to either side. Fourier convergence is genuine but subtle: it holds in the mean-square ($L^2$) sense for any square-integrable function, while pointwise behavior at discontinuities needs the careful statement above. The full theory is a course beyond calculus — but the seed is right here.

Real-World Application — Signal processing and compression. Fourier series and their discrete cousin, the Fast Fourier Transform (FFT) (Cooley–Tukey, 1965), are the foundation of modern digital media. MP3 audio compression transforms sound into its frequency spectrum, then discards the frequencies the human ear cannot perceive. JPEG images apply a two-dimensional cosine transform to $8\times 8$ pixel blocks and keep only the dominant coefficients. MRI scanners collect raw data in the frequency domain ("k-space") and inverse-transform it into an anatomical image. Every one of these technologies rests on the idea that a complicated signal is a sum of simple waves — the idea you just previewed.

24.8 The Basel Problem

In 1734, a young Euler solved a problem that had defeated the best mathematicians of Europe for ninety years — including the Bernoulli family, who lived in Basel, lending the problem its name. The question is disarmingly simple: what is the exact value of

$$\sum_{n=1}^{\infty} \frac{1}{n^2} = 1 + \frac{1}{4} + \frac{1}{9} + \frac{1}{16} + \frac{1}{25} + \cdots\,?$$

That this series converges was never in doubt — it is a $p$-series with $p = 2 > 1$ (Chapter 22). Numerically it crawls toward about $1.6449$. But what is that number? Nobody could say. Euler's answer stunned the mathematical world:

$$\boxed{\,\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6} \approx 1.644934.\,}$$

A circle constant — $\pi$ — appears in a sum of reciprocal squares, even though no circle was anywhere in the question. Where did $\pi$ come from? The answer, as so often in this chapter, is Taylor series.

A sketch of Euler's argument

Euler's reasoning was audacious and, by modern standards, not yet rigorous — but it was correct, and it is gorgeous. Start from the Maclaurin series for $\sin x$ and divide by $x$:

$$\frac{\sin x}{x} = 1 - \frac{x^2}{3!} + \frac{x^4}{5!} - \cdots = 1 - \frac{x^2}{6} + \frac{x^4}{120} - \cdots.$$

Now Euler made his leap. A polynomial can be factored from its roots: if $p(x)$ has roots $r_1, r_2, \ldots$ and $p(0) = 1$, then $p(x) = \prod(1 - x/r_k)$. Euler treated $\frac{\sin x}{x}$ as though it were an infinite-degree polynomial and factored it from its roots. The zeros of $\sin x$ sit at $x = \pm\pi, \pm 2\pi, \pm 3\pi, \ldots$ (the value at $x = 0$ is $1$, not a root, which is why we divided by $x$). Pairing each positive root with its negative partner gives

$$\frac{\sin x}{x} = \prod_{n=1}^{\infty}\left(1 - \frac{x^2}{n^2\pi^2}\right).$$

Now compare the coefficient of $x^2$ on both sides. On the left, the Taylor series tells us that coefficient is $-\tfrac{1}{6}$. On the right, multiplying out the product, the only way to produce an $x^2$ term is to take the $-\,x^2/(n^2\pi^2)$ factor from exactly one bracket and the $1$ from all the others, then sum over which bracket we chose:

$$\text{coefficient of } x^2 = -\sum_{n=1}^{\infty}\frac{1}{n^2\pi^2}.$$

Setting the two expressions for the $x^2$ coefficient equal:

$$-\frac{1}{6} = -\sum_{n=1}^{\infty}\frac{1}{n^2\pi^2} = -\frac{1}{\pi^2}\sum_{n=1}^{\infty}\frac{1}{n^2}.$$

Multiply through by $-\pi^2$ and the result drops out: $\displaystyle\sum_{n=1}^{\infty}\frac{1}{n^2} = \frac{\pi^2}{6}.$ $\blacksquare$

Math Major Sidebar — Was that legal? Not quite, as written. Euler assumed that an infinite-degree "polynomial" can be factored from its roots exactly like a finite one — but a function like $e^x \cdot \frac{\sin x}{x}$ has the same roots while differing by an exponential factor, so roots alone do not determine the product. Euler's specific factorization happens to be the correct one, and he checked it against numerical evidence to many digits, but justifying it requires the Weierstrass factorization theorem from complex analysis, proved over a century later. There are now fully rigorous proofs of the Basel result by other routes (Fourier series of $f(x)=x^2$, double integrals, or the residue calculus). Euler's argument is a model of mathematics as discovery — the intuition that finds the truth, with rigor following behind to certify it.

# Numerically confirm the Basel sum approaches pi^2 / 6.
import numpy as np

N = 1_000_000
partial = np.sum(1.0 / np.arange(1, N + 1)**2)
print(f"partial sum (N=1e6) = {partial:.6f}")   # 1.644933
print(f"pi^2 / 6            = {np.pi**2/6:.6f}") # 1.644934

Check Your Understanding. The Basel sum converges, but slowly. Roughly how many terms does it take to get the value right to two decimal places, and why so slow?

AnswerThe tail of $\sum 1/n^2$ beyond term $N$ is about $\int_N^\infty x^{-2}\,dx = 1/N$ (the integral-test comparison from Chapter 22). To make the error smaller than $0.005$ you need roughly $N > 1/0.005 = 200$ terms. It is slow because the terms only decay like $1/n^2$; this is exactly why Euler's closed form $\pi^2/6$ is so valuable — it gives infinitely many digits with no summation at all.

The door it opened: the Riemann zeta function

The Basel problem is the first nontrivial value of a function that became central to all of modern number theory, the Riemann zeta function:

$$\zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^s}.$$

Euler did not stop at $\zeta(2)$. Using the same sine-product idea on higher coefficients, he evaluated $\zeta$ at every even positive integer:

$$\zeta(2) = \frac{\pi^2}{6}, \quad \zeta(4) = \frac{\pi^4}{90}, \quad \zeta(6) = \frac{\pi^6}{945}, \quad \zeta(8) = \frac{\pi^8}{9450}, \quad \ldots$$

with a general formula involving the Bernoulli numbers. For the odd arguments, astonishingly, no closed form is known to this day — even $\zeta(3)$, called Apéry's constant, was only proved irrational in 1979, and whether it is a "nice" multiple of $\pi^3$ remains unknown. Euler also discovered the spectacular Euler product, which links the zeta function to the prime numbers:

$$\zeta(s) = \prod_{p \text{ prime}} \frac{1}{1 - p^{-s}}.$$

Riemann later extended $\zeta(s)$ to complex arguments, and the conjecture that all its nontrivial zeros lie on the line $\operatorname{Re}(s) = \tfrac12$ — the Riemann hypothesis — is the most famous unsolved problem in mathematics, with a million-dollar prize attached. Every bit of it traces back to a 27-year-old summing reciprocal squares with a Taylor series.

24.9 Computing $\pi$ from Series

The same arctangent series that hides $\pi$ inside Section 24.8 can be turned into a machine for computing $\pi$. From Chapter 23,

$$\arctan x = x - \frac{x^3}{3} + \frac{x^5}{5} - \frac{x^7}{7} + \cdots, \qquad |x| \le 1.$$

Evaluate at $x = 1$, where $\arctan 1 = \pi/4$:

$$\frac{\pi}{4} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \frac{1}{9} - \cdots.$$

This is the Leibniz series for $\pi$. It is beautiful and almost useless: it converges so slowly (by the alternating-series bound, the error after $N$ terms is about $1/(2N)$) that you need five hundred terms just for two correct decimals. The fix is to evaluate $\arctan$ at small arguments, where the series races to convergence, and combine the pieces. Machin's formula (1706) is the classic:

$$\frac{\pi}{4} = 4\arctan\frac{1}{5} - \arctan\frac{1}{239}.$$

Because $1/5$ and $1/239$ are small, both arctangent series converge quickly, and Machin's formula was used to set hand-computed $\pi$ records for two centuries. Modern record computations into the trillions of digits use the Chudnovsky algorithm, a ferociously fast series that delivers about 14 correct digits per term — but its DNA is the same: a cleverly chosen series for a transcendental constant.

24.10 Probability Generating Functions

Power series also encode randomness. Let $X$ be a random variable taking non-negative integer values, with $P(X = n) = p_n$. Its probability generating function (PGF) packs the entire distribution into one power series:

$$G(s) = \sum_{n=0}^{\infty} p_n s^n = E\!\left[s^X\right].$$

The sequence of probabilities $p_0, p_1, p_2, \ldots$ becomes the sequence of coefficients — a single function now carries the whole distribution. Three properties make PGFs powerful:

  • $G(1) = 1$, because $\sum p_n = 1$ (the probabilities must sum to one).
  • $G'(1) = E[X]$: differentiate term by term and set $s = 1$ to read off the mean. This is Chapter 23's term-by-term differentiation of power series, applied to probability.
  • $G_{X+Y}(s) = G_X(s)\,G_Y(s)$ for independent $X$ and $Y$: the PGF of a sum is the product of the PGFs. Convolving distributions becomes multiplying polynomials — a massive simplification.

Worked example — the Poisson distribution. A Poisson random variable with rate $\lambda$ has $p_n = e^{-\lambda}\lambda^n/n!$. Its PGF is

$$G(s) = \sum_{n=0}^\infty e^{-\lambda}\frac{\lambda^n}{n!}\,s^n = e^{-\lambda}\sum_{n=0}^\infty \frac{(\lambda s)^n}{n!} = e^{-\lambda}\,e^{\lambda s} = e^{\lambda(s-1)},$$

where the middle step recognizes the exponential series — the very series we started this chapter with. From this one compact formula, the mean falls out immediately: $G'(s) = \lambda e^{\lambda(s-1)}$, so $G'(1) = \lambda = E[X]$. The variance comes out just as easily, and so does the lovely fact that the sum of two independent Poisson variables is again Poisson (multiply $e^{\lambda(s-1)}$ by $e^{\mu(s-1)}$ to get $e^{(\lambda+\mu)(s-1)}$). PGFs are a standard tool in branching processes — modeling whether a population or an epidemic goes extinct or explodes, by iterating $G$ and finding fixed points.

Real-World Application — Epidemic modeling (biology). In the early-outbreak model of a disease, each infected person infects a random number of others described by a PGF $G(s)$. The probability that the outbreak eventually dies out is the smallest fixed point of $G$ — the solution of $G(s) = s$ in $[0,1]$. Whether that fixed point is below $1$ (extinction certain) or equals $1$ (possible explosion) is governed entirely by $G'(1)$, the average number of secondary infections — the famous basic reproduction number $R_0$. The whole qualitative theory of "does an epidemic take off?" is power-series calculus. This connects forward to the SIR model you will build in the capstone (Chapter 39).

24.11 Series Beyond This Chapter

The applications above are a sampler, not an inventory. To show how far the reach extends, here are three more arenas where series do the heavy lifting — each a doorway to a later course.

Solving differential equations by power series. When an ODE resists every elementary method, you can assume the solution is a power series, $y(x) = \sum a_n x^n$, substitute it into the equation, and match coefficients to get a recursion for the $a_n$. This is how the special functions of physics are born. For example, Airy's equation $y'' - xy = 0$ — which governs the intensity of light near a caustic and the wavefunction near a classical turning point in quantum mechanics — yields the recursion $(n+2)(n+1)a_{n+2} = a_{n-1}$, defining the Airy functions. Bessel, Legendre, and Hermite functions arise the same way. We met the spirit of this in Chapter 19 when we solved differential equations; the series method extends it to equations no formula can crack.

Generating functions in combinatorics. A sequence of counts $a_0, a_1, a_2, \ldots$ can be stored in an ordinary generating function $G(x) = \sum a_n x^n$, and algebraic manipulations of $G$ solve counting problems. The Fibonacci numbers, for instance, have the astonishingly compact generating function $G(x) = x/(1 - x - x^2)$ — that single rational expression is the entire infinite Fibonacci sequence. The Catalan numbers, which count everything from balanced parentheses to triangulations of a polygon, are packaged in $\sum C_n x^n = \big(1 - \sqrt{1-4x}\big)/(2x)$.

Asymptotic series in physics. Some of the most useful series in science diverge — yet truncating them gives superb approximations. An asymptotic series $f(x) \sim a_0 + a_1/x + a_2/x^2 + \cdots$ as $x \to \infty$ may have zero radius of convergence, but its first few terms can match $f$ to extraordinary precision. The perturbation expansions of quantum electrodynamics — among the most accurately tested predictions in all of science — are asymptotic series in this sense.

24.12 Why Series Matter

Step back and look at what infinite series have done in this single chapter. They turned three innocent Taylor expansions into the most beautiful equation in mathematics. They explained how the calculator in your pocket evaluates every transcendental function. They decomposed signals into pure tones, summed a 90-year-old puzzle to $\pi^2/6$, opened the door to the Riemann hypothesis, computed $\pi$ to trillions of digits, and encoded entire probability distributions in a single function.

The infinite series is not a mathematical curiosity to be admired and forgotten. It is an engineering primitive, executed billions of times per second in every phone, every audio codec, every imaging scanner, and every physics simulation on Earth. Approximation — the soul of calculus — reaches its full power when the approximations are infinite sums that converge exactly to the thing you want. That is the deep lesson of Part IV.

Add to Your Modeling Portfolio. Add a series-based computation to your model — a place where an exact quantity is reached (or approximated to controlled precision) by summing a series. Biology: model an early-stage outbreak with a probability generating function $G(s)$ for secondary infections; compute $R_0 = G'(1)$ and the extinction probability as the fixed point of $G(s)=s$, foreshadowing your SIR capstone (Chapter 39). Economics: value a perpetuity or a growing-dividend stream as a geometric series, and use the first few terms of a Taylor expansion to linearize a nonlinear utility or production function around equilibrium. Physics: expand a potential energy function in a Taylor series about a stable equilibrium; show that the quadratic term reproduces simple harmonic motion, and use Euler's formula to write the oscillation as $\operatorname{Re}(A e^{i\omega t})$. Data Science: implement your own sin/exp from truncated Taylor series with a tolerance-controlled stopping rule (the alternating-series bound from Chapter 22), and verify it against NumPy to machine precision.

24.13 Summary: The End of Part IV

You have completed Part IV — Sequences and Series, and it has been a single long argument:

  • Sequences (Chapter 20) made the discrete limit rigorous — the foundation everything else stands on.
  • Series (Chapter 21) summed infinitely many terms and asked when that even makes sense; geometric, harmonic, and $p$-series gave the first answers.
  • Convergence tests (Chapter 22) built the toolkit — comparison, ratio, root, integral, and alternating-series tests — for deciding convergence and bounding error.
  • Power and Taylor series (Chapter 23) revealed that functions can be infinite polynomials, with the radius of convergence governing where the representation holds.
  • Applications (this chapter) cashed it all in: Euler's identity, Fourier series, the Basel problem, $\pi$-computation, and probability generating functions.

The keystone was the moment three Taylor series and the number $i$ collapsed into $e^{i\pi} + 1 = 0$. That equation is not the end of mathematics — it is a hinge. It is where real calculus opens onto complex analysis, where oscillation and growth are unmasked as one phenomenon, and where the geometry of the unit circle becomes the algebra of the exponential.

In Part V we change direction — literally. Chapters 25 through 27 introduce alternative coordinate systems: parametric curves, polar coordinates (where Section 24.5's $r e^{i\theta}$ becomes a full geometry), and conic sections. These prepare the ground for the multivariable calculus of Part VI, where the derivative and the integral both grow new dimensions. The skills you forged in Part IV — convergence reasoning, Taylor approximation, the courage to manipulate the infinite with precision — will travel with you through all of it.

Take a moment to appreciate where you have arrived. You started Part IV asking whether an infinite sum could even have a value. You finish it having derived the most beautiful equation in mathematics from scratch, and understanding why your calculator, your music, and the deepest unsolved problem in number theory all rest on the same idea. That is calculus at its most computationally powerful and its most aesthetically sublime.


Continue to: Exercises · Quiz · Case Study 1 · Case Study 2 · Key Takeaways · Further Reading