How to Solve a Quadratic Equation

Solve ax² + bx + c = 0 with the quadratic formula. How the discriminant decides whether the roots are two real, one repeated, or a complex pair, with worked examples.

Updated 6 min read By CodingEagles
Free tool Equation Solver Linear and quadratic roots, real and complex. Open tool

To solve a quadratic equation ax² + bx + c = 0, use the quadratic formula: x = (−b ± √(b² − 4ac)) ÷ 2a. Work out the discriminant b² − 4ac first, since it tells you whether the roots are real or complex. The equation solver does all of this from the coefficients you enter.

Here is the method, with each case worked out.

The quadratic formula

A quadratic is any equation you can write as ax² + bx + c = 0, where a is not zero. Its solutions come from the quadratic formula:

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

The ± means there are usually two answers, one using plus and one using minus. The expression under the square root, b² − 4ac, is called the discriminant, and it is worth computing on its own because it tells you what kind of answer to expect.

Two real roots

Take x² − 5x + 6 = 0, so a = 1, b = −5, c = 6. The discriminant is (−5)² − 4 × 1 × 6 = 25 − 24 = 1, which is positive. A positive discriminant means two distinct real roots.

Plugging in: x = (5 ± √1) ÷ 2, giving x = 3 and x = 2. You can check by factoring: (x − 2)(x − 3) = 0, which confirms the same roots.

One repeated root

Take x² − 4x + 4 = 0, so a = 1, b = −4, c = 4. The discriminant is 16 − 16 = 0. A zero discriminant means the ± adds nothing, so there is a single repeated root: x = 4 ÷ 2 = 2. This happens when the parabola just touches the x-axis at one point.

Complex roots

Take x² + 1 = 0, so a = 1, b = 0, c = 1. The discriminant is 0 − 4 = −4, which is negative. A negative discriminant means there are no real roots, but there is a pair of complex roots.

The square root of a negative number uses i, where i² = −1. Here √(−4) = 2i, so the roots are x = ±2i, written as 0 + 2i and 0 − 2i. These always come as conjugate pairs. The equation solver computes the real and imaginary parts and shows both roots.

Reading the discriminant at a glance

The discriminant summarises all three cases:

  • Positive: two distinct real roots.
  • Zero: one repeated real root.
  • Negative: two complex conjugate roots.

Computing it first tells you what to expect, which is why the solver shows its value and labels the result.

Where this comes up

Quadratics describe anything that rises and falls, or grows with a squared term:

  • Physics, for the path of a thrown object under gravity.
  • Geometry, for areas where a side length is unknown.
  • Algebra study, for checking roots found by hand, especially the complex case.

For the order you apply operations while substituting into the formula, see order of operations, or open the equation solver to try it now.

Frequently asked questions

What is the quadratic formula?
For ax² + bx + c = 0, the roots are x = (−b ± √(b² − 4ac)) ÷ 2a. The part under the root, b² − 4ac, is the discriminant. The equation solver computes both roots from your a, b and c, and shows the discriminant alongside.
What does the discriminant tell me?
The discriminant, b² − 4ac, decides the nature of the roots. Positive means two distinct real roots, zero means one repeated real root, and negative means a pair of complex conjugate roots. It tells you what to expect before you finish the calculation.
What if the discriminant is negative?
Then the quadratic has no real roots, but it does have two complex roots that are conjugates, like −1 + 2i and −1 − 2i. The equation solver works these out and shows them rather than just reporting no solution.

Ready to try it?

Linear and quadratic roots, real and complex. Free, in-browser, and 100% private — your data never leaves your device.

Open the Equation Solver