Quadratic Formula Calculator
This quadratic formula calculator solves ax² + bx + c = 0 for real or complex roots. It reports the discriminant and uses a cancellation-resistant calculation for distinct real roots before rounding the displayed values.
By Dr. Hassan Khames EliwaLast updated
Result
- Discriminant
- 1
How it works
Put the equation into standard form
Move every term to one side before entering coefficients. The a field multiplies x², b multiplies x, and c is the constant. Preserve each sign when moving terms across the equals sign. The leading coefficient cannot be zero: without an x² term, the equation is linear rather than quadratic and needs a different solving rule.
The familiar quadratic formula is x = (−b ± √(b² − 4ac)) ÷ (2a). Its discriminant, D = b² − 4ac, classifies the roots. A positive discriminant produces two distinct real roots. Zero produces one repeated real root. A negative discriminant produces a complex conjugate pair, with equal real parts and opposite imaginary parts.
Understand the numeric method
For distinct real roots, directly subtracting nearly equal quantities in the standard formula can lose precision. This implementation instead calculates q = −0.5 × (b + sign(b)√D), treating zero b as nonnegative, and obtains roots q/a and c/q. It sorts the real roots in ascending order. Repeated roots are handled separately to avoid an unnecessary division by q.
Complex output uses a real part plus or minus a positive imaginary magnitude followed by i, where i² = −1. Coefficients must be finite, with nonzero magnitudes between one trillionth and one trillion; zero is permitted for b and c. These bounds control intermediate arithmetic but do not make the solver symbolic or exact. Displayed values use up to six decimal places, and classification follows the computed floating-point discriminant without an arbitrary near-zero tolerance.
Worked example
Example 1: two real solutions
Solve x² − 5x + 6 = 0 by entering a = 1, b = −5, and c = 6. The discriminant is 25 − 24 = 1. The calculator displays roots 2, 3. Substitution confirms both: 4 − 10 + 6 is zero, and 9 − 15 + 6 is zero. Factoring as (x − 2)(x − 3) provides an independent check for this particular equation.
Example 2: a complex conjugate pair
For x² + 2x + 5 = 0, enter 1, 2, and 5. The discriminant is 4 − 20 = -16, and the displayed roots are -1 ± 2i. The real part is −2 ÷ 2 = −1; the imaginary magnitude is √16 ÷ 2 = 2. There are no real-axis crossings, but there are still two complex roots. A negative discriminant is therefore a valid result rather than an input error.
Expert tips
Common mistakes
- Moving a term across the equals sign changes its sign. Write out standard form before entering coefficients; an accurate solution to a mistyped equation still answers the wrong problem.
- The plus-or-minus sign identifies specific roots, not uncertainty. For complex roots it marks the conjugate pair, rather than an interval of possible real answers.
- The displayed root is rounded, not necessarily exact. Substituting the six-decimal value can leave a small residual even when the underlying numerical approximation is sound.
Frequently asked questions
What happens when a is zero?
The calculator rejects the input because the equation is no longer quadratic. If b is nonzero, solve the remaining linear equation using x = −c/b.
Why is there only one number for a repeated root?
When the discriminant is zero, the two formula branches coincide. The single displayed value represents that repeated solution, which has algebraic multiplicity two.
Can b or c be zero?
Yes. Zero is valid for either coefficient. Only a must be nonzero, and every entered coefficient must still satisfy the finite-value and supported-magnitude checks.
Why might a nearly repeated root be sensitive?
Small coefficient changes can move a near-zero discriminant across zero. Decimal representation and measurement uncertainty both matter, so do not read a delicate numeric classification as exact symbolic proof.
Does the calculator give exact radicals?
No. It provides numerical roots and a numerical discriminant. Keep a symbolic expression separately if a proof, an exact radical form, or exact coefficient arithmetic is required.
Related calculators
Related guides
MathPercentages people get wrong: change, difference and pointsThe denominator determines the answer. Learn to distinguish percentage change, symmetric difference and percentage-point movements.14 November 2026 · 7 min read
MathStandard deviation without the jargonThe average tells you the centre. Standard deviation helps describe the spread, provided you know what the data represents.14 November 2026 · 7 min readSources and standards
About the author
Dr. Hassan Khames Eliwa holds a PhD in Construction & Built Environment and has more than 20 years of international project controls experience. He is Director of Eliwa Project Controls Limited in Auckland and founder of PMMilestone.org and PMMilestone.com.
Buy me a coffee