If the coefficients of the quadratic equation $ax^2+bx +c$ are u.i.i.d ran variates in $(0,1)$ what is the probability of roots being real? [duplicate]
If the coefficients a,b,c(taken in order ,c being the constant term) of a quadratic equation are randomly and independenly chosen in the open interval(0,1) what is the probability that both the roots are real?
Solution 1:
For every positive $x$, $P[c\lt x]=\min(x,1)$. Applying this to $x=b^2/(4a)$, one gets $$P[b^2\gt4ac]=P[4a\lt b^2]+E[b^2/(4a);4a\gt b^2].$$ For every $x$ in $(0,1)$, $$ P[a\lt x]+E[x/a;a\gt x]=x+\int_x^1\frac{x}z\mathrm dz=x(1-\log x). $$ Applying this to $x=b^2/4$, which is almost surely in $(0,1)$, one gets $$ P[b^2\gt4ac]=E\left[\frac{b^2}4\left(1-\log\left(\frac{b^2}4\right)\right)\right]=\left.(1+\log4)\frac{x^3}{12}-\frac{x^3}6\log x+\frac{x^3}{18}\right|_{x=0}^{x=1}. $$ Thus, the probability $p$ that the two roots are real is $$ p=P[b^2\gt4ac]=\frac1{12}(1+\log4)+\frac1{18}=\frac5{36}+\frac16\log2\approx25.44\%. $$
Solution 2:
$a,b,c$ are limited to the interval $(0,1)$, so that $$ P(b^2 < 4ac) = \int_{a=0}^1\int_{c=0}^1\int_{b=0}^{\min(2\sqrt{ac},1)}da\,db\,dc = \int_{a=0}^1\int_{c=0}^1 \min(2\sqrt{ac},1)\,da\,dc, $$ so that $$ P(b^2 < 4ac) = \int_{a=0}^1\int_{c=0}^{\min(1/(4a),1)}2\sqrt{ac}\,da\,dc + \int_{a=0}^1\int_{c=\min(1/(4a),1)}^1\,da\,dc. $$ The first integral is $$ \begin{multline} \int_{a=0}^1 2\sqrt{a}\,da\int_{c=0}^{\min(1/(4a),1)}\sqrt{c}\,dc = \frac{4}{3}\int_{a=0}^1 \sqrt{a}\min\left(\frac{1}{8a^{3/2}},1\right)\,da\\ = \frac{4}{3}\int_{a=0}^{1/4}\sqrt{a}\,da + \frac{1}{6}\int_{a=1/4}^1\frac{1}{a}\,da = \frac{1}{9} - \frac{1}{6}\ln(1/4)\tag{1}. \end{multline} $$ The second integral is $$ \int_{a=0}^1 \left[1- \min\left(\frac{1}{4a},1\right)\right]\,da = \int_{a=1/4}^1\left(1 - \frac{1}{4a}\right)\,da = \frac{3}{4} + \frac{1}{4}\ln(1/4).\tag{2} $$ Combining $(1)$ and $(2)$, we get $$ P(b^2 < 4ac) = \frac{31}{36} + \frac{1}{12}\ln(1/4), $$ and $$ P(b^2 > 4ac) = \frac{5}{36} - \frac{1}{12}\ln(1/4) = \frac{5}{36}+\frac{1}{6}\ln 2. $$