Problem 8.1
Let a,b,c be independent uniform random variables in [0,1]. What is the probability that the quadratic ax2+bx+c=0 has real roots?
Solution. The quadratic has real roots iff its discriminant is non-negative: b2≥4ac,i.e.,ac≤b2/4.
Step 1: P(ac≤t) for fixed t∈(0,1). With a,c iid uniform in [0,1], P(ac≤t)=∫01∫011[ac≤t]dcda. For a≤t the inner integral gives 1 (since ac≤a≤t always). For a>t it gives t/a. Hence P(ac≤t)=t+∫t1atda=t(1−lnt).
Step 2: Integrate over b. Set t=b2/4, which lies in [0,1/4] for b∈[0,1]: P(real roots)=∫014b2(1−ln4b2)db. Expand ln(b2/4)=2lnb−ln4=2lnb−2ln2, so 1−ln(b2/4)=1+2ln2−2lnb. Hence P(real roots)=41∫01b2(1+2ln2−2lnb)db. Using ∫01b2db=31 and ∫01b2lnbdb=−91: P(real roots)=41[(1+2ln2)⋅31−2⋅(−91)]=41⋅93+6ln2+2=365+6ln2. Therefore P(real roots)=365+6ln2≈0.2544.■
Compare with Chapter 4, where the parametrisation x2+2px+q with p,q∈[−1,1] gave the cleaner probability 32. The present version has three random coefficients rather than two, and adds the rescaling a on the leading coefficient; the resulting answer involves ln2 — an irrational constant with no simple expression in π. This is the first sign of how adding an extra random parameter can break a closed-form expression into a transcendental one.
import numpy as np
a, b, c = np.random.rand(3, 10**7)
p = (b*b >= 4*a*c).mean()
print(f"sim: {p:.5f} exact: {(5 + 6*np.log(2))/36:.5f}")
# sim: 0.25443 exact: 0.25441