Analysis

A coin in front of every term

Put all plus signs in front of 1, 1/2, 1/3, … and the sum runs off to infinity; alternate them and it settles on log 2. Toss a fair coin for each sign instead, and the sum settles — every time, on a different number. Where it tends to settle has a smooth, flat-topped shape, and at the value 2 that shape takes a height that agrees with one eighth to forty-two decimal places and is not one eighth.
20 min read 5 figures Order out of noiseSmall cases lie

Worth reading first: The same terms, in a different order, adding to whatever is asked · A bell curve assembled out of coin flips.

The harmonic terms 1,12,13,1, \tfrac12, \tfrac13, \dots have been added two ways so far. With every sign a plus they diverge, slowly but past every number. With the signs alternating they converge to log2\log 2, and rearranging those same terms can make them converge to anything at all. Both sign patterns were chosen. The question here is what happens when nobody chooses — when a fair coin is tossed for each term, heads for plus and tails for minus.

The answer is not obvious in advance. A random sign pattern will have long runs of plus signs, and a run of plus signs on the harmonic terms is exactly what makes them diverge. It will also have long runs of minus signs. Whether the runs cancel well enough, and what the sum does if they do, is a question about the balance between how fast the terms shrink and how badly a coin can misbehave.

12 harmonic series with random signs, each settling on its own sum. Partial sums of the harmonic series with each sign chosen by a fair coin, for several independent runs, plotted against the number of terms on a logarithmic scale, beside the all-plus and alternating sign patterns.
Fig. 1 Twelve runs of 1 ± 1/2 ± 1/3 ± … to 400 terms, each sign a fair coin, on a logarithmic count of terms. Every run settles, each on a different number — from −2.16 to 1.48 in this batch. The dashed curves are the two fixed patterns: all plus signs, which grows like log n, and alternating signs, which settles on log 2 ≈ 0.693.

Every run settles. The first few terms throw each one around — a term of size one half or one third moves the sum a long way — and by a hundred terms each run is creeping along at nearly constant height. The heights differ from run to run, which is the second thing the picture says: the random sum converges, and its limit is itself random. There is no single answer, only a distribution of answers.

Why random signs cancel well enough

The all-plus sum grows like logn\log n because the terms add without cancellation, and 1/k\sum 1/k over kk up to nn is about logn\log n. With random signs the terms partly cancel, and the question is how much.

A bell curve assembled out of coin flips measured exactly this for terms of equal size: a sum of nn random signs has typical size n\sqrt n, not nn, because the variance of a sum of independent pieces is the sum of their variances. The same rule applies to unequal pieces. The term ±1/k\pm 1/k has variance 1/k21/k^2, so the variance of the whole random sum is

1+14+19+116+=π26,1 + \frac14 + \frac19 + \frac1{16} + \dots = \frac{\pi^2}{6},

finite, although the sum of the terms themselves is infinite. That is the whole reason the random series converges. Cancellation by random signs replaces the terms by their squares, and the squares of the harmonic terms add up to something finite even though the terms do not. The variance still left after the first NN terms is about 1/N1/N, so the sum’s wobbling beyond that point shrinks towards nothing; this was proved for this kind of series by Hans Rademacher in 1922 and put into general form by Andrei Kolmogorov a few years later.

The number π2/6\pi^2/6 is also the variance of the limit, so the limits have a standard deviation of about 1.281.28. That matches the spread of the twelve runs in the figure, most of which end within about 1.31.3 of zero.

The same arithmetic says how slowly a random run settles. After NN terms the unsettled remainder has standard deviation about 1/N1/\sqrt N, so pinning a random limit down to three decimal places takes around a million terms. The alternating series, whose signs are chosen to cancel as well as possible, is within 1/(2N)1/(2N) of log2\log 2 after NN terms and needs only about five hundred for the same accuracy. Random cancellation is enough for convergence and much worse than deliberate cancellation at achieving it, which is the difference between the settling runs in the figure and the flat dashed line among them.

The threshold moves from one to one half

That argument does not care that the terms are 1/k1/k; it cares only that their squares add up to something finite. So it predicts where the boundary between convergence and divergence sits for terms 1/kp1/k^p with random signs.

Random signs on 1/nᵖ: the runs settle exactly when p is above one half. Panels for several exponents p, each showing random-sign partial sums of the series of 1/n to the power p against the logarithm of the number of terms. Below one half the paths wander; above it they settle.
Fig. 2 Six random-sign runs of ±1/np\sum \pm 1/n^p to 20,000 terms for p=0.4p = 0.4, 0.50.5, 0.750.75 and 11, on a logarithmic count and each panel on its own vertical scale. Below p=1/2p = 1/2 the runs keep wandering; above it they settle. At p=1/2p = 1/2 itself the runs drift like the square root of logn\log n.

With plus signs throughout, 1/kp\sum 1/k^p converges exactly when p>1p > 1. With random signs, the variance 1/k2p\sum 1/k^{2p} is finite exactly when p>12p > \tfrac12, and the random series converges exactly when p>12p > \tfrac12. Below that the variance grows without bound and the random sum wanders forever, never settling; Kolmogorov’s three-series theorem makes that a certainty rather than a tendency. At p=12p = \tfrac12 exactly the variance is the harmonic sum itself, which grows like logn\log n, so the runs drift like logn\sqrt{\log n} — the slowest possible way of not converging, and in the figure hard to tell from convergence.

The threshold has halved, and the reason is the square root in the size of a random walk. Terms of size 1/k1/\sqrt k with random signs behave like a random walk whose steps shrink just fast enough to keep it from ever settling. Shrink them a little faster and it settles; a little slower and it wanders. The line between the two is exactly where fixed signs would already have been hopeless.

The coin is a single number in disguise

A sequence of fair coin tosses has an exact deterministic stand-in: the binary digits of a number chosen uniformly between 0 and 1. Its first digit is 0 or 1 with equal chance, its second likewise, independently, and so on. So the random harmonic sum can be written as an ordinary function of one number xx: read the kk-th binary digit of xx, and give the kk-th term a plus sign if the digit is 0 and a minus sign if it is 1.

The random harmonic sum as a function of one number's binary digits. The harmonic sum with signs determined by the binary digits of x, plotted for every x between 0 and 1. The graph is a jagged, self-similar function; the proportion of x giving each value is the distribution of the random series.
Fig. 3 The sum 1 ± 1/2 ± … ± 1/14 with its signs read from the first fourteen binary digits of x — plus for 0, minus for 1 — plotted over every x between 0 and 1. It is one jagged function, not a random one. At x = 0 all signs are plus and the sum is H(14) = 3.252; x = 1/3, whose binary digits alternate, gives the alternating signs and a value near log 2.

The graph is a single jagged, self-similar function. The largest value is at x=0x = 0, where every digit is 0 and every sign plus. The alternating series lives at x=13x = \tfrac13, whose binary expansion is 0.0101010.010101\ldots — plus, minus, plus, minus. The limit exists for every xx except a set of total length zero, which is what “the random sum converges with probability one” means in this language, and the question “how likely is the sum to land between aa and bb” becomes “what total length of xx gives a value between aa and bb”.

This rewriting is due to Hugo Steinhaus in the 1920s and 1930s, and it is the same idea the orbit written as a word used to turn a dynamical system into a sequence of letters. Probability disappears entirely: a fair coin becomes a uniform point, independence becomes the arithmetic of binary digits, and a statement about random sums becomes a statement about one function and the lengths of the sets where it takes each value.

Where the sum lands

The distribution of the limit can be computed exactly, by a route that avoids simulation altogether.

The characteristic function of a random variable — the average of cos(tX)\cos(tX) — turns sums of independent pieces into products. The sign ±1/k\pm 1/k contributes the factor cos(t/k)\cos(t/k), so the random harmonic sum has characteristic function

φ(t)=cos(t)cos ⁣(t2)cos ⁣(t3),\varphi(t) = \cos(t)\cos\!\left(\tfrac t2\right)\cos\!\left(\tfrac t3\right)\cdots,

a product of cosines that converges because cos(t/k)\cos(t/k) is close to 1t2/2k21 - t^2/2k^2 for large kk. From φ\varphi the density follows by Fourier inversion, the same operation that assembles a square wave out of round ones, run in the other direction.

Where a harmonic series with random signs lands. A histogram of many sampled values of the random harmonic series, overlaid with its probability density computed independently. The density is flat-topped near zero, falls steeply beyond two, and takes the value one eighth at two to astonishing accuracy.
Fig. 4 Twenty thousand seeded values of ±1/n\sum \pm 1/n as a histogram, and the density computed from the product of cosines as the curve — two independent calculations that agree. The density at 00 is 0.24999440.2499944, visibly short of 1/41/4. At ±2\pm 2 it is 0.1250000000000.125000000000 to every digit computed here, and by Schmuland’s calculation it differs from 1/81/8 only in the 42nd decimal place.

The histogram of simulated sums and the curve from the product of cosines are separate computations, and they agree. The shape has a broad flat top — the density barely changes between 1-1 and 11 — and then falls steeply on both sides. Two values stand out. At the centre the density is 0.24999440.2499944, which looks like a quarter until the sixth decimal place. At ±2\pm 2 it is 0.1250.125, to every digit a double-precision computation can produce.

Byron Schmuland computed it to many more digits in 2003 and found that it is not one eighth. It agrees with 18\tfrac18 to forty-two decimal places and then differs. The near-miss at the centre, in the sixth place, is at least visible; the near-miss at 2 is not visible to any computation of ordinary precision, and a reader who trusted fifteen digits would conclude, wrongly, that the density there is exactly one eighth.

A tail thinner than any bell’s

Its variance is π2/6\pi^2/6, and a sum of many small independent pieces usually looks like a bell curve. Near the middle the random harmonic sum does look like one. Far out it does not, and the difference is dramatic.

The tail of the random harmonic sum, far thinner than a normal curve's. The probability density of the random harmonic series and a normal density of equal variance, plotted on a logarithmic vertical scale from the centre outwards. The random series falls away much faster beyond two.
Fig. 5 The density of ±1/n\sum \pm 1/n (orange) and a normal curve with the same variance π2/6\pi^2/6 (dashed), on a logarithmic scale out to 4.54.5. They agree near the middle and part company beyond 2. At 44 the random sum’s density is 2.8×1062.8 \times 10^{-6} and the normal curve’s is 2.4×1032.4 \times 10^{-3}, about a thousand times more.

The reason is that the sum is not made of many small pieces. Its first few terms are large — one, a half, a third — and the only way to reach a value like 4 is for many of them to carry the same sign. The all-plus sum reaches 4 after 31 terms, as the sum that steps over every whole number counted, so landing near 4 needs roughly the first thirty signs to agree, and the chance of that is around 2302^{-30}. Reaching 5 needs the first eighty or so, 6 needs two hundred and more: the number of signs that must cooperate grows exponentially with the target, so the probability of reaching it falls doubly exponentially. A normal curve’s tail falls like ex2/2σ2e^{-x^2/2\sigma^2}, which is fast; this one falls like the exponential of an exponential, which is far faster.

This is the precise sense in which the random harmonic sum is not a bell curve. The central limit theorem needs every piece to be negligible compared with the total, and here the first piece alone is the size of the standard deviation. The tail is not a bell found the opposite failure — tails far heavier than normal — when a sum was dominated by rare huge terms. Here the terms are fixed in size and the tail is lighter than normal, because the largest pieces are few and a coin must line them all up.

Signs chosen by a rule instead

The coin replaced a choice of signs by a distribution of choices. Going back the other way — choosing the signs by some rule — shows what the coin was doing and how special it is to land on a particular number.

A repeating pattern converges exactly when it adds to nothing over one period. With the signs +,+,,+, +, -, - repeating, each block of four terms is 14j+1+14j+214j+314j+4\tfrac1{4j+1} + \tfrac1{4j+2} - \tfrac1{4j+3} - \tfrac1{4j+4}, which shrinks like 1/j21/j^2, and the series converges — to π4+12log2=1.1320\tfrac\pi4 + \tfrac12\log 2 = 1.1320, as it happens, a value that mixes the constants of the alternating series and of the series 1 − 1/3 + 1/5 − … for π/4, each of which the pattern contains. With +,+,+, +, - repeating, each block leaves over about 13j\tfrac1{3j}, and the leftovers add like a third of the harmonic series: divergence, like 13logn\tfrac13\log n. A periodic pattern with any surplus of plus signs over a period behaves like that surplus times the harmonic series. The coin never commits to a surplus, which is why it converges.

The primes choose a pattern that lands exactly on zero. Give the nn-th term the sign of the Möbius function: plus if nn is a product of an even number of distinct primes, minus for an odd number, and drop the term if nn has a repeated prime factor. The sum

1121315+1617+1101 - \frac12 - \frac13 - \frac15 + \frac16 - \frac17 + \frac1{10} - \cdots

has partial sums 0.0310.031 after a hundred terms, 0.00440.0044 after a thousand, 0.0021-0.0021 after ten thousand and 0.00049-0.00049 after a hundred thousand, and it converges to exactly 00. Hans von Mangoldt proved that in 1897, and Edmund Landau showed that the statement is equivalent to the prime number theorem — the fact that the primes up to xx number about x/logxx/\log x.

Seen against the figures above, that is remarkable. A sign pattern chosen by a fair coin lands at zero with probability zero; the density there is about a quarter per unit length, so a random sum lands within a thousandth of zero about one time in two thousand, and exactly at zero never. The Möbius signs look random in many statistical respects — that impression is a whole research programme — and yet they conspire to land the sum precisely on zero, and proving that they do is as hard as counting the primes.

Rearrangements are a different kind of choice. Riemann’s theorem reaches any target by choosing the order of fixed signs, spending positive terms until the sum passes the target and negative terms until it comes back. That needs both kinds of term to have infinite sum on their own — which is exactly what happens when the terms are ±1/k\pm 1/k with infinitely many of each. Random signs supply infinitely many of each almost surely, so a random sign pattern, reordered, can also be made to converge to anything; left in its natural order it converges to its own random limit. The coin decided the signs and the order decided the sum, and the two decisions are separate.

What the pictures cannot show

The limit itself, for any particular run. Each coloured run in the first figure is drawn for four hundred terms. Its final value is not its limit; the terms beyond still move it, by an amount with standard deviation about 1/400=0.051/\sqrt{400} = 0.05. The runs have settled to the eye, not to the number, and no finite drawing can show the limit of a series that converges this slowly.

The forty-second decimal. The density figure prints the value at 2 to twelve places and states the rest. A double-precision Fourier inversion cannot resolve a difference of 104210^{-42}; that comes from Schmuland’s high-precision computation and from his analysis of why it is so small, not from anything drawn here.

The shape of the jagged function in full. The function of xx is drawn with fourteen binary digits, so it has 2142^{14} steps. The true function uses all the digits and is defined only almost everywhere — at a set of xx of total length zero its series diverges, and near such points the graph has spikes no drawing at any resolution can contain.

Why the value at 2 is almost exactly an eighth

The near-miss at 2 has an explanation, and it is short enough to give. Split the sum into its first two terms and the rest: S=±1±12+TS = \pm 1 \pm \tfrac12 + T, where T=±13±14±T = \pm\tfrac13 \pm \tfrac14 \pm \cdots. The first two signs put SS in one of four bands, centred at 32-\tfrac32, 12-\tfrac12, 12\tfrac12 and 32\tfrac32, each with chance one quarter, and TT spreads each band out. So the density at 2 is a quarter of the density of TT at four points, 12\tfrac12, 32\tfrac32, 52\tfrac52 and 72\tfrac72.

Now a property of TT that looks like a coincidence. Its characteristic function is the product of cos(t/k)\cos(t/k) for k3k \ge 3, and at t=2πmt = 2\pi m the factor with k=4mk = 4m is cos(π/2)=0\cos(\pi/2) = 0. So the characteristic function of TT vanishes at every non-zero multiple of 2π2\pi, and by the Poisson summation formula that says exactly this: the copies of TT’s density shifted by all the whole numbers add up to a perfectly flat line of height one. Folded onto an interval of length one, TT is exactly uniform.

Put the two facts together. By symmetry, the values of TT’s density at 12,32,52,\tfrac12, \tfrac32, \tfrac52, \dots add up to exactly one half. The density of SS at 2 is a quarter of the first four of them — so it is 18\tfrac18 minus a quarter of the values at 92,112,\tfrac92, \tfrac{11}2, \dots. For TT to reach 92\tfrac92 its terms from 13\tfrac13 onwards must add like the all-plus sum for a couple of hundred terms — the all-plus sum from 13\tfrac13 needs 227 terms to get there — and that is where the deficit of about 104210^{-42} comes from. At 0 the same argument subtracts values of TT’s density at 52\tfrac52 and beyond, which are around 10510^{-5} — which is why the value at the centre visibly misses a quarter and the value at 2 invisibly misses an eighth. The coincidence is the term 14\tfrac14, whose cosine vanishes at π/2\pi/2, and the rest is how thin the tail is.

Still open: signs on a geometric sequence

The harmonic terms give a distribution whose density is smooth, positive everywhere and computable to any accuracy. Change the terms and much less is known. Replace 1/k1/k by λk\lambda^k for a fixed λ\lambda between one half and one: the random sum ±λk\sum \pm \lambda^k is called a Bernoulli convolution, and the question is whether its distribution has a density at all or is concentrated on a set of length zero.

Paul Erdős showed in 1939 that for some special values — λ\lambda the reciprocal of the golden ratio is the first — it has no density: the distribution lives on a set of zero length, although it is spread over a whole interval. Boris Solomyak showed in 1995 that it does have a density for almost every λ\lambda between one half and one, and later work has settled many specific algebraic values. For most individual values of λ\lambda, whether the random geometric sum has a density is still open, which puts one of the simplest random series imaginable beyond current methods, one change of term away from the harmonic series, whose answer is completely understood.

Randomness halves the threshold

The harmonic series diverges with every sign positive and converges with signs alternating; with a coin for each sign it converges almost always, because random cancellation turns the terms into their squares and the squares add up to π2/6\pi^2/6. The price is that the answer is no longer a number but a distribution, spread with standard deviation 1.281.28, flat on top, and far thinner in its tails than a bell curve because its biggest terms are few.

Read through binary digits, the same distribution is the shape of one jagged function on the unit interval, with no probability in it at all. And its height at 2 is one eighth for forty-two decimal places and then is not — a fact that no picture and no ordinary computation could have revealed, and a reminder that a number agreeing with a simple fraction to every digit anyone checked is evidence, not proof.

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.

Almost surelyBinary expansionCharacteristic functionConvergenceHarmonic seriesProbability densityRandom walkVariance