Library · Geometric Probability · Chapter 4

A random quadratic with real roots

Revised Report an error

Problem 4.1

Let p,qp, q be independent uniform random variables in [−1,1][-1, 1]. What is the probability that the quadratic x2+2px+q=0x^2 + 2 p x + q = 0 has real roots?

Solution. The quadratic has real roots iff its discriminant is non-negative, i.e., (2p)2−4q≥0(2p)^2 - 4q \geq 0, or equivalently q≤p2q \leq p^2. The parameter space is the square [−1,1]2[-1,1]^2, of area 44.

The region {(p,q):q≤p2}\{(p,q) : q \leq p^2\} inside the square is everything below the parabola q=p2q = p^2. Its area is ∫−11(p2−(−1)) dp=∫−11(p2+1) dp=23+2=83.\int_{-1}^{1} \big( p^2 - (-1) \big) \, dp = \int_{-1}^{1} (p^2 + 1) \, dp = \tfrac23 + 2 = \tfrac83. Hence the probability is P=8/34=23.■\boxed{\mathbb{P} = \frac{8/3}{4} = \tfrac23.} \qedhere

Random quadratic x^2 + 2px + q with (p,q) uniform in [-1,1]^2 . The quadratic has real roots iff (p,q) lies below the parabola q = p^2 (sage region, area \tfrac83 ). The complementary region (copper) has area \tfrac43 . The ratio gives \mathbb{P} = \tfrac23 .
Random quadratic x2+2px+qx^2 + 2px + q with (p,q)(p,q) uniform in [−1,1]2[-1,1]^2. The quadratic has real roots iff (p,q)(p,q) lies below the parabola q=p2q = p^2 (sage region, area 83\tfrac83). The complementary region (copper) has area 43\tfrac43. The ratio gives P=23\mathbb{P} = \tfrac23.
import numpy as np
p, q = np.random.uniform(-1, 1, (2, 10**7))
real_roots = p**2 >= q
print(f"sim: {real_roots.mean():.5f}   exact: {2/3:.5f}")
# sim: 0.66659   exact: 0.66667
Report an error on this page

Reports are stored by Netlify. See the privacy note.