# The probability that a random (real) cubic has three real roots

We can formalize the notion of the probability that a randomly selected quadratic real polynomial has real roots as follows:

Suppose $R > 0$, and suppose the random variables $a, b, c$ are (independently) uniformly distributed over the interval $[-R, R]$. Let $P_2(R)$ denote the probability that the quadratic polynomial $p(x) := ax^2 + bx + c$ has real roots; what is $P_2 := \lim_{R \to \infty} P_2(R)$?

A quadratic polynomial $p(x) := ax^2 + bx + c$ has two real roots iff its discriminant $$\Delta(p) := b^2 - 4ac$$ is positive, so $$P_2(R) = \frac{1}{8 R^3} \iiint_{[-R, R]^3} \chi_{\{\Delta \geq 0\}} \, da \,db \,dc ,$$ where $\chi_{\bullet}$ denotes the characteristic function. Since $\Delta$ is homogeneous in $a, b, c$, the set $\{\Delta \geq 0\}$ is invariant under dilations and so $P_R$ does not depend on $R$; hence $P_2 = P_2(1)$

Using the symmetry of $\Delta$ under the transformations $b \mapsto b$ and $a \leftrightarrow c$, along with the observation that $\Delta > 0$ if $a, c$ have opposite signs, we can evaluate the above integral as \begin{align} P_2 &= \frac{1}{2} + \frac{1}{2} \int_0^1 \int_0^{\min\left\{1, \frac{1}{4c}\right\}} \int_{2 \sqrt{a c}}^1 db \,da \,dc \\ &= \frac{1}{2} + \frac{1}{2} \left( \int_0^{\frac{1}{4}} \int_0^1 \int_{2\sqrt{ac}}^1 db \,da \,dc + \int_{\frac{1}{4}}^1 \int_0^{\frac{1}{4 c}} \int_{2 \sqrt{ac}}^1 db \,da \,dc \right) \\ &= \frac{41}{72} +\frac{\log 2}{12} \\ &= 0.62721\!\ldots . \end{align} (As a sanity check, a Monte Carlo simulation with $10^7$ trials gave a probability that agrees with this value to $\sim \!\!1$ part in $10^4$.)

This raises a natural next question:

What is the probability $P_3$ that a randomly selected real cubic polynomial has all real roots?

We formalize and set up the problem just as the quadratic case: Recall that $q(x) := a x^3 + b x^2 + c x + d$ has all real roots if its discriminant $$\Delta(q) := -27 a^2 d^2+18 a b c d-4 a c^3-4 b^3 d+b^2 c^2$$ is positive. As is true for the discriminant for any degree, $\Delta$ is homogeneous in the coefficients $a, b, c, d$, so the probability is $$P_3 = \frac{1}{16} \iiiint_{[-1, 1]^4} \chi_{\{\Delta \geq 0\}} \,da \,db \,dc \,dd .$$ In principal one can proceed as before, but as $\Delta$ is a (complicated) quartic expression here, the algebra appears wildly more complicated than in the quadratic case. Is there a better way to evaluate $P_3$? (If so, it might hint at a more elegant way to approach the quadratic case.)

A Monte Carlo simulation with $10^6$ trials gives that $P_3 \approx 0.218$.

There are some obvious generalizations, namely: (1) For any positive integer $n$, what is the probability $P_n$ that a polynomial of degree $n$ has all real roots? (2) For any positive integer $n$, what is the probability $P_n'$ that a polynomial of degree $n$ has positive discriminant? Recall that $\Delta(r) > 0$ implies that the number of real roots of $r$ is equal to $r$ modulo $4$, so we only have $P_n = P_n'$ for $n = 2, 3$ but (a moment's thought shows that) for $n \geq 4$ one has $P_n' > P_n$.

Edit As Will Jagy has pointed out, there are good reasons to consider other distributions on the polynomials, and for at least one of these the answer is simpler: If one takes on the space of degree $n$ polynomials the distribution for which the distribution of the $i$th coefficient is normal with variance $n \choose i$ (which turns out to be natural in a particular way), then Kostlan's extremely interesting paper shows that the expected number of zeros is $\sqrt{n}$, from which we can conclude (for this distribution) that $P_2 = \tfrac{1}{\sqrt{2}} = 0.70710\!\ldots$ and $P_3 = \frac{1}{2}(\sqrt{3} - 1) = 0.36602\!\ldots$.

• note that random polynomials are not typically given iid uniform for the coefficients. Doing that leads to some peculiar outcomes. Anyway, mathoverflow.net/questions/182412/… see articles by Kostlan – Will Jagy Apr 16 '16 at 17:35
• Thanks for the link to the MO post (I'd seen it before but had since forgotten about it). I know that other probability distributions of polynomials are in some senses more natural (probably the odd form of $P_2$ is a consequence of that), and I framed this question deliberately naively, simply because it makes the quadratic computation tractable. If there's another natural distribution for which the computation of $P_3$ is tractable, I'd be at least as interested in seeing that. – Travis Willse Apr 16 '16 at 17:43
• If it was me I would use the measure on the real projective spaces induced by the uniform measure on spheres. – mercio Apr 16 '16 at 18:15
• Here's one of the papers of Kostlan (and coauthor) @WillJagy mentions: How many zeros of a random polynomial are real? ams.org/journals/bull/1995-32-01/S0273-0979-1995-00571-9 – Travis Willse Apr 16 '16 at 19:05