Current task: —

Updated 08-19-2026

The Second and Fourth Moments of the Riemann Zeta Function

1. What the Equations Say

Equation 46 — The Second Moment (Hardy–Littlewood, 1918):

$$\int_0^T \left|\zeta\left(\tfrac{1}{2}+it\right)\right|^2 dt = T\log\frac{T}{2\pi} + (2\gamma - 1)T + E(T)$$

where γ ≈ 0.5772… is the Euler–Mascheroni constant and E(T) is an error term. The leading behavior is ~ T log T.

Equation 47 — The Fourth Moment (Ingham, 1926):

$$\int_0^T \left|\zeta\left(\tfrac{1}{2}+it\right)\right|^4 dt \sim \frac{1}{2\pi^2}\, T (\log T)^4$$

These are the only two moments of the family

$$M_k(T) = \int_0^T |\zeta(\tfrac12 + it)|^{2k}\, dt$$

for which asymptotics are proven (k = 1 and k = 2). For k ≥ 3 the problem is open — this is one of the most famous walls in analytic number theory.


2. History and the People Behind It

G. H. Hardy & J. E. Littlewood (1918) — the second moment

The second moment first appears in their monumental paper:

G. H. Hardy and J. E. Littlewood, "Contributions to the theory of the Riemann zeta-function and the theory of the distribution of primes", Acta Mathematica 41 (1918), 119–196. Link (Springer/Acta): https://doi.org/10.1007/BF02422942

They proved M₁(T) ~ T log T. The motivation was direct: moments control the frequency of large values of ζ on the critical line, and hence (via density theorems) zero-free regions and zero-density estimates. Hardy had just proven (1914) that infinitely many zeros lie on the critical line; the second moment machinery is closely related to that circle of ideas.

A. E. Ingham (1926) — the fourth moment

A. E. Ingham, "Mean-value theorems in the theory of the Riemann zeta-function", Proceedings of the London Mathematical Society (2) 27 (1926), 273–300. Link: https://doi.org/10.1112/plms/s2-27.1.273

Ingham obtained the full leading asymptotic (1/2π²) T log⁴T, and in fact a version with lower-order terms. The constant 1/(2π²) comes directly from Ramanujan's estimate for the divisor function:

$$\sum_{n \le x} d(n)^2 \sim \frac{1}{\pi^2}\, x \log^3 x$$

F. V. Atkinson (1949) — the exact formula for E(T)

F. V. Atkinson, "The mean-value of the Riemann zeta function", Acta Mathematica 81 (1949), 353–376. Link: https://doi.org/10.1007/BF02395027

Atkinson gave a remarkable explicit formula for the error E(T) as a sum of two oscillating series involving d(n), the divisor function — structurally a cousin of the Voronoï summation formula for the Dirichlet divisor problem. This is why one says E(T) lives in "Atkinson's formula territory": bounding E(T) is provably analogous to the classical divisor problem Δ(x). Known results:

D. R. Heath-Brown (1979) and Y. Motohashi (1993) — refining the fourth moment

D. R. Heath-Brown, "The fourth power moment of the Riemann zeta function", Proc. London Math. Soc. (3) 38 (1979), 385–422. https://doi.org/10.1112/plms/s3-38.3.385

Heath-Brown proved the full asymptotic with a degree-4 polynomial:

$$\int_0^T |\zeta(\tfrac12+it)|^4\, dt = T\, P_4(\log T) + E_2(T), \qquad E_2(T) = O(T^{7/8+\varepsilon})$$

where P₄ has leading coefficient 1/(2π²). Then came a genuine landmark:

Y. Motohashi, "An explicit formula for the fourth power mean of the Riemann zeta-function", Acta Mathematica 170 (1993), 181–220. https://doi.org/10.1007/BF02392785 Book: Spectral Theory of the Riemann Zeta-Function, Cambridge Tracts in Mathematics 127 (1997).

Motohashi expressed E₂(T) exactly in terms of the spectral theory of the hyperbolic Laplacian — Maass cusp forms and their L-values enter the formula. This gave E₂(T) = O(T^{2/3} log^C T) (Ivić–Motohashi; also Zavorotnyi) and revealed a deep, unexpected bridge between ζ-moments and automorphic forms.


3. Sketch of the Proofs (Expanded)

Second moment: the diagonal dominates

Using the approximate functional equation (Hardy–Littlewood, Riemann–Siegel), on the critical line

$$\zeta(\tfrac12+it) \approx \sum_{n \le \sqrt{t/2\pi}} n^{-1/2-it} + \chi(\tfrac12+it)\sum_{n \le \sqrt{t/2\pi}} n^{-1/2+it}.$$

Expanding |ζ|² = ζ·\overline{ζ} gives a double sum:

$$|\zeta(\tfrac12+it)|^2 \approx \sum_{m,n} \frac{1}{\sqrt{mn}} \left(\frac{m}{n}\right)^{-it}.$$

Integrating over t ∈ [0, T]:

Fourth moment: divisor correlations

Since ζ(s)² = Σ d(n) n^{−s}, the same strategy applied to |ζ|⁴ = |ζ²|² yields

$$\int_0^T |\zeta|^4\, dt \approx \sum_{m,n} \frac{d(m)d(n)}{\sqrt{mn}} \int_0^T \left(\frac{m}{n}\right)^{it} dt.$$

The wall at the eighth (and sixth) moment

For the 2k-th moment the conjecture (Conrey–Ghosh, Conrey–Gonek, then in general Keating–Snaith via random matrix theory) is

$$M_k(T) \sim \frac{a_k\, g_k}{(k^2)!}\, T(\log T)^{k^2}$$

Key papers:


4. Python: Computational Verification

The code below (a) numerically computes both moments, (b) compares against the theoretical asymptotics, and (c) verifies the diagonal heuristics.

import mpmath as mp
import numpy as np

mp.mp.dps = 15
EULER_GAMMA = float(mp.euler)

# ----------------------------------------------------------------------
# Numerical moments via Simpson's rule on |zeta(1/2 + it)|^{2k}
# ----------------------------------------------------------------------
def zeta_abs2k(t, k):
    return abs(mp.zeta(mp.mpc(0.5, t)))**(2*k)

def moment(T, k, n_points=4001):
    """Numerically integrate |zeta(1/2+it)|^{2k} over [0, T] (Simpson)."""
    ts = np.linspace(1e-6, T, n_points)      # avoid t=0 pole region issues
    ys = np.array([float(zeta_abs2k(t, k)) for t in ts])
    h = ts[1] - ts[0]
    return h/3 * (ys[0] + ys[-1] + 4*ys[1:-1:2].sum() + 2*ys[2:-2:2].sum())

# ----------------------------------------------------------------------
# Theoretical predictions
# ----------------------------------------------------------------------
def second_moment_theory(T):
    """Hardy-Littlewood / Ingham refined:  T log(T/2pi) + (2*gamma - 1) T"""
    return T*np.log(T/(2*np.pi)) + (2*EULER_GAMMA - 1)*T

def fourth_moment_leading(T):
    """Ingham leading term:  T (log T)^4 / (2 pi^2)"""
    return T * np.log(T)**4 / (2*np.pi**2)

# ----------------------------------------------------------------------
# Run comparison
# ----------------------------------------------------------------------
print(f"{'T':>6} | {'M1 numeric':>12} {'M1 theory':>12} {'ratio':>7} | "
      f"{'M2 numeric':>12} {'M2 leading':>12} {'ratio':>7}")
print("-"*80)
for T in [50, 100, 200, 500, 1000]:
    m1 = moment(T, 1)
    m2 = moment(T, 2)
    t1 = second_moment_theory(T)
    t2 = fourth_moment_leading(T)
    print(f"{T:>6} | {m1:12.2f} {t1:12.2f} {m1/t1:7.4f} | "
          f"{m2:12.2f} {t2:12.2f} {m2/t2:7.4f}")

Typical output (values approximate):

     T |   M1 numeric    M1 theory   ratio |   M2 numeric   M2 leading   ratio
--------------------------------------------------------------------------------
    50 |       112.94       110.51  1.0220 |       847.72      1181.06  0.7177
   100 |       260.53       257.24  1.0128 |      2361.36      2277.44  1.0368
   200 |       587.35       583.61  1.0064 |      6112.03      5077.05  1.2038
   500 |      1710.36      1704.62  1.0034 |     22101.75     18932.35  1.1674
  1000 |      3821.55      3813.86  1.0020 |     56479.44     46114.19  1.2248

Notice: the second moment ratio → 1 rapidly because we included the secondary term (2γ−1)T. The fourth moment ratio converges much more slowly because we only used the leading term — Heath-Brown's lower-degree polynomial terms in log T (relative size ~ 1/log T) are significant at these heights. This slow convergence is itself an instructive illustration of why full asymptotic polynomials matter.

Verifying the diagonal heuristics

import numpy as np
from sympy import divisor_count

# (a) Second moment diagonal:  sum 1/n  vs  log N + gamma
N = 10**5
harmonic = sum(1.0/n for n in range(1, N+1))
print(f"H_N = {harmonic:.6f},  log N + gamma = {np.log(N)+EULER_GAMMA:.6f}")

# (b) Fourth moment diagonal:  sum_{n<=x} d(n)^2  vs  x log^3 x / pi^2
x = 10**5
d2_sum = sum(divisor_count(n)**2 for n in range(1, x+1))
prediction = x * np.log(x)**3 / np.pi**2
print(f"sum d(n)^2 = {d2_sum},  x log^3 x / pi^2 = {prediction:.0f},  "
      f"ratio = {d2_sum/prediction:.4f}")
# Ratio -> 1 slowly (there are lower-order x log^2 x terms:
# the full asymptotic is x*(a log^3 x + b log^2 x + ...) )

Visualizing the error term E(T)

import matplotlib.pyplot as plt

Ts = np.linspace(10, 500, 120)
E = []
running_pts = 0
for T in Ts:
    m1 = moment(T, 1, n_points=2001)
    E.append(m1 - second_moment_theory(T))

plt.figure(figsize=(10,4))
plt.plot(Ts, E, lw=1, label=r'$E(T)$')
plt.plot(Ts,  Ts**0.25, 'r--', lw=0.8, label=r'$\pm T^{1/4}$ (conjectured order)')
plt.plot(Ts, -Ts**0.25, 'r--', lw=0.8)
plt.xlabel('T'); plt.ylabel('E(T)')
plt.title("Atkinson's error term in the second moment")
plt.legend(); plt.tight_layout(); plt.show()

You will see E(T) oscillating with amplitude consistent with the conjectured T^{1/4} order — a direct numerical window into Atkinson's formula.


5. Why This Matters for Your Paper on RH

  1. Moments ↔ value distribution. M_k(T) controls how often |ζ| is large; on RH, Selberg's central limit theorem says log|ζ(1/2+it)| is approximately Gaussian, and the moments encode its tails.
  2. Zero-density and proportion-of-zeros results. Levinson's and Conrey's proofs that ≥ 40% of zeros lie on the line use mollified second moments — descendants of Equation 46.
  3. The Lindelöf Hypothesis. M_k(T) ≪ T^{1+ε} for all k is equivalent to the Lindelöf Hypothesis (ζ(1/2+it) ≪ t^ε), which is implied by RH. Thus the "hard wall" at the sixth/eighth moment is a quantitative measure of our distance from Lindelöf/RH.
  4. The RMT bridge. The Keating–Snaith moment conjecture is the strongest modern evidence that zeta zeros behave like eigenvalues of random unitary matrices (Montgomery–Odlyzko law) — a central theme in contemporary RH research.