Quadratic Equation Calculator
Solve ax² + bx + c = 0 for x using the quadratic formula, including complex roots when the discriminant is negative.
The quadratic formula
x = (−b ± √(b² − 4ac)) ÷ 2a. The expression under the square root, b² − 4ac, is called the discriminant — its sign tells you what kind of roots the equation has before you even finish solving.
What the discriminant tells you
- Discriminant > 0 — two distinct real roots
- Discriminant = 0 — exactly one repeated real root
- Discriminant < 0 — two complex roots (no real solutions)
Worked example
For x² − 3x + 2 = 0 (a=1, b=−3, c=2): the discriminant is (−3)² − 4×1×2 = 9 − 8 = 1, which is positive, so there are two real roots: x = (3 ± 1) ÷ 2, giving x₁ = 2 and x₂ = 1.
How the roots are reported
- Put the equation into the form ax² + bx + c = 0 first, then enter a, b and c. Decimals and negative coefficients are fine; an empty box or non-number is refused.
- The tool computes b² − 4ac and shows it to four decimals, then x₁ = (−b + √D) ÷ 2a and x₂ = (−b − √D) ÷ 2a.
- With a positive discriminant, real roots are shown to six decimals. When a is negative, x₁ is the smaller root, because dividing by a negative 2a flips the order.
- With a zero discriminant, one repeated root is shown. With a negative one, the pair is written as a real part ± an imaginary part followed by i, at four decimals.
- If a is 0, you get a message that the equation is linear.
More worked examples
2x² + 4x − 6: the discriminant is 64, so x₁ = 1.000000 and x₂ = −3.000000. For x² − 6x + 9 the discriminant is 0 and the repeated root is 3.000000.
For x² + 2x + 5 the discriminant is −16 and the roots are −1.0000 ± 2.0000i. For 2x² + 3x + 4 it is −23, which gives −0.7500 ± 1.1990i. For x² − 2 the roots are ±1.414214, with x₁ the positive one.
−x² + 4 = 0 returns x₁ = −2.000000 and x₂ = 2.000000, the order reversed because a is negative.
What it does not do
There is no factoring, no step-by-step working and no graph, and equations above degree two are out of scope. Move all terms to one side before entering them: x² = 3x − 2 becomes a = 1, b = −3, c = 2.
Frequently asked questions
What does a complex root actually mean?
It means the equation has no solution among real numbers — the parabola described by ax² + bx + c never crosses the x-axis. Complex roots come in a pair like p + qi and p − qi, where i is the imaginary unit (√−1).
Why can't 'a' be zero?
If a = 0, the x² term disappears and the equation becomes linear (bx + c = 0), which has a different, simpler solution method — a single root, x = −c/b — rather than the quadratic formula.
How do I enter x² = 3x − 2?
Move everything to the left: x² − 3x + 2 = 0. Then a = 1, b = −3 and c = 2, which gives roots 2 and 1.
Why is x₁ smaller than x₂ for my equation?
When a is negative, the tool's x₁ formula, which adds the square root, lands on the lower root. Both roots are still returned.
How are complex roots displayed?
As a real part plus and minus an imaginary part with an i, to four decimals, for example −1.0000 + 2.0000i and −1.0000 − 2.0000i for x² + 2x + 5.