Probability of $ax^2 + bx + c = 0$ having real solutions

$a$, $b$, $c$ are random integer numbers between $1$ and $100$ (including $1$ and $100$, and uniformly distributed). What is the probability that the equation $ax^2 + bx + c = 0$ has real solutions?

This is from a final high school math exam, and I don't know how to get the answer without using computer.


Interesting question. What kind of class was this?

We can approximate this in the continuous case by letting $(a, b, c)$ reside in the open unit cube in the positive octant. Given any value of $b$ in the interval $(0, 1)$, the allowable values of $(a, c)$ are those in the region of the first-quadrant unit square "inside" the curve $4ac = b^2$. The area of this region is

$$ \frac{b^2}{4} + 2\int_{a=b/2}^1 \frac{b^2}{4a} \, da = \frac{b^2}{4}-\frac{b^2}{2}\ln\frac{b}{2} $$

We can then integrate this area over $b \in (0, 1)$:

$$ P = \int_{b=0}^1 \left( \frac{b^2}{4}-\frac{b^2}{2} \ln \frac{b}{2} \right)\,db = \left. \frac{5b^3}{36}-\frac{b^3}{6}\ln\frac{b}{2} \right]_{b=0}^1 = \frac{5+6\ln 2}{36} \doteq 0.25441 $$

But I'm not sure how you get this in the discrete case without some extensive counting.


The only way I can think of doing it, short of doing a numerical simulation, may be approximating it with a triple integral, i.e. approximating this probability by the probability that the quadratic has solutions if a, b, and c can take any real values between 1 and 100: $$\int_1^{100}\int_1^{100}\int_1^{\frac{b^2}{4a}}\frac{1}{99^3}\,dc\,da\,db=\frac{\int_1^{100}\int_1^{100}(\frac{b^2}{4a}-1)da\,db\,}{99^3}=\frac{\int_1^{100}(\frac{b^2}{4}\ln(100)-99)\,db}{99^3}=\frac{\frac{\ln(100)}{12}(100^3-1)-99^2}{99^3}\approx0.374$$ where $\frac{1}{99^3}\,dc\,da\,db$ is the probability that the point $(a,b,c)$ is in a box with side lengths da, db, and dc.


To get a real solution, the discriminant $b^2-4ac\geq0$, so $b\geq 2 \sqrt{ac}$, and $\frac{b^2}{4}\geq ac$. All of our variables are real so there is no need to consider negatives.

Values of $a$ and $b$ can range from $1$ to $n$. The probability of each separate combination is $\frac{1}{n}*\frac{1}{n}$. Considering each combination of $a$ and $b$ separately:

The number of values for $c$ that will give a real solution is $\bigg\lfloor \lfloor \frac{b^2}{4} \rfloor / a \bigg\rfloor$ (restricted to less than 100), so the probability that a random $c$ will give a real solution is $\bigg\lfloor \lfloor \frac{b^2}{4} \rfloor / a \bigg\rfloor * \frac{1}{n}$.

The probability that a random $a$ and random $c$ will give a real solution is $\bigg\lfloor \lfloor \frac{b^2}{4} \rfloor / a \bigg\rfloor * \frac{1}{n} * \frac{1}{n}$.

So, for each possible value of $b$, the probability of a real solution existing is $\frac{1}{n^2}\sum_{a=1}^{n} \bigg\lfloor \lfloor \frac{b^2}{4} \rfloor / a \bigg\rfloor$.

Then, for all possible values of b, the probability of a real solution existing is $\frac{1}{n^3}\sum_{b=1}^{100}\sum_{a=1}^{100} \bigg\lfloor \lfloor \frac{b^2}{4} \rfloor / a \bigg\rfloor$.

I calculated this in Excel for $n=100$ and also got $0.249222$ as did several commenters. I do not see how one would be expected to do this by hand. There is no immediately obvious pattern. Perhaps trying smaller $n$ might offer insight.