Mathematics · Algebra
Polynomial Roots Calculator
Find the real roots of quadratic, cubic, and quartic polynomials using exact algebraic formulas.
Calculator
Formula
a, b, c, d, e are the coefficients of the polynomial from highest to lowest degree. The calculator finds all real values of x satisfying the equation.
Source: Classical algebra — quadratic formula (al-Khwarizmi, ~820 CE); cubic formula (Cardano, 1545); quartic formula (Ferrari, 1545).
How it works
For a quadratic (degree 2), the calculator applies the quadratic formula: x = (-b ± √(b²−4ac)) / 2a. The discriminant b²−4ac determines the nature of the roots: positive means two distinct real roots, zero means one repeated root, and negative means no real roots.
For a cubic (degree 3), the polynomial is converted to depressed form ax³ + px + q = 0 by the substitution x = t − b/(3a). Cardano's formula then resolves the depressed cubic. When the discriminant of the depressed form is negative (three real roots), the trigonometric method is used to avoid complex intermediate values, yielding all three real roots cleanly.
Worked example
Solve 2x² − 7x + 3 = 0 (a=2, b=−7, c=3):
Step 1 — Discriminant: b²−4ac = 49 − 24 = 25.
Step 2 — Root 1: x₁ = (7 + √25) / 4 = 12/4 = 3.
Step 3 — Root 2: x₂ = (7 − 5) / 4 = 2/4 = 0.5.
Verification: 2(3)² − 7(3) + 3 = 18 − 21 + 3 = 0 ✓ and 2(0.25) − 3.5 + 3 = 0 ✓.
Limitations & notes
This calculator finds only real roots; complex (imaginary) roots are returned as blank when the discriminant is negative. Degree 4 (quartic) support is listed in the formula but the implementation covers degrees 1–3; for degree-4 polynomials a numerical solver is recommended. Very large or very small coefficients may introduce floating-point rounding errors at the sixth decimal place.
Frequently asked questions
What does the discriminant tell me?
For quadratics, a positive discriminant means two real roots, zero means one repeated root, and negative means two complex roots. For cubics, a positive discriminant means three distinct real roots, zero means a repeated root, and negative means one real and two complex roots.
Why do some root fields show blank?
A blank output means that root is either complex (non-real) or does not exist for the chosen degree. Only real-valued roots are displayed.
How do I enter a polynomial with a missing term?
Simply set the coefficient of the missing term to 0. For example, x³ + 2x + 1 has no x² term, so set b = 0.
Can this handle degree 1 (linear) equations?
Yes — set degree to 1 and enter coefficients a and b; the single root is x = −b/a and appears in the Root 1 field.
Why might roots have tiny rounding errors like 1.000000 vs exactly 1?
Floating-point arithmetic in JavaScript can introduce sub-microsecond rounding at the last decimal place. For exact integer results, round the output to the nearest integer if appropriate.
Last updated: 2025-01-15 · Formula verified against primary sources.