Solves ax² + bx + c = 0 with the discriminant D = b² − 4ac and the quadratic formula x = (−b ± √D) ÷ 2a.
Explanation
A quadratic equation ax2+bx+c=0 is solved by the quadratic formula. Supply the three coefficients and the real roots drop out.
x=2a−b±b2−4ac The quantity under the square root, D=b2−4ac, is the discriminant, and its sign alone decides how many real solutions exist.
- D>0 — two distinct real roots
- D=0 — one repeated root
- D<0 — no real roots; the parabola never meets the x axis
Example
Take a=1, b=−5, c=6, that is x2−5x+6=0. The discriminant is
D=(−5)2−4×1×6=25−24=1 Positive, so there are two real roots:
x=25±1=25±1 giving x1=3 and x2=2. The factorisation x2−5x+6=(x−2)(x−3) confirms it.
Notes
- Watch the sign of b. When b is negative, −b is positive: here −(−5)=5. Sign slips are far and away the most common mistake with this formula.
- With a=0 the squared term disappears, the equation stops being quadratic, and the denominator 2a would be zero. The calculator rejects it.
- A negative discriminant means there is no real root, and the calculator says so rather than returning a complex value.
- As a check, the two roots must add up to −ab and multiply to ac. Here 3+2=5 and 3×2=6, exactly as expected.