The Riemann Zeta Function
We now cross from arithmetic into analysis. The Riemann zeta function is the single
object that ties calculus to the primes. It starts life as an innocent-looking infinite sum —
exactly the kind of thing you'd meet in a calculus course on convergent series:
\zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^{s}} = 1 + \frac{1}{2^{s}} + \frac{1}{3^{s}} + \frac{1}{4^{s}} + \cdots
There is nothing about primes in that formula at all — just every whole number, in order. And yet,
once Riemann let s range
over complex numbers, this ordinary-looking sum turned out to secretly encode the deepest
truths we know about how the prime numbers are scattered along the number line. The bridge between
the sum and the primes is a rewrite called the
Euler product,
which we build towards on this page and then cross properly next.
Where the sum converges
For real s > 1 the series converges to a finite number — the terms shrink
fast enough. As s decreases toward 1, the value
climbs faster and faster, and at s=1 the sum blows up entirely: this is
the famous harmonic series
1 + \tfrac12 + \tfrac13 + \tfrac14 + \cdots, which diverges even though
its terms shrink to zero. Watch the curve climb toward a vertical wall at s=1:
Notice how quickly the curve flattens out for larger s: by
s=4 or so, \zeta(s) is already extremely close
to 1, because every term past 1/1^s has become
tiny. The interesting action all happens in that narrow strip just to the right of
s=1.
Worked example: summing ζ(2) numerically
Euler's most celebrated computation is \zeta(2) — the "Basel problem,"
posed in 1650 and unsolved for 85 years until Euler cracked it in 1735:
\zeta(2) = \sum_{n=1}^{\infty}\frac{1}{n^2} = 1 + \frac14 + \frac19 + \frac{1}{16} + \cdots = \frac{\pi^2}{6}.
You can check this is at least plausible by adding up a handful of terms by hand and
comparing with \pi^2/6 \approx 1.644934:
function partialZeta(s: number, terms: number): number {
let sum = 0;
for (let n = 1; n <= terms; n++) {
sum += 1 / Math.pow(n, s);
}
return sum;
}
console.log("after 5 terms: ", partialZeta(2, 5));
console.log("after 50 terms:", partialZeta(2, 50));
console.log("after 5000 terms:", partialZeta(2, 5000));
console.log("π²/6 =", (Math.PI * Math.PI) / 6);
The partial sums creep up on \pi^2/6 from below, getting closer with every
extra term but converging fairly slowly (each new term only shaves off roughly
1/n of the remaining gap) — a hint that squeezing an exact closed form like
\pi^2/6 out of that sum took real cleverness, not just patient addition.
Euler found the general pattern for every even integer, so for example
\zeta(4) = \pi^4/90 and \zeta(6) = \pi^6/945.
That \pi — the circle constant — appears at all in a sum built purely from
reciprocal whole-number powers is one of mathematics' great surprises, and a first hint that
\zeta reaches into territory far beyond the integers it's built from.
Worked example: fast convergence vs. no convergence at all
Compare two cases side by side to see just how sharp the boundary at s=1
really is.
Large s, say s=10: the very
first term is 1/1^{10}=1, and the next is
1/2^{10} = 1/1024 \approx 0.000977 — already three orders of magnitude
smaller. By the third term, 1/3^{10} \approx 0.0000169, the running total
has essentially stopped moving. \zeta(10) \approx 1.000994575\ldots, and
you'd need only a handful of terms to nail every digit shown.
At s=1: the terms are
1, \tfrac12, \tfrac13, \tfrac14, \ldots — individually shrinking to zero,
which makes it *feel* like it should converge. But group them in doubling blocks:
1 + \underbrace{\tfrac12}_{\ge \tfrac12} + \underbrace{\tfrac13+\tfrac14}_{\ge \tfrac12} + \underbrace{\tfrac15+\cdots+\tfrac18}_{\ge \tfrac12} + \cdots
Every bracket adds at least \tfrac12, and there are infinitely many
brackets, so the running total sails past every finite number. The harmonic series diverges — slowly
(it takes about e^{100} terms to pass 100!),
but it never, ever settles down.
It is tempting to plug s=1 straight into the formula and expect
some answer, however large. Resist that urge:
\zeta(1) = 1 + \tfrac12 + \tfrac13 + \tfrac14 + \cdots is the harmonic
series, and it does not converge to any finite value at all — it diverges to infinity. This isn't a
computational inconvenience to be patched over; it is a genuine boundary. Every neighbouring value
\zeta(1.1), \zeta(1.01), \zeta(1.001) is finite (just larger and larger),
so the function has a real, unavoidable pole exactly at s=1.
This single bad point turns out to matter enormously. When
the prime
number theorem is finally proved using \zeta, the whole
argument hinges on carefully controlling exactly what happens near this one troublesome pole at
s=1 — the one place the defining sum refuses to make sense.
The "Basel problem" — find the exact value of 1 + \tfrac14+\tfrac19+\tfrac1{16}+\cdots —
was posed by Pietro Mengoli in 1650 and defeated some of the best mathematicians in Europe for the
better part of a century, including several members of the formidable
Bernoulli family, working in Euler's own home city of
Basel (hence the name). Jacob Bernoulli himself published a plea: if anyone could find the sum, he
would be exceedingly grateful.
In 1735, a 28-year-old Leonhard Euler found it —
\pi^2/6 — using an audacious, not-yet-fully-rigorous trick: he treated the
infinite sine series like an infinite polynomial and read off its "roots" the way you would for a
finite polynomial, arriving at an infinite product for \sin(x)/x and
matching coefficients. The result was met with equal parts astonishment and suspicion — nobody
expected \pi to appear from summing reciprocal squares, and it took
decades before the argument was made fully rigorous. It made Euler instantly famous across Europe,
and the Basel problem has been a celebrated trophy of mathematics ever since.
Odd values: still a mystery
Euler's trick nailed every even integer — \zeta(2), \zeta(4), \zeta(6), \ldots —
each one a rational multiple of a power of \pi. It is natural to expect the
odd values to follow the same pattern. They stubbornly refuse to.
function partialZeta(s: number, terms: number): number {
let sum = 0;
for (let n = 1; n <= terms; n++) {
sum += 1 / Math.pow(n, s);
}
return sum;
}
console.log("ζ(3) ≈", partialZeta(3, 100000));
That number, \zeta(3) \approx 1.2020569\ldots, is called
Apéry's constant. Nobody has ever found a closed form for it in terms of
\pi, or any other familiar constant — and it took until 1978 for Roger
Apéry to even prove it is irrational, a genuine surprise that made headlines in the
mathematical world. Whether \zeta(5), \zeta(7), \zeta(9), \ldots are
irrational at all is still, today, largely open. The even values were the easy half of the story; the
odd values remind us how much of \zeta's behaviour is still genuinely
unknown.
The leap to the complex plane
Riemann's revolutionary move — the one that gives this page its name — was to let
s be a full complex number, not just a real one, and to extend
\zeta by analytic continuation to (almost) the whole
complex plane. This produces a single, seamless function defined even at values of
s where the original infinite sum diverges outright (for instance at every
negative even integer). The continued \zeta(s) has "trivial" zeros at
s = -2, -4, -6, \ldots, and a family of far more mysterious zeros whose
exact location is the central open question of number theory — the
Riemann
Hypothesis.
None of that mystery is visible yet from the sum alone — it only appears once you know how to rewrite
\zeta(s) as an infinite product running over the prime numbers
instead of a sum running over all numbers. That single rewrite, the
Euler
product for zeta, is the real magic trick and the subject of the next page: it is the
exact moment where "just a sum from calculus" turns into "a coded message about the primes."
A hidden symmetry: the functional equation
Once continued to the whole plane, \zeta obeys a strikingly tidy
symmetry, the functional equation, linking its value at s
to its value at the mirror point 1-s:
\zeta(s) = 2^{s}\pi^{s-1}\sin\!\left(\frac{\pi s}{2}\right)\Gamma(1-s)\,\zeta(1-s).
You don't need to unpack the Gamma function \Gamma to see the payoff: the
equation pins down \zeta for s<0 entirely in
terms of values with 1-s>1, where the original sum already makes sense —
this is exactly how the analytic continuation is built in practice, region by region. It also
explains the trivial zeros mentioned above: the factor
\sin(\pi s/2) vanishes whenever s is a negative
even integer, forcing \zeta(s)=0 there, cleanly and predictably.
The equation also marks out the one region it does not explain: the
critical strip 0 < \operatorname{Re}(s) < 1, the narrow
vertical band straddling the symmetry line \operatorname{Re}(s) = \tfrac12.
Every non-trivial zero of \zeta — the ones number theorists
actually care about — lives somewhere in that strip, and pinning down exactly where is precisely the
content of the Riemann Hypothesis waiting on the next page.
See it explained