Counting Zeros: the Riemann–von Mangoldt Formula

The Riemann Hypothesis is a claim about where the non-trivial zeros of \zeta(s) sit. But before you can ask where they are, a more basic question has to be answered: how many are there? Are there finitely many, scattered thinly up the critical strip, or do they keep coming forever — and if forever, how fast do they pile up as you climb?

The Riemann–von Mangoldt formula answers this with startling precision. It gives an exact count of the zeros up to any height T — not an order of magnitude, not a rough asymptotic, but a formula accurate to within a whisper. Riemann stated it (without full proof) in his 1859 memoir; Hans von Mangoldt supplied the rigorous proof in 1905. It is the bookkeeping backbone of the whole subject: every argument that "so many zeros must lie in this box" ultimately leans on it.

The counting function

Write each non-trivial zero as \rho = \beta + i\gamma, where \beta = \Re(\rho) is its position across the strip and \gamma = \Im(\rho) is its height. Define the counting function

N(T) = \#\{\rho = \beta + i\gamma : \zeta(\rho) = 0,\ 0 < \beta < 1,\ 0 < \gamma \le T\}.

In words: N(T) is simply the number of non-trivial zeros in the critical strip with imaginary part between 0 and T. It is a staircase — flat, then a jump of +1 each time you pass a zero's height. The whole game is to describe that staircase.

The formula

For T not equal to the height of any zero,

N(T) = \frac{T}{2\pi}\log\frac{T}{2\pi} - \frac{T}{2\pi} + \frac{7}{8} + S(T) + O\!\left(\tfrac{1}{T}\right),

where the fluctuating term is

S(T) = \frac{1}{\pi}\arg\zeta\!\left(\tfrac12 + iT\right),

the argument taken by continuous variation along the horizontal line from 2 to 2+iT to \tfrac12+iT. Moreover:

Split it into two parts and everything becomes readable. The smooth part

\overline{N}(T) = \frac{T}{2\pi}\log\frac{T}{2\pi} - \frac{T}{2\pi} + \frac{7}{8}

is a clean, monotone curve — it is essentially the phase of the "Gamma factor" and the \pi^{-s/2} in the completed zeta function. The rough part S(T) is the only place the actual zeros of \zeta speak; it wiggles up and down by O(\log T), catching the staircase's individual steps. The remarkable fact is that the wiggle is bounded so tightly compared with a main term that grows without bound.

Where the formula comes from: the argument principle

The engine is the argument principle: for a function f analytic and non-zero on a closed contour C, the number of zeros enclosed equals the number of times f winds around the origin,

\#\{\text{zeros inside } C\} = \frac{1}{2\pi i}\oint_C \frac{f'(s)}{f(s)}\,ds = \frac{1}{2\pi}\,\Delta_C \arg f(s).

Instead of \zeta itself we use Riemann's completed function

\xi(s) = \tfrac12\,s(s-1)\,\pi^{-s/2}\,\Gamma\!\left(\tfrac{s}{2}\right)\zeta(s),

which is entire and shares exactly the non-trivial zeros of \zeta (the pole and trivial zeros are cancelled by the extra factors), and satisfies the symmetric functional equation \xi(s) = \xi(1-s). Take the rectangle R with corners -1,\ 2,\ 2+iT,\ -1+iT — tall enough to enclose every zero up to height T, wide enough to swallow the whole strip. Then

N(T) = \frac{1}{2\pi}\,\Delta_R \arg \xi(s).

Now walk the four sides and total the change in argument. By the functional-equation symmetry, the left half of the boundary contributes exactly the same as the right, so the count is 2/(2\pi) times the change along the right half of the boundary. The \pi^{-s/2}\Gamma(s/2) factor, handled with Stirling's formula, contributes the entire smooth main term \overline{N}(T); the single \zeta(s) factor along the top edge contributes precisely the leftover S(T) = \tfrac1\pi \arg\zeta(\tfrac12 + iT). Add them and the formula falls out. Each step of the staircase is a full 2\pi of winding — a sign change of \xi on the line.

Picturing the count

Below, the horizontal axis is \Re(s) and the vertical axis is \Im(s). Step through: the critical strip, then the rectangular contour R reaching up to height T, then the zeros it traps. The argument principle says N(T) is just how many times \xi(s) winds around 0 as s travels once around this box.

Notice the zeros crowd closer together as you go up — that is the main term's \log T at work, which we unpack next.

What the main term tells us: zeros densify

The leading behaviour is

N(T) \sim \frac{T}{2\pi}\log\frac{T}{2\pi} \sim \frac{T}{2\pi}\log T \qquad (T \to \infty).

This grows faster than linearly in T. So the zeros do not thin out or stop — they keep coming, and their density increases with height. To see how quickly, differentiate the main term: the number of zeros in a short window near height T is roughly

\overline{N}'(T) = \frac{1}{2\pi}\log\frac{T}{2\pi},

so the average gap between consecutive zeros near height T is

\text{average gap} \approx \frac{2\pi}{\log T}.

Worked example. Near T = 1000, \log 1000 \approx 6.9, so zeros are spaced about 2\pi/6.9 \approx 0.91 apart. Near T = 10^6, \log(10^6) \approx 13.8 and the spacing has halved to about 0.46. Climb higher and they pack tighter still — slowly, because \log T crawls, but relentlessly.

The staircase against its smooth guide

Here is the actual staircase N(T) (jumping +1 at each true zero height, up to T = 100) drawn against the smooth main term \overline{N}(T). The staircase never strays far from the curve — the gap between them is exactly S(T) + \tfrac78, which stays small while the curve climbs away.

Slide the height to watch the staircase and the smooth curve rise together. The main term is not a best-fit line drawn after the fact — it is derived from the Gamma factor alone, yet the true zeros, wherever they fall, hug it automatically.

Worked example: how many zeros below height 100?

Let's put a real number through the formula. Take T = 100 and evaluate the smooth part \overline{N}(100), step by step.

First, \dfrac{T}{2\pi} = \dfrac{100}{6.2832} \approx 15.915. Then

\log\frac{T}{2\pi} = \log(15.915) \approx 2.7673.

Assemble the three pieces:

\overline{N}(100) \approx 15.915 \times 2.7673 \;-\; 15.915 \;+\; 0.875. \overline{N}(100) \approx 44.043 - 15.915 + 0.875 \approx 29.00.

The formula predicts about 29 zeros below height 100. And the true count, tallied directly from the known zero heights (14.13, 21.02, 25.01, \dots), is exactly 29. The fluctuating term S(100) and the O(1/T) tail together contribute essentially nothing at this height — the smooth part nailed it on its own. That is the formula's whole personality: a simple closed expression that tracks a wild-looking staircase to the integer.

Consequence: infinitely many zeros

A one-line corollary that Riemann's contemporaries could not take for granted: since N(T) \to \infty as T \to \infty (the main term grows without bound and the error cannot hold it back), \zeta(s) has infinitely many non-trivial zeros. Not merely "we keep finding more" — a proof that they never run out, complete with the exact rate at which new ones appear.

The fluctuating term S(T)

Everything unpredictable lives in S(T) = \tfrac1\pi \arg\zeta(\tfrac12 + iT). Two facts pin down its character:

Selberg proved that, suitably normalised, S(T) behaves like a Gaussian random variable with variance \sim \tfrac{1}{2\pi^2}\log\log T — one of the first hints of the deep link between zeta zeros and random-matrix statistics. Each unit jump in S(T) corresponds to a zero being passed: S is the staircase's memory of exactly where each step fell.

A tempting misreading: because we picture the zeros marching up the critical line, one might think N(T) counts zeros on the line \Re(s) = \tfrac12. It does not. N(T) counts every non-trivial zero in the whole critical strip 0 < \Re(s) < 1 up to height T, wherever across the strip it happens to sit. The formula is proved unconditionally — it never assumes RH. (The count of zeros actually on the line is a different, harder quantity, usually written N_0(T); RH is precisely the statement N_0(T) = N(T).)

Second trap: "S(T) = O(\log T) and averages to zero, so it's basically negligible." On average, yes — but not pointwise. There are (rare, high) values of T where S(T) is genuinely large, and S(T) is unbounded overall. "Small in the mean" is not "small everywhere" — conflating the two has sunk many a heuristic argument.

That lonely +\tfrac78 looks arbitrary, but it is forced. It bundles two contributions from the completed function \xi: a +1 from the factor \tfrac12 s(s-1) (whose own argument turns by \pi as you round the contour), and the constant term -\tfrac18 that drops out of Stirling's formula when you expand the argument of \Gamma(\tfrac{s}{2}) along the top edge. Add 1 - \tfrac18 = \tfrac78. It is the fixed "phase offset" of the smooth curve — small, constant, and exactly what makes \overline{N}(100) \approx 29 land on the nose rather than at 28.1.

In his 1859 nine-page memoir Bernhard Riemann wrote down the count N(T) "up to terms of relative order 1/T" and remarked, in his characteristically laconic way, that a rigorous proof would follow from a certain estimate he did not supply. It took until 1905 for Hans von Mangoldt to nail down every step — the Stirling expansion, the bound on S(T), the argument-principle bookkeeping. Riemann's throwaway formula turned out to be exactly right, which by now surprises no one who has read his memoir: nearly every claim in it, however casually tossed off, has eventually been vindicated.