Algebra

Almost none of the roots are real

Pick the coefficients of a polynomial of degree a thousand at random, each one an independent draw from the bell curve, and ask how many of its thousand roots are real. The answer is about five. Mark Kac found in 1943 that the average grows only like (2/π) ln n, and the reason can be read off the real line itself: the real roots crowd towards +1 and −1 and spread evenly on a logarithmic scale of distance from them.

Worth reading first: The roots of the slope stay inside · A loop that cannot miss the middle.

A polynomial of degree nn has exactly nn roots in the complex numbers, counted with multiplicity, and what the coefficients already know is how much the coefficients say about them before any is found: their sum, their product, and every symmetric combination. A loop that cannot miss the middle proved it by watching the image of a large circle wind round the origin nn times. How many of those roots are real is a different question, and for a particular polynomial it can be anything from nn down to nought or one, depending on the parity of nn. The polynomial (x−1)(x−2)⋯(x−n)(x-1)(x-2)\cdots(x-n) has all its roots real; xn+1x^n + 1 has at most one.

So ask it of a typical polynomial. Choose each coefficient independently from the standard normal distribution — the bell curve of mean nought and spread one — and count the real roots. A quadratic ax2+bx+cax^2 + bx + c has two real roots when b2>4acb^2 > 4ac and none otherwise, and with normal coefficients the average count is about 1.301.30. A polynomial of degree thirty might be expected to have many more. It usually has two or four.

The average number of real roots of a random polynomial of degree nn grows like 2πln⁡n\tfrac{2}{\pi} \ln n. Mark Kac proved it in 1943, and it means that almost all the roots of a random polynomial leave the real line: of a thousand roots, about five are real. This essay computes the average exactly, checks it against samples, and then finds the reason for the logarithm in where on the line the real roots sit.

Thirty roots and two of them real

The roots of random polynomials of degree 30 and 100: few are real. degree 30: 2 real roots at -2.335, -1.074; degree 100: 2 real roots at -0.327, 0.994.
Fig. 1 The roots of two polynomials whose coefficients are independent draws from the standard normal distribution: degree 30 on the left and degree 100 on the right, with the real roots marked large and the unit circle drawn. Two of the thirty roots are real, and two of the hundred.

The two polynomials in the figure were drawn at random and their roots found numerically. Every root reported was checked by substituting it back, and every root called real was checked again by the polynomial changing sign across it. The degree-30 polynomial has two real roots, at −2.335-2.335 and −1.074-1.074. The degree-100 polynomial also has two, at −0.327-0.327 and 0.9940.994. All the other roots come in pairs a±bia \pm bi, mirror images across the real line, as the roots of any polynomial with real coefficients must.

Two features stand out beyond the count. The complex roots are not scattered across the plane: they sit close to the unit circle, closer for the higher degree. And the real roots that do occur tend to be near +1+1 or −1-1 — the circle’s two points on the real line. The first feature is the subject of a separate essay. The second turns out to explain the count.

A polynomial with real coefficients crosses the real axis at each real root. A polynomial of high degree with random coefficients oscillates, but the oscillation of a sum of many random terms is mostly cancellation, and a sign change of the whole requires the terms to line up in a particular way. The question is how often that happens across the line, and the answer is a density.

Two small cases by hand

The smallest cases can be settled without any formula for the density, and they already show the count falling behind the degree. A quadratic ax2+bx+cax^2 + bx + c with independent normal coefficients has real roots exactly when its discriminant b2−4acb^2 - 4ac is positive. The product 4ac4ac of two independent normals is as often negative as positive, and when it is negative the discriminant is certainly positive; when it is positive, b2b^2 has to beat it. A simulation of two million quadratics finds real roots in 64.9% of them, so the average number of real roots is about 1.301.30 — the first point of the curve below, where the exact integral gives 1.2971.297.

A cubic always has at least one real root, and has three exactly when its discriminant is positive. Among 400,000 random cubics the discriminant was positive in about a quarter, and the average count was 1.491.49. So the quadratic realises 65%65\% of its possible real roots on average, and the cubic only half: already at degree three, most of the room the degree allows is going unused.

The pattern continues, and the sections below show why it continues in exactly the way it does. At degree nn the share of roots that are real is the average count divided by nn: about one in eight at degree twenty, one in twenty-eight at degree a hundred, one in two hundred at degree a thousand.

The count computed exactly, and a logarithm

How many roots of a random polynomial are real, against its degree. degree 2: exact 1.297, sampled 1.23; degree 4: exact 1.640, sampled 1.77; degree 8: exact 2.022, sampled 2.03; degree 16: exact 2.429, sampled 2.20; degree 32: exact 2.851, sampled 3.10; degree 64: exact 3.283, sampled 3.15; degree 128: exact 3.720, sampled 3.85; degree 1,000: 5.024.
Fig. 2 The average number of real roots of a polynomial of degree nn with independent standard normal coefficients: the exact value from the Kac–Rice formula (solid), the mean of 120 random polynomials at each degree marked (dots with two standard errors), and the law 2πln⁡n+0.6257\tfrac{2}{\pi}\ln n + 0.6257 (dashed). A degree-1,024 polynomial averages 5.04 real roots.

Kac’s method is to count sign changes in expectation. At each point xx of the real line, the value p(x)=a0+a1x+⋯+anxnp(x) = a_0 + a_1 x + \cdots + a_n x^n is itself a normal random variable, since it is a fixed combination of independent normal coefficients; so is its derivative p′(x)p'(x). The chance that pp crosses nought in a tiny interval [x,x+dx][x, x + dx] depends only on the joint distribution of p(x)p(x) and p′(x)p'(x), which is a pair of correlated normals, and working it out gives an expected number of crossings per unit length. This is now called the Kac–Rice formula, after Kac and Stephen Rice, who found the same principle for random signals in 1944.

For coefficients all of variance one the formula reads

E Nn=4π∫011(1−x2)2−(n+1)2x2n(1−x2n+2)2  dx,\mathbb{E}\,N_n = \frac{4}{\pi} \int_0^1 \sqrt{\frac{1}{(1-x^2)^2} - \frac{(n+1)^2 x^{2n}}{(1-x^{2n+2})^2}}\;dx,

the factor four accounting for the four stretches (−∞,−1)(-\infty,-1), (−1,0)(-1,0), (0,1)(0,1) and (1,∞)(1,\infty), which carry the same expected number of roots by symmetry. The solid curve in the figure is this integral evaluated numerically for every degree from 2 to 1,024. The dots are averages over 120 random polynomials at each marked degree, and every one lies within two standard errors of the curve.

The integral grows like 2πln⁡n\tfrac{2}{\pi} \ln n plus a constant, 0.62570.6257 to four places, which is the dashed line. The approach is quick: the two differ by 0.070.07 of a root at degree eight, by 0.020.02 at degree 32 and by less than a hundredth from degree 128 on, and at degree a thousand the exact value is 5.0245.024. Doubling the degree adds 2πln⁡2≈0.44\tfrac{2}{\pi} \ln 2 \approx 0.44 of a real root, whatever the degree already is.

The constant was computed by J. Ernest Wilkins in 1988, together with further terms of the expansion. Kac’s own proof gave the leading term. What neither the formula nor its expansion says, by itself, is why the logarithm appears — why the real roots are so scarce and yet not bounded. For that the density has to be looked at along the line.

Crowded towards plus and minus one

Where the real roots of a random polynomial of degree 40 fall. 1168 real roots in 400 samples; 576 inside (−1, 1); density at 1 is 3.766.
Fig. 3 Where the real roots of random polynomials of degree 40 fall along the line: a histogram of all 1,168 real roots of 400 samples, per sample and per unit length (bars), against the density given by the Kac–Rice formula (curve). The density peaks sharply at +1+1 and −1-1, and 576 of the roots lie between them.

The density of real roots is far from even. It is low near the origin, rises steeply towards ±1\pm 1, peaks there at 3.773.77 roots per unit length for degree 40, and falls away beyond. The histogram of 1,168 real roots from 400 random polynomials follows it closely.

The reason for the peaks is a competition between terms. For ∣x∣|x| well below 1, the powers xkx^k decay quickly, the first few terms dominate, and p(x)p(x) behaves like a polynomial of small degree, which has few roots. For ∣x∣|x| well above 1 the last few terms dominate and the same is true in reverse. Only near ∣x∣=1|x| = 1 are all n+1n + 1 terms of comparable size, and only there can the sum oscillate rapidly. At x=1x = 1 itself the polynomial is simply the sum of its coefficients, a normal variable with variance n+1n + 1; a little way from 1 the terms are weighted by slowly changing powers, and the sum becomes a slightly different combination of the same coefficients — correlated with the value at 1, but not identical. How quickly that correlation decays as xx moves away from 1 sets how often the sum can change sign, and it decays over a distance comparable to 1−∣x∣1 - |x| itself.

The two halves of the line mirror each other. The polynomial xnp(1/x)x^n p(1/x) has the coefficients of pp in reverse order, which for independent identically distributed coefficients is another polynomial with the same distribution. Its roots are the reciprocals of the roots of pp, so a root of pp at xx inside (−1,1)(-1, 1) is as likely as one at 1/x1/x outside it. The same reversal pairs the power sums of the roots with those of their reciprocals, the quantities every power sum, from the coefficients alone computed without finding a single root. That is why 576 of the 1,168 sampled roots lie between −1-1 and 11: in expectation exactly half do.

Even on a logarithmic ruler

Real roots of random polynomials, measured by how close they sit to ±1. 602 real roots from 150 polynomials of degree 200; mean density 0.723 per unit of −ln(1 − |x|) against 2/π = 0.637; ln 200 = 5.30.
Fig. 4 Every real root xx of 150 random polynomials of degree 200, folded into (−1,1)(-1, 1) by replacing xx with 1/x1/x outside it, and placed at −ln⁡(1−∣x∣)-\ln(1 - |x|): how close it sits to ±1\pm 1 on a logarithmic scale. The curve is the exact density in this coordinate; it settles at 2/π2/\pi per unit (dashed) and stays level out to ln⁡200\ln 200, then falls away.

The peaks become intelligible in the right coordinate. Measure a root’s position not by xx but by how close it is to ±1\pm 1, on a logarithmic scale: t=−ln⁡(1−∣x∣)t = -\ln(1 - |x|), which is nought at the origin, 1 at ∣x∣≈0.63|x| \approx 0.63, 2 at ∣x∣≈0.86|x| \approx 0.86, and ln⁡n\ln n at a distance 1/n1/n from ±1\pm 1. In this coordinate the real roots spread almost evenly.

Near ±1\pm 1 but not too near, the Kac–Rice density is approximately 1/(π(1−x2))1/(\pi(1 - x^2)), and changing variable to tt turns that into a constant. Counting the two signs and the two sides of ±1\pm 1 gives four copies, so the real roots arrive at a steady rate of about 2/π2/\pi per unit of tt — the dashed line in the figure, which the exact curve approaches after starting higher at the origin. The histogram from 150 random polynomials of degree 200 follows the curve.

The even spread stops at t≈ln⁡nt \approx \ln n. Closer to ±1\pm 1 than a distance 1/n1/n, the terms of the polynomial no longer look like a sum of independent pieces — xkx^k hardly changes over the whole range of kk — and the polynomial there behaves like a single smooth random function with no room to oscillate. So the real roots occupy a stretch of length about ln⁡n\ln n in the logarithmic coordinate, at a rate of 2/π2/\pi per unit, and the total is about 2πln⁡n\tfrac{2}{\pi} \ln n.

The logarithm is the length of the region in which a polynomial of degree nn can oscillate, measured on the scale that makes its oscillation uniform. Each doubling of the degree lets the roots come a factor of two closer to ±1\pm 1, which adds ln⁡2\ln 2 to the length of the region and 2πln⁡2\tfrac{2}{\pi} \ln 2 to the count.

The logarithm belongs to equal variances

Expected real roots under three laws for the coefficients. n 4: Kac 1.640, Kostlan 2.000, Weyl 1.716; n 8: Kac 2.022, Kostlan 2.828, Weyl 2.325; n 16: Kac 2.429, Kostlan 4.000, Weyl 3.155; n 32: Kac 2.851, Kostlan 5.657, Weyl 4.299; n 64: Kac 3.283, Kostlan 8.000, Weyl 5.883; n 128: Kac 3.720, Kostlan 11.314, Weyl 8.088.
Fig. 5 The exact expected number of real roots for three ways of choosing independent normal coefficients: all of variance 1 (Kac), variance equal to the binomial coefficient (nk)\binom{n}{k} (Kostlan), and variance 1/k!1/k! (Weyl). At degree 128 the counts are 3.72, 11.31 and 8.09. With binomial variances the count is exactly n\sqrt n.

The count depends on the law chosen for the coefficients, and the logarithm is a feature of giving every coefficient the same spread. Alan Edelman and Eric Kostlan showed in 1995 that the Kac–Rice density has a geometric meaning, and with it computed the answer for other laws. If coefficient aka_k has variance equal to the binomial coefficient (nk)\binom{n}{k}, the expected number of real roots is exactly n\sqrt n, for every nn — the figure’s middle curve passes through 2, 4, 8 at degrees 4, 16, 64 to four decimal places. That law is the natural one from a geometric point of view: it is the only one whose distribution is unchanged by rotating the real projective line, so no point of the line is special.

With variances 1/k!1/k!, the coefficients of the exponential series, the count grows like 2πn\tfrac{2}{\pi}\sqrt n. At degree 128 the ratio to n\sqrt n is still 0.7150.715 and falls towards 2/π≈0.6372/\pi \approx 0.637 only slowly. The real roots of such a polynomial spread roughly evenly over an interval of length about 2n2\sqrt n centred at the origin, rather than crowding near ±1\pm 1.

Equal variances concentrate the action near the unit circle, because that is where equal coefficients make all the terms the same size. Change the weights, and the region where the terms balance moves and changes shape, and the count changes with it. The logarithm is not a universal fact about random polynomials; it is what happens when every power of xx is given the same importance.

Signs as good as bell curves

Real roots with normal coefficients and with coefficients ±1. n 4: normal 1.83, signs 1.20, exact 1.64; n 8: normal 2.18, signs 1.52, exact 2.02; n 16: normal 2.23, signs 1.83, exact 2.43; n 32: normal 3.00, signs 2.62, exact 2.85; n 64: normal 3.22, signs 2.88, exact 3.28; n 128: normal 3.70, signs 3.58, exact 3.72.
Fig. 6 The average number of real roots among 120 random polynomials of each degree, with normal coefficients (blue) or coefficients ±1\pm 1 chosen by a fair coin (red), beside the exact Kac–Rice value for normal coefficients (line). The signs give fewer real roots at low degree, and the gap closes: 3.70 against 3.58 at degree 128.

Kac’s argument uses the normal distribution in an essential way: a fixed combination of normal variables is normal, which is what makes the joint law of p(x)p(x) and p′(x)p'(x) computable. It is natural to ask whether the answer depends on that. Take the simplest possible random coefficients instead — each +1+1 or −1-1 with equal chance.

At low degree the counts differ. A random polynomial of degree four with coefficients ±1\pm 1 has about 1.21.2 real roots on average, against 1.641.64 for normal coefficients. But the gap closes as the degree grows, and at degree 128 the two samples average 3.703.70 and 3.583.58. Paul Erdős and Cyril Offord proved in 1956 that polynomials with coefficients ±1\pm 1 follow the same law: the number of real roots is 2πln⁡n+o(ln⁡n)\tfrac{2}{\pi}\ln n + o(\ln n) with probability tending to one.

The universality has a reason visible in the logarithmic picture. What sets the rate of 2/π2/\pi per unit is how p(x)p(x) behaves on a stretch where many terms contribute comparably, and there the sum of many independent coefficients looks normal whatever the coefficients are, by the principle the bell curve from coin flips made visible. Near the origin only the first few coefficients matter and their actual distribution shows through, which is why small degrees differ. Terence Tao and Van Vu extended the universality in 2015 to a wide class of coefficient laws: the average is 2πln⁡n\tfrac{2}{\pi}\ln n to within an error bounded independently of nn, whatever the law, so long as it has mean nought and a little more than a finite variance.

What the count does not settle

The average is one number about a distribution, and as the average settles and the wobble does not showed for sums of coin tosses, the spread around it carries information the average cannot. The spread is known here too: Nina Maslova showed in 1974 that the variance grows like 4π(1−2π)ln⁡n\tfrac{4}{\pi}(1 - \tfrac{2}{\pi}) \ln n, and that the count, suitably scaled, is asymptotically normal. So a random polynomial of degree a thousand has about 5.0±1.85.0 \pm 1.8 real roots, and a degree-nn polynomial almost never has more than a few times ln⁡n\ln n.

The count also says nothing about which roots are real in a given polynomial. For that the tool is exact and not statistical: the remainders of the Euclidean algorithm applied to pp and p′p', which the remainders that count the roots turned into Sturm’s theorem, count the real roots of any particular polynomial in any interval. The random theory predicts what that count will usually be; Sturm’s sequence finds it for the one polynomial at hand.

And there is a relation to the derivative’s roots. The roots of the slope stay inside showed that the critical points lie inside the convex hull of the roots. For a random polynomial the roots hug the unit circle, so the hull is nearly the whole disc and the theorem says little; the real critical points obey their own law of the same logarithmic kind, since p′p' is again a polynomial with independent normal coefficients, of unequal variances k2k^2.

Still open: the chance of no real root at all

A polynomial of odd degree must have at least one real root, since it tends to opposite infinities at the two ends of the line. A polynomial of even degree can have none. How likely is that for a random polynomial of even degree nn?

The answer decays like a power of the degree, n−bn^{-b}, for some exponent bb. Amir Dembo, Bjorn Poonen, Qi-Man Shao and Ofer Zeitouni proved in 2002 that such a law holds, with bb between 0.40.4 and 22, and their simulations put it at about 0.760.76. The exact value of bb is not known, and it is not even known whether it is a simple number. The same exponent governs the chance that a certain smooth random process stays positive for a long time — a persistence probability — and the corresponding exponents for many such processes are known only numerically.

The difficulty is that the event is global and rare. The Kac–Rice formula counts crossings on average and is blind to their correlations, while the absence of every crossing on the whole line is a statement about all of them at once. A random polynomial with no real root has to stay on one side of the axis across the whole region of length ln⁡n\ln n where it would ordinarily oscillate, and computing the probability of that demands exactly the correlation structure the average ignores.

What the pictures cannot settle

Every count here was obtained by finding every root numerically and checking it, and every real root was confirmed by a change of sign. The exact curves come from evaluating the Kac–Rice integral numerically to high accuracy, and the samples agree with them within their sampling error. None of that is a proof of the asymptotic law; it is the law observed where it can be computed, and the proofs are Kac’s, Erdős and Offord’s, and Edelman and Kostlan’s.

The pictures show averages over some hundreds of polynomials. Individual polynomials vary: among the samples at degree 128 some had one real root and some had eight. The theorem describes what the typical polynomial does, and it leaves room for every atypical one — including the polynomials with all their roots real, which are exactly the ones that the textbooks, choosing their examples by hand, tend to show.

What links here

Computed from the collection, not written here: the essays that point at this one.

Reads more easily once this is understood

Essays that name this one as worth reading first.

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.

Complex numbersDensityExpectationLogarithmNormal distributionPolynomialRandomnessRoots