Menu

Quadratic Equation Solver

ax² + bx + c = 0

Quadratic Equation Solver: How It Works

A quadratic equation has the form ax² + bx + c = 0, and every one of them can be solved by the same formula. What varies is how many real solutions exist — and the discriminant tells you that before you finish the calculation.

The formula

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

The expression under the root, b² − 4ac, is the discriminant. It determines the nature of the solutions before you compute them:

DiscriminantSolutionsGraph
PositiveTwo distinct real rootsCrosses the x-axis twice
ZeroOne repeated real rootTouches the x-axis once
NegativeTwo complex conjugate rootsNever touches the x-axis

Worked example

Solve 2x² − 7x + 3 = 0. Here a = 2, b = −7, c = 3.

  1. Discriminant = (−7)² − 4(2)(3) = 49 − 24 = 25 — positive, so two real roots.
  2. √25 = 5
  3. x = (7 + 5) ÷ 4 = 3  and  x = (7 − 5) ÷ 4 = 0.5

Check by substitution: 2(9) − 7(3) + 3 = 18 − 21 + 3 = 0. ✓

Other methods, and when they are faster

The formula always works, which makes it the reliable default. Factoring is worth trying first only when the coefficients are small integers.

Reading the parabola

The graph of y = ax² + bx + c is a parabola. Its vertex sits at x = −b ÷ 2a, and substituting that back gives the vertex's y value. If a is positive the parabola opens upward and the vertex is a minimum; if negative it opens downward and the vertex is a maximum.

This is why quadratics appear in optimisation problems: maximum area for a given perimeter, maximum profit at a given price, maximum height of a projectile. The vertex is the answer.

Complex roots

A negative discriminant means the parabola never crosses the x-axis, so there is no real solution. The roots are complex: for x² + 2x + 5 = 0, the discriminant is 4 − 20 = −16, and the roots are −1 ± 2i.

These are not a mathematical curiosity — complex roots describe oscillating systems, and they are fundamental to electrical engineering, signal processing and control theory. A negative discriminant in a physical problem usually means the system oscillates rather than settling.

A numerical caution

When b² is much larger than 4ac, one root computed by the standard formula suffers from subtracting two nearly equal numbers, which loses precision badly in floating-point arithmetic. The stable approach computes the larger-magnitude root first, then obtains the other from the fact that the product of the roots equals c ÷ a. This matters in scientific computing and is the sort of detail that separates a working implementation from a correct one.

Frequently Asked Questions

What does the discriminant tell me?
How many real solutions exist, before you finish solving. Positive means two distinct real roots, zero means one repeated root, and negative means the roots are complex and the parabola never crosses the x-axis.
When should I factor instead of using the formula?
When the coefficients are small integers and you can quickly spot two numbers that multiply to ac and add to b. Factoring is faster in those cases but only works for rational roots; the formula always works.
What does it mean when there is no real solution?
The parabola never touches the x-axis. In a physical problem this usually indicates an oscillating system rather than an error — complex roots are central to describing oscillation in engineering and physics.
How do I find the vertex?
The x coordinate is −b ÷ 2a; substitute it back into the equation for the y coordinate. If a is positive the vertex is a minimum, and if negative it is a maximum — which is what makes quadratics useful for optimisation.
Why do I get a slightly wrong root from the formula sometimes?
When b² is much larger than 4ac, one root involves subtracting two nearly equal numbers, which loses precision in floating-point arithmetic. Computing the larger root first and deriving the other from the product of roots is numerically stable.
Can a quadratic have only one solution?
Yes, when the discriminant is exactly zero. The two roots coincide, giving one repeated value, and the parabola touches the x-axis at a single point rather than crossing it.

Related Calculators Tools

Browse all Calculators tools →