Quadratic equation solver

Solve ax² + bx + c = 0 and see the discriminant and the roots, including complex roots.

Enter your values and press Calculate. Your inputs stay in the address, so you can switch language or share the link.

Graph

Drag to pan, scroll or pinch to zoom, or use the + / − / ⟲ buttons. The graph can also be reached with the keyboard: Tab to it, then use the arrow keys and + / −.

Formula

x = (−b ± √(b² − 4ac)) ÷ 2a

How it works

The discriminant b² − 4ac tells you the kind of roots. If it is positive there are two real roots, if zero one repeated root, and if negative two complex roots. The quadratic formula gives their values.

Worked example

The same calculation with the default values:

  • Coefficient a (of x²) 1
  • Coefficient b (of x) -3
  • Constant c 2
  1. b² − 4ac = (-3)² − 4 × (1) × (2) = 1
  2. √1 = 1
  3. x₁ = (−(-3) + 1) ÷ (2 × 1) = 2
  4. x₂ = (−(-3) − 1) ÷ (2 × 1) = 1

Result: Discriminant (b² − 4ac): 1 · Root x₁: 2 · Root x₂: 1

The discriminant (b² − 4ac) determines the nature of the roots - positive gives two distinct real roots, zero gives one repeated real root, and negative means the two roots are complex (not real) numbers, which this calculator reports rather than silently failing.

Common mistakes

  • Forgetting the ± in the quadratic formula - there are generally two roots, not one; dropping the minus branch silently discards a valid solution.
  • Making a sign error with b or substituting -b incorrectly - the formula uses negative b, so a positive b in the equation becomes negative inside the formula, and this sign is easy to drop by mistake.
  • Assuming every quadratic has two real-number solutions - when the discriminant is negative, the solutions are complex, which is a mathematically valid but non-real result, not a sign of an error in the input.

Related calculators