Analysis

The slope a Gauss sum leaves behind

Riemann is said to have offered sin x + sin(4x)/4 + sin(9x)/9 + … as a continuous function with no derivative anywhere. It has one after all, at π and at every π times an odd number over an odd number, and the slope there is always exactly −1/2. Computed with a million terms, the function's behaviour at every fraction is read off a single number — a quadratic Gauss sum — and the slope appears exactly where that number is zero.
21 min read 6 figures One point awayThe same thing twice

Worth reading first: Close in height and nowhere close in slope · A curve with a corner at every point.

Close in height and nowhere close in slope showed that uniform convergence passes continuity to a limit and passes nothing about slopes. Its last example was a series of the kind that makes the point most sharply: add sine waves whose frequencies grow faster than their amplitudes shrink, and the sum is continuous while every partial sum is smooth and the limit may be smooth nowhere. Karl Weierstrass made the first proved example in 1872, and in presenting it to the Berlin Academy he said that Bernhard Riemann had already proposed another, in lectures around 1861:

R(x)=∑n=1∞sin⁡(n2x)n2=sin⁡x+sin⁡4x4+sin⁡9x9+⋯ .R(x) = \sum_{n=1}^{\infty} \frac{\sin(n^2 x)}{n^2} = \sin x + \frac{\sin 4x}{4} + \frac{\sin 9x}{9} + \cdots.

Riemann left no proof, and Weierstrass, unable to supply one, built a different function for which he could. The terms are bounded by 1/n21/n^2, so the series converges uniformly and RR is continuous. Its formal derivative, ∑cos⁡(n2x)\sum \cos(n^2 x), converges nowhere. Whether RR has a derivative at any point turned out to be a hard question, open for about a century, and the answer is that Riemann’s candidate fails, but only just: it has a derivative on a dense set of points, every one a rational multiple of π\pi, and the derivative there is always exactly −12-\tfrac12.

Riemann's function on one period, with its one kind of smooth point. R(x) = Σ sin(n²x)/n² on [0, 2π]; R(π) = 0 with derivative −1/2; R(π/2) = 1.2336, a cusp.
Fig. 1 Riemann’s function on one period, summed with four thousand terms. It looks rough at every scale. The straight segment at π\pi has slope −12-\tfrac12, and there the function genuinely has that derivative; at π/2\pi/2 it has none, and almost everywhere else it has none either.

A Fourier series with square frequencies

Riemann’s function is a Fourier series, and an unusual one. An ordinary Fourier series, like the one that builds a square wave from round ones, uses every frequency 1,2,3,…1, 2, 3, \ldots with coefficients chosen to fit a given shape. Riemann’s uses only the square frequencies 1,4,9,16,…1, 4, 9, 16, \ldots, with coefficients that fall like the reciprocal of the frequency. Weierstrass’s own function uses geometric frequencies b,b2,b3,…b, b^2, b^3, \ldots, and the gaps between them are what make his proof work: each new wave is so much faster than all the earlier ones that it dominates the increment at its own scale. Square frequencies grow more slowly, the gaps between them are proportionally smaller, and the waves interfere with one another over a range of scales rather than taking turns. That interference is why Weierstrass could not prove Riemann’s function rough and why, at special points, it cancels into smoothness.

Rough functions are not rare. Baire’s category argument, which a limit can jump at every fraction introduced, shows that in the space of continuous functions the ones with a derivative at even a single point form a negligible set. What is rare is a function given by a formula whose differentiability can be decided point by point. Riemann’s is one of very few, and the decision runs entirely through arithmetic. The waves with square frequencies line up at πp/q\pi p/q according to the residues of n2n^2 modulo 2q2q, and those residues are what a Gauss sum adds.

Computing a function nobody can evaluate naively

Every figure here rests on one computation: the increment R(x0+h)−R(x0)R(x_0 + h) - R(x_0) for small hh, accurate enough to see how it scales. That is harder than it looks. Truncating the series at NN terms leaves a tail of size up to 1/N1/N, which swamps an increment of size 10−610^{-6} unless NN is in the millions. And at N=106N = 10^6 the argument n2x0n^2 x_0 is about 3×10123 \times 10^{12}. A double-precision x0x_0 carries an error of about 10−1610^{-16} in relative terms, so n2x0n^2 x_0 is wrong by about 3×10−43 \times 10^{-4} — and the sine of it is wrong by the same amount, a thousand times the signal.

Both problems have clean answers. For the increment, the tail beyond NN is a sum of terms with essentially random phases once n2hn^2 h is large, so its size is about N−3/2N^{-3/2} rather than 1/N1/N; a million terms leave an error of about 10−910^{-9}. For the phases, the points that matter are rational multiples of π\pi. At x0=πp/qx_0 = \pi p/q the angle n2x0n^2 x_0 modulo 2π2\pi depends only on n2pn^2 p modulo 2q2q, which is a computation on small whole numbers with no rounding at all. For an irrational point such as π(5−1)/2\pi(\sqrt5 - 1)/2 the multiplier is stored to 128 binary places and multiplied exactly by n2n^2 before reduction. The double-precision sine then never sees an argument larger than 2π2\pi plus n2hn^2 h, and n2hn^2 h is computed with full relative accuracy.

Three points under the microscope

At most points a graph like this one has no visible structure, and the only way to see what happens at a point is to zoom. The zoom has to be rescaled, though. If the increment behaves like ∣h∣α|h|^\alpha, a window of width ww shows heights of order wαw^\alpha, and to compare windows the vertical scale must be divided by that. Dividing by w\sqrt w keeps a square-root cusp at a fixed size.

Three points of Riemann's function under magnification. R(x0 + h) − R(x0) rescaled by the square root of the window, at x0 = π, π/2 and 2π/3, windows ±0.01 and ±0.0001.
Fig. 2 R(x0+h)−R(x0)R(x_0 + h) - R(x_0) across windows of ±0.01\pm 0.01 (top) and ±0.0001\pm 0.0001 (bottom) around three points, the vertical scale divided by the square root of the window. At π\pi the curve flattens towards the axis; at π/2\pi/2 and 2π/32\pi/3 it keeps its shape.

The three points behave differently. At 2π/32\pi/3 the picture is a spike: the function drops away like ∣h∣\sqrt{|h|} on both sides, and the spike has the same shape at both magnifications. That is a cusp, and there is no derivative. At π/2\pi/2 the picture is lopsided — flat to the right, a square-root drop to the left — and the shape again survives magnification, so there is a one-sided cusp and still no derivative. At π\pi the curve gets flatter as the window shrinks. The increment there is shrinking faster than ∣h∣\sqrt{|h|}; under this rescaling a straight line of any slope eventually lies flat, and that is what the bottom-left panel shows.

So the zoom separates two kinds of point: those where something of order ∣h∣\sqrt{|h|} is left, and those where it is not. The question is which points are which, and what the size of the square-root term is when it is there.

The square root has a coefficient, and it is a Gauss sum

Take each fraction p/qp/q in lowest terms with qq at most 7 and 0≤p/q<20 \le p/q < 2 — thirty-six points spread over one period — and measure the coefficient of ∣h∣\sqrt{|h|} on each side: (R(x0+h)−R(x0))/h(R(x_0 + h) - R(x_0))/\sqrt h at h=10−6h = 10^{-6} and at h=−10−6h = -10^{-6}, after removing the term −h/2-h/2 that turns out to be present everywhere.

The numbers that come out have a pattern. At 00 the coefficient is 1.25331.2533 on the right and −1.2533-1.2533 on the left; that is π/2\sqrt{\pi/2}, to four places. At π/2\pi/2 it is 00 on the right and −1.2533-1.2533 on the left. At 2π/32\pi/3 it is −0.7236-0.7236 on both sides, which is π/2\sqrt{\pi/2} divided by 3\sqrt3. At 2π/52\pi/5 it is 0.56050.5605 and −0.5605-0.5605, which is π/2\sqrt{\pi/2} divided by 5\sqrt5. The square roots of the denominators are the signature of a quadratic Gauss sum,

g(p,q)=12q∑k=02q−1eiπpk2/q,g(p, q) = \frac{1}{2q}\sum_{k=0}^{2q-1} e^{i\pi p k^2/q},

the average of the points on the unit circle at angles πpk2/q\pi p k^2/q. Its size is 1/q1/\sqrt q or zero, according to the parities of pp and qq — the same sums that square to a prime in the proof of quadratic reciprocity.

Riemann's function at every fraction: the cusp is a Gauss sum. 0/1: right 1.253 (pred 1.253), left -1.253 (pred -1.253); 1/1: right 0.000 (pred -0.000), left -0.000 (pred -0.000); 1/2: right 0.000 (pred 0.000), left -1.253 (pred -1.253); 3/2: right 1.253 (pred 1.253), left -0.000 (pred 0.000); 1/3: right -0.000 (pred -0.000), left 0.000 (pred 0.000); 2/3: right -0.723 (pred -0.724), left -0.723 (pred -0.724); 4/3: right 0.723 (pred 0.724), left 0.723 (pred 0.724); 5/3: right -0.000 (pred 0.000), left 0.000 (pred -0.000); 1/4: right 0.000 (pred 0.000), left -0.886 (pred -0.886); 3/4: right -0.886 (pred -0.886), left 0.000 (pred -0.000); 5/4: right -0.000 (pred -0.000), left 0.886 (pred 0.886); 7/4: right 0.886 (pred 0.886), left -0.000 (pred 0.000); 1/5: right 0.000 (pred -0.000), left -0.000 (pred -0.000); 2/5: right 0.560 (pred 0.560), left -0.560 (pred -0.560); 3/5: right 0.000 (pred -0.000), left 0.000 (pred 0.000); 4/5: right -0.560 (pred -0.560), left 0.560 (pred 0.560); 6/5: right -0.560 (pred -0.560), left 0.560 (pred 0.560); 7/5: right -0.000 (pred -0.000), left -0.000 (pred 0.000); ….
Fig. 3 For the thirty-six fractions p/qp/q with q≤7q \le 7, the measured coefficient of ∣h∣\sqrt{|h|} (vertical) against π/2 (Re⁡g∓Im⁡g)\sqrt{\pi/2}\,(\operatorname{Re} g \mp \operatorname{Im} g) predicted from the Gauss sum (horizontal), right side warm and left side cool. Every point lies on the diagonal, and the thirteen fractions with pp and qq both odd sit at the centre on both sides.

The rule the figure checks is

R ⁣(πpq+h)−R ⁣(πpq)≈π∣h∣2 (Re⁡g−Im⁡g)−h2R\!\left(\tfrac{\pi p}{q} + h\right) - R\!\left(\tfrac{\pi p}{q}\right) \approx \sqrt{\tfrac{\pi |h|}{2}}\,\bigl(\operatorname{Re} g - \operatorname{Im} g\bigr) - \tfrac{h}{2}

for h>0h > 0, and the same with π∣h∣/2 (Re⁡g+Im⁡g)\sqrt{\pi |h|/2}\,(\operatorname{Re} g + \operatorname{Im} g) subtracted instead for h<0h < 0. Every one of the seventy-two measured coefficients matches its prediction to within 0.010.01. The Gauss sum is zero exactly when pp and qq are both odd, and at those points the square-root term vanishes on both sides. What is left is the linear term −h/2-h/2 — a derivative of −12-\tfrac12.

Why the slope is minus one-half

The rule has a reason, and the reason explains the −12-\tfrac12 as well. The formal derivative of RR is ∑n≥1cos⁡(n2x)\sum_{n \ge 1} \cos(n^2 x), which is the real part of ∑n≥1ein2x\sum_{n \ge 1} e^{in^2 x}. Add in the missing n=0n = 0 term and the negative nn, and that is half of Jacobi’s theta function, θ(x)=∑n∈Zein2x\theta(x) = \sum_{n \in \mathbb{Z}} e^{i n^2 x}, minus one-half. Theta is not a function in the ordinary sense on the real line, but it has a precise local structure. Near x=πp/qx = \pi p/q the identity that relates theta at xx to theta at −1/x-1/x, the one that makes it a modular form, says it behaves like the Gauss sum g(p,q)g(p,q) times a singularity of size ∣h∣−1/2|h|^{-1/2}, plus terms that are much smaller.

Integrating the derivative turns ∣h∣−1/2|h|^{-1/2} into ∣h∣1/2|h|^{1/2} — the square-root cusp — with the Gauss sum as its coefficient. And the constant −12-\tfrac12 from the missing n=0n = 0 term integrates to −h/2-h/2, the linear term that is present at every point. Where the Gauss sum vanishes, the singular part of theta vanishes with it, and the only thing left at leading order is that constant. The derivative of −12-\tfrac12 is the ghost of the term n=0n = 0, which the series leaves out because sin⁡(0)/02\sin(0)/0^2 means nothing.

This is also why Riemann’s function is self-similar under magnification. Theta’s modular symmetry maps a neighbourhood of one rational point onto a neighbourhood of another, so the picture at 2π/32\pi/3 is the picture at 00 transformed, shrunk by a factor set by the denominator. Hans Duistermaat made this precise in 1991. The 1/q1/\sqrt q in the coefficients is the shrinking.

The slope, measured

The rule predicts a derivative of −12-\tfrac12 at every π×odd/odd\pi \times \text{odd}/\text{odd}. Measured directly, by symmetric difference quotients:

Difference quotients of Riemann's function settling on minus one-half. π: -0.313, -0.497, -0.508, -0.502, -0.500; π/3: -1.327, -0.700, -0.544, -0.502, -0.500; 3π/5: -0.269, -0.425, -0.533, -0.498, -0.499; 5π/7: -0.991, -0.866, -0.529, -0.510, -0.497.
Fig. 4 The symmetric difference quotient (R(x+h)−R(x−h))/2h(R(x+h) - R(x-h))/2h at π\pi, π/3\pi/3, 3π/53\pi/5 and 5π/75\pi/7, for hh from 0.10.1 down to about 3×10−73 \times 10^{-7}. The quotients wander while the window still contains nearby cusps and settle on −12-\tfrac12 from hh near 10−410^{-4}.

At large hh the quotients wander widely, because a window of width 0.10.1 around 3π/53\pi/5 contains other fractions with small denominators and their cusps. As hh shrinks the window excludes them one by one. By h=10−4h = 10^{-4} all four quotients are within a few hundredths of −12-\tfrac12, and at the smallest hh they agree with it to two decimal places. 5π/75\pi/7, whose Gauss-sum structure involves the larger denominator 7, settles last.

Joseph Gerver proved in 1970 that RR has derivative exactly −12-\tfrac12 at every point π(2a+1)/(2b+1)\pi(2a+1)/(2b+1), overturning the general belief that Riemann’s function was nowhere differentiable. G. H. Hardy had shown in 1916 that RR has no derivative at any irrational multiple of π\pi and at many rational ones, and believed the rest would follow. Gerver completed the picture in 1971 by showing that every other point fails.

How rough the rest of it is

A point without a derivative can still have a definite roughness. The increment may scale like ∣h∣α|h|^\alpha for a single exponent α\alpha, its Hölder exponent, and the exponent can differ from point to point. Here it does.

Three rates at which Riemann's function changes. π, minus the slope: slope 1.509; 2π/3: slope 0.502; π(√5 − 1)/2: slope 0.764.
Fig. 5 The size of the increment at three points as hh shrinks, on logarithmic scales: at π\pi with the slope removed, at 2π/32\pi/3, and at π(5−1)/2\pi(\sqrt5 - 1)/2. Fitted slopes 1.51, 0.50 and 0.76. At the irrational point the curve climbs in uneven steps as the window passes each nearby fraction.

At 2π/32\pi/3 the slope is 0.500.50: a square-root cusp, exponent 12\tfrac12. At π\pi, once the −h/2-h/2 is removed, what is left shrinks like ∣h∣1.51|h|^{1.51} — the next term in the expansion is of order ∣h∣3/2|h|^{3/2}, with a coefficient that oscillates without settling. At the irrational point the slope over four decades is 0.760.76, but the curve is not a straight line. It rises in steps, steep where the window crosses a fraction whose Gauss sum is large and shallow where it does not, and a fit over a single decade gives anything from about 0.30.3 to 1.31.3.

Stéphane Jaffard computed the whole spectrum in 1996. At an irrational multiple of π\pi, the exponent depends on how well the point is approximated by fractions whose Gauss sums do not vanish — fractions with pp or qq even — and for almost every point it is exactly 34\tfrac34. Points approximated unusually well by such fractions have exponents down to 12\tfrac12. So the function is rougher than a smooth function and smoother than a square root almost everywhere, and the roughness at a point is a statement about how close a fraction can get to that point. The golden ratio, the hardest number to approximate, sits at the typical value. The same kind of point-by-point exponent appeared for the devil’s staircase and its measure, where it was set by a self-similar rule; here it is set by arithmetic.

Where the derivative exists

Sort every fraction with denominator up to 25 by what its Gauss sum says.

Where Riemann's function has a derivative, among the fractions. Fractions with q ≤ 25: odd 137, right 63, left 63, both 137.
Fig. 6 Every fraction p/qp/q in lowest terms with q≤25q \le 25, placed at πp/q\pi p/q on one period and sorted by kind: 137 with pp and qq both odd, where the derivative exists; 63 flat to the right; 63 flat to the left; and 137 with a cusp on both sides.

The derivative exists only in the top row. Those points are dense — between any two points of the period there are fractions with odd numerator and odd denominator — but they are countable, so they have measure zero, and everything between them, rational or irrational, has no derivative. Riemann’s function is differentiable on a set that meets every interval and occupies none of it.

The two middle rows are the one-sided cases. At those points one side of the Gauss sum’s combination vanishes and the other does not, so the function is flat with slope −12-\tfrac12 on one side and has a square-root cusp on the other. π/2\pi/2 is the first of them. That such points exist at all is a surprise: a function with a genuine one-sided derivative on a dense set of points, and a cusp on the other side of each.

What the computation cannot establish

A million terms and an exponent fitted over four decades establish the pattern. They do not prove it, and three things are beyond them. The first is the limit itself. A difference quotient that agrees with −12-\tfrac12 to two decimal places at h=3×10−7h = 3 \times 10^{-7} is evidence, and the derivative is a statement about h→0h \to 0; Gerver’s proof is what makes it a theorem.

The second is the irrational points. The exponent 34\tfrac34 for almost every point is Jaffard’s theorem, and the measured 0.760.76 is consistent with it. But a measurement at one irrational point cannot distinguish 34\tfrac34 from 0.70.7 or 0.80.8 when the local slope swings by a factor of four between decades, and the measurement says nothing about the exceptional points with smaller exponents, which exist but have measure zero.

The third is the role of the Gauss sum. The figure shows the coefficients matching the prediction at thirty-six fractions; the theta-function argument says why. The match at every fraction is a theorem, proved by the same modular identity, and no finite figure substitutes for it.

Still open: other series and the fine structure

Riemann’s function is now one of the best-understood rough functions: its derivative, its exponents, its self-similarity and its multifractal spectrum are all known. Much of that is because theta is a modular form, and the knowledge does not transfer to series without that structure. For ∑sin⁡(n3x)/n3\sum \sin(n^3 x)/n^3, or for sums over the primes such as ∑sin⁡(px)/p\sum \sin(p x)/p, the analogous questions — where is there a derivative, and what is the exponent at a typical point — are largely open, because no modular symmetry organises the phases. Sums with cubic phases lead into the theory of Weyl sums, where much less is known.

There is also a question about the complex version, ∑ein2x/n2\sum e^{i n^2 x}/n^2, whose real part is close to Riemann’s function and whose image in the plane is a curve. That curve turns out to describe the motion of a corner of a vortex filament — a thin tube of spinning fluid shaped initially as a polygon — in work by Francisco de la Hoz and Luis Vega. Whether the curve’s fractal dimension, its geometric self-similarity and its behaviour at irrational times can be computed in the same detail as the real part’s is an active question. So is whether any of it can be seen in a real fluid.

A candidate that nearly worked

Riemann’s function was offered as a function with no derivative, and for nearly a century it was assumed to be one. It is instead a function whose derivative exists on a countable dense set of points and is the same number at every one of them. The number is −12-\tfrac12, left by a term that the series omits, and the points are exactly those where a sum of 2q2q points on the unit circle cancels to zero. The roughness everywhere else has three regimes — square roots at most fractions, three-quarter powers almost everywhere, and the exceptions between — and every one of them is read from how well a point can be approached by fractions whose Gauss sums do not vanish.

A curve with a corner at every point built its roughness by design, choosing ratios that guarantee a corner at every scale. Riemann’s function was not designed that way, and it shows what a natural series can do instead. It is smooth almost nowhere and differentiable exactly where number theory says, and Weierstrass’s search for a proof failed because there was nothing to prove.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A dashed tag is an object no other essay names yet.

Dense setDerivativeDifferentiabilityFourier seriesMeasure zeroRational approximation