Math

Quadratic Equation Solver

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

Solve any quadratic equation ax² + bx + c = 0 by entering the coefficients a, b, and c. The solver shows both roots (or the double root), plus the discriminant so you can see at a glance whether the roots are real.

How it's calculated

Roots come from the quadratic formula x = (−b ± √(b²−4ac)) / 2a. The discriminant b²−4ac tells the story: positive means two real roots, zero means one double root, negative means no real roots.

Each symbol is a number read straight off the equation once it is written in the standard order ax² + bx + c = 0: a multiplies x², b multiplies x, and c is the constant term on its own. Signs matter as much as sizes — in x² − 5x + 6 = 0, b is −5, not 5 — and a missing term simply has coefficient zero, so x² − 9 = 0 has b = 0.

The formula works because it is completing the square carried out once, in general, instead of being repeated for every new equation: rearranged into a perfect square, the equation can be square-rooted to isolate x. That is why the discriminant D = b² − 4ac sits under the root sign — it decides whether that square root is a real number at all. A positive D gives two different roots, zero makes the ± branches coincide in one repeated root, and a negative D means the parabola never reaches the x-axis.

Worked example

Take x² − 5x + 6 = 0, so a = 1, b = −5 and c = 6. Start with the discriminant: D = b² − 4ac = 25 − 24 = 1. Because D is positive, there are two distinct real roots. Now apply the formula: x = (−b ± √D) ÷ 2a = (5 ± 1) ÷ 2. The plus branch gives (5 + 1) ÷ 2 = 3 and the minus branch gives (5 − 1) ÷ 2 = 2, so the roots are x = 2 and x = 3. Both check in the original equation — for x = 2, 4 − 10 + 6 = 0 — the quickest way to be sure no sign slipped on the way through.

When to use it

Reach for this solver whenever an algebra problem has been rearranged into ax² + bx + c = 0 and you need exact roots rather than a graph estimate — checking factorisation homework is the classic case, because the roots give you the factors directly. It also earns its keep outside the classroom: a thrown ball follows a quadratic height equation, and solving it finds when the ball passes a given height or returns to the ground. Read the discriminant first: it tells you whether a real answer exists.

Common mistakes

  • Entering b with the wrong sign — when the equation reads x² − 5x + 6, b is −5, and typing 5 produces a completely different pair of roots.
  • Forgetting the ± sign and reporting only one root, when a positive discriminant always means there are two to find.
  • Dividing only the square-root term by 2a; the division applies to the whole numerator.
  • Solving before rearranging the equation to equal zero — the formula only applies when one side is 0, so terms must be collected first.

Frequently asked questions

How do I solve x² − 5x + 6 = 0?

Enter a=1, b=−5, c=6. The roots are x = 2 and x = 3, because (x−2)(x−3) expands to x² − 5x + 6.

What does the discriminant tell me?

The discriminant b²−4ac predicts the roots before you compute them: if it's positive there are two real roots, if zero there's one repeated root, and if negative there are no real roots.

What if a is zero?

Then it's not quadratic — it's the linear equation bx + c = 0, and the solver gives the single root x = −c/b.

Can I enter decimal or fraction coefficients?

Yes. The coefficients a, b and c can be any real numbers, including decimals and negative values. The only requirement for a quadratic is that a is not zero; if a is zero the tool treats the equation as linear instead.

How can I check that my roots are correct?

Substitute each root back into the original equation and confirm it gives zero. The roots should also add to −b/a and multiply to c/a: for 2 and 3 the sum is 5 and the product is 6.

Another worked example: a fractional root and a negative constant

Try 2x² + 3x − 2 = 0, so this time a = 2, b = 3 and c = −2. The discriminant is D = b² − 4ac = 9 − 4 × 2 × (−2) = 9 + 16 = 25. Note what the negative c did: the −4ac term added instead of subtracting, which is why copying the signs exactly as they appear in the equation matters more here than the sizes of the numbers. With √D = 5, the formula gives x = (−3 ± 5) ÷ (2 × 2) = (−3 ± 5) ÷ 4. The plus branch is 2 ÷ 4 = 0.5 and the minus branch is −8 ÷ 4 = −2, so the solver reports x = −2, x = 0.5 with discriminant 25, listing the smaller root first. Both roots check against the two shortcuts: they add to −1.5, which is −b/a = −3/2, and they multiply to −1, which is c/a = −2/2. Substituting x = 0.5 back in gives 2 × 0.25 + 3 × 0.5 − 2 = 0.5 + 1.5 − 2 = 0, and the roots hand you the factorisation directly: (x + 2)(2x − 1).

When both roots are real but only one is the answer

Outside pure algebra, the three inputs a, b and c often come from a measurement problem, and then the solver's two roots have to be interpreted rather than simply reported. A height equation for a thrown object, rearranged to equal zero, typically returns two times at which the object passes a chosen height — once rising and once falling — and both are genuine answers. An area or length problem built from the same standard form usually returns one positive length and one negative root; the negative root satisfies the equation exactly, as −2 does above, but no physical length is negative, so it is discarded on meaning, not on maths. A zero discriminant marks the boundary between those worlds: 3x² − 6x + 3 = 0 gives D = 36 − 36 = 0 and the single double root x = 1, the algebraic picture of a curve that just touches the axis — one solution, arrived at twice. And a negative discriminant is a result, not an error message: x² + 2x + 5 = 0 gives D = 4 − 20 = −16, and the solver reports no real roots with discriminant −16, telling you the parabola never reaches the axis at all.

Edge cases in the three input fields

The coefficients can be decimals as well as whole numbers, and a missing term is entered as zero — x² − 9 = 0 is a = 1, b = 0, c = −9, which returns x = −3 and x = 3. Setting a = 0 changes the problem entirely: the solver stops treating the entry as quadratic and answers the linear equation bx + c = 0 with the single root x = −c/b, and if b is also zero there is no equation left to solve and it says so. One display habit is worth knowing when a is negative: the ± branches swap which root they produce, but the solver still lists the pair in ascending order, so the order on screen is not a clue about which branch came from the plus sign.

Related calculators