Proving the Prime Number Theorem
We already know what the
Prime Number Theorem
says — \pi(x) \sim x/\ln x — and we've seen the one-line slogan that it comes down
to the zeta function having no zeros on the line \Re(s)=1. This page is the real
thing: the full Hadamard–de la Vallée Poussin proof of 1896, assembled piece by piece. By
the end you'll see exactly how a statement about counting primes gets converted into a contour integral,
how the answer x falls out of a single pole, and where the genuinely hard
analysis actually lives (spoiler: not where a first glance suggests).
The whole argument is a machine with five moving parts. Get the parts in your head first, then we'll
service each one:
- Generating series. -\zeta'/\zeta(s) = \sum_{n\ge1}\Lambda(n)\,n^{-s} packages the primes as a Dirichlet series.
- Perron's formula. A contour integral of that series recovers \psi(x)=\sum_{n\le x}\Lambda(n).
- Shift the contour leftward, past the line \Re(s)=1.
- The pole at s=1 (residue 1) is crossed and drops the main term x.
- The zero-free region lets the shifted contour survive, and makes the leftover integral o(x).
Add the last two together: \psi(x) = x + o(x), i.e.
\psi(x)\sim x. A short summation-by-parts step turns that into
\pi(x)\sim x/\ln x, and we are done.
Move 1 — the generating series
We do not count primes directly. Instead we weight each prime power by a logarithm using the
von Mangoldt function
\Lambda(n) = \begin{cases} \ln p, & n = p^k \text{ for a prime } p,\ k\ge1,\\ 0, & \text{otherwise,}\end{cases}
and study its running total, the Chebyshev function
\psi(x) = \sum_{n\le x}\Lambda(n). The pay-off is that this weighting is exactly
the one the zeta function produces when you take its logarithmic derivative. Starting from the Euler product
\zeta(s)=\prod_p (1-p^{-s})^{-1}, taking \log and then
-\,d/ds gives the identity developed on
the logarithmic derivative of zeta:
-\frac{\zeta'(s)}{\zeta(s)} = \sum_{n=1}^{\infty} \frac{\Lambda(n)}{n^{s}}, \qquad \Re(s) > 1.
This is the hinge of the entire proof. On the left is a single analytic object whose poles we can
chase around the complex plane; on the right is the arithmetic we want to understand. A pole of
-\zeta'/\zeta appears wherever \zeta has a pole (at
s=1) or a zero (with a sign flip). That is why the location of zeta's zeros will
end up dictating the size of \psi(x).
Move 2 — Perron's formula turns the series into an integral
Perron's formula
is the dictionary between a Dirichlet series and the partial sums of its coefficients. Applied to our series
with coefficients \Lambda(n), it reads
\psi(x) = \frac{1}{2\pi i}\int_{c-i\infty}^{\,c+i\infty} \left(-\frac{\zeta'(s)}{\zeta(s)}\right)\frac{x^{s}}{s}\,ds, \qquad c > 1.
The vertical line of integration sits at some fixed c>1, safely inside the region
where the series converges. The factor x^{s}/s is doing the counting: as an
operator it acts like a smoothed step function that is 1 for
n and 0 for n>x, so the
integral selects exactly the terms with n\le x. All the arithmetic is now hidden
inside one complex integral. The rest of the proof is a single question: what happens to this integral
as we slide the line of integration to the left?
Moves 3 & 4 — shift the contour and collect the pole
Cauchy's residue theorem says that sliding a contour across an analytic region changes the integral only by
the residues of whatever singularities you cross. We move the line from \Re(s)=c
leftward toward and just past \Re(s)=1. On the way we cross exactly one
singularity: the pole of the integrand at s=1. Schematically:
The integrand \left(-\zeta'/\zeta\right)x^{s}/s has a simple pole at
s=1, inherited from the simple pole of \zeta itself.
Crossing it contributes its residue to \psi(x), and — this is the punchline of the
whole subject — that residue is exactly x. So
\psi(x) = \underbrace{\operatorname*{Res}_{s=1}\left[\left(-\frac{\zeta'(s)}{\zeta(s)}\right)\frac{x^{s}}{s}\right]}_{=\,x} \;+\; \frac{1}{2\pi i}\int_{\text{shifted}} \left(-\frac{\zeta'(s)}{\zeta(s)}\right)\frac{x^{s}}{s}\,ds.
The first term is the main term. The second — the integral along the new, shifted contour — is what we must
show is small. Let's nail the residue first, because it is the easy and beautiful part.
Worked example — why the main term is exactly x
Near s=1, the zeta function has a simple pole with residue
1: its Laurent expansion is
\zeta(s) = \dfrac{1}{s-1} + \gamma + O(s-1). Taking the logarithmic derivative of
a simple pole is mechanical. If \zeta(s) \approx \dfrac{1}{s-1} near
s=1, then \ln\zeta(s) \approx -\ln(s-1), so
-\frac{\zeta'(s)}{\zeta(s)} = \frac{1}{s-1} + \big(\text{something analytic at } s=1\big).
In other words -\zeta'/\zeta also has a simple pole at
s=1, and crucially its residue there is +1 — a pole of
\zeta of order one becomes a pole of -\zeta'/\zeta with
residue equal to that order. Now multiply by the smooth factor
x^{s}/s, which at s=1 equals
x^{1}/1 = x. For a simple pole the residue is just (residue of the pole factor)
times (value of the smooth factor):
\operatorname*{Res}_{s=1}\left[\left(\frac{1}{s-1}+\cdots\right)\frac{x^{s}}{s}\right] = 1 \cdot \left.\frac{x^{s}}{s}\right|_{s=1} = \frac{x^{1}}{1} = x.
There it is. The residue is x because zeta's pole at
s=1 has residue 1, and because
x^{s}/s evaluates to x at
s=1. The famous asymptotic \psi(x)\sim x is, at heart,
the statement "\zeta has a simple pole of residue 1 at
s=1". Everything else in the proof is the work of showing that this main term is
not swamped by the leftover integral.
Move 5 — the zero-free region makes the rest o(x)
We could not have shifted the contour to the left at all if the integrand had singularities blocking the way.
Its singularities to the left of s=1 are precisely the zeros of
\zeta (each zero of \zeta is a pole of
-\zeta'/\zeta). So the shift is legal exactly to the extent that we have a region,
just left of the line, that is free of zeros. This is the theorem that took Hadamard and de
la Vallée Poussin 37 years after Riemann to reach:
- \zeta(s) \ne 0 on the whole line \Re(s)=1 — the qualitative statement that already forces \psi(x)\sim x.
- Quantitatively, there is a constant c>0 with \zeta(s)\ne0 in the region \displaystyle \Re(s) \ge 1 - \frac{c}{\ln(|t|+2)}, a thin sliver that pinches toward the line as the height |t| grows.
Inside this region we also need bounds on how large \zeta'/\zeta can get, so that
the integral over the shifted contour is genuinely controlled. The standard estimate is polynomial in the
height:
\left|\frac{\zeta'(s)}{\zeta(s)}\right| \ll \big(\ln(|t|+2)\big)^{2} \qquad\text{throughout the zero-free region.}
With the contour pushed to \Re(s)=\sigma = 1 - c/\ln(|t|+2), the size of the
integrand along it is governed by |x^{s}| = x^{\sigma} = x\cdot x^{-c/\ln(|t|+2)}.
The factor x^{-c/\ln(\cdots)} is what beats the main term down: it is strictly
less than 1, so the shifted integral is smaller than x
by a factor that tends to 0. Hence the leftover is o(x),
and \psi(x) = x + o(x).
Truncation at height T, and balancing T against x
There is a practical wrinkle we glossed over. The Perron integral runs all the way up the infinite vertical
line, but you cannot shift an infinitely long contour and control it for free. The rigorous version uses the
truncated Perron formula: integrate only between heights
-T and +T, and pay an explicit error for the missing
tails,
\psi(x) = \frac{1}{2\pi i}\int_{c-iT}^{\,c+iT}\left(-\frac{\zeta'(s)}{\zeta(s)}\right)\frac{x^{s}}{s}\,ds \;+\; O\!\left(\frac{x\,(\ln x)^{2}}{T}\right).
Now two competing effects must be balanced by the single free parameter T:
| Effect | Wants T … | Because |
| Truncation error O(x(\ln x)^2/T) | large | a taller box loses less of the tail |
| Shifted-contour integral (uses the zero-free width c/\ln T) | small | higher up, the zero-free region pinches thinner and \zeta'/\zeta grows |
You cannot make both terms tiny at once, so you choose T as a function of
x to make the two errors comparable. Pushing the algebra through — set
T so that \ln T \asymp \sqrt{\ln x} — the optimum
yields the classical de la Vallée Poussin error term
\psi(x) = x + O\!\left(x\,\exp\!\big(-c\sqrt{\ln x}\big)\right),
which is comfortably x + o(x). The
\exp(-c\sqrt{\ln x}) savings is exactly the imprint of a zero-free region of width
\sim 1/\ln T: widen the region and the error shrinks; the Riemann Hypothesis, a
zero-free region all the way to \Re(s)=\tfrac12, would upgrade this to an error of
size \sqrt{x}\,(\ln x)^2.
From \psi(x)\sim x to \pi(x)\sim x/\ln x
The final step is bookkeeping, not analysis. The three Chebyshev counts are asymptotically equal,
\psi(x)\sim\vartheta(x)\sim x (the prime powers
p^k,\,k\ge2 contribute only O(\sqrt{x}\ln x), which is
negligible), and a summation by parts converts the log-weighted count
\vartheta(x)=\sum_{p\le x}\ln p into the plain count
\pi(x)=\sum_{p\le x}1:
\pi(x) = \frac{\vartheta(x)}{\ln x} + \int_2^{x}\frac{\vartheta(t)}{t\,(\ln t)^{2}}\,dt \sim \frac{x}{\ln x}.
And there is the Prime Number Theorem, delivered by a contour integral. The engine ran: a series, a pole, a
shift, a residue of x, and a zero-free region to sweep the remainder under
o(x).
A newcomer often thinks the clever part is the residue computation that produces the main term
x. It isn't — that residue is a one-line exercise, forced by
\zeta's simple pole of residue 1. The genuinely deep
analytic input, the thing that resisted mathematicians for four decades, is the
zero-free region: proving
\zeta(1+it)\ne0 for every real t, together with the
(\ln|t|)^2 bounds on \zeta'/\zeta that make the shifted
integral converge. If you remember one thing, remember this: the main term is arithmetic bookkeeping; the
error term is the entire subject.
Second trap: the bare theorem \psi(x)\sim x comes with no rate of
convergence at all. "Asymptotic to" only means the ratio tends to 1. You
get an effective error term — the O(x\exp(-c\sqrt{\ln x})) above — only
by quantifying the width of the zero-free region. No quantitative zero-free region, no error bound. The
quality of the estimate and the geometry of where \zeta vanishes are one and the
same thing.
For fifty years it was folklore that the PNT was inseparable from complex analysis — that the primes could
only be tamed by contour integrals and the analytic behaviour of \zeta. In 1948
that belief collapsed: Atle Selberg and Paul Erdős, building on Selberg's symmetry formula
\sum_{p\le x}(\ln p)^2 + \sum_{pq\le x}\ln p\,\ln q = 2x\ln x + O(x), produced a
proof of \psi(x)\sim x that never leaves the real line — no contour, no residues,
no zero-free region. It was a genuine shock (and, less happily, the subject of a bitter priority dispute
between the two).
The catch: the elementary proof is elementary in tools, not in ease — it is long and
intricate, and in its original form gave a much weaker error term than the analytic method. It also,
arguably, explains less. The contour proof tells you why \psi(x)\sim x:
because \zeta has a pole at s=1 and no zeros on the
boundary line. That causal story — main term from the pole, error from the zeros — is the enduring reason
the analytic proof is the one everyone learns first. We only mention the elementary route here; its
machinery is a subject of its own.
In the cleanest textbook version the shifted contour is not a straight vertical line but a shape that
hugs the boundary of the zero-free region. Near the real axis it can bow a fixed distance to the
left of \Re(s)=1; as you climb to large height |t|, the
zero-free region narrows like 1/\ln|t|, so the contour must curve back rightward,
creeping toward the line to stay inside the safe zone. The whole proof is a negotiation between two desires —
push left to make x^{\sigma} small, but not so far left that you fall out of the
region where \zeta\ne0 and your bounds hold. The schematic figure above shows the
bowed contour and the pinching region; the real one is that same picture with the boundary drawn as the curve
\sigma = 1 - c/\ln(|t|+2).