Equation Solver
ax² + bx + c = 0
x1 = 2 x2 = 1
- 1
- Discriminant b² − 4ac
- 1.5
- Vertex x
- -0.25
- Vertex y
- Upwards
- Opens
Enter a, b and c for ax² + bx + c = 0 and this gives the roots, the discriminant, the vertex and which way the parabola opens. When the discriminant is negative it gives the complex roots rather than declaring no solution, because the roots exist. They simply are not real. Set a to zero and it reports the linear solution instead.
How it works
x = (-b ± √(b² - 4ac)) / 2a
- a
- the coefficient of x², which must not be zero for the equation to be quadratic
- b
- the coefficient of x
- c
- the constant term
- b² - 4ac
- the discriminant, which decides whether the roots are real, repeated or complex
The discriminant settles the shape of the answer before any square root is taken. Positive gives two distinct real roots, zero gives one repeated root where the parabola touches the axis, and negative gives a conjugate pair of complex roots.
- The vertex sits at x = -b / 2a, which is also the axis of symmetry and lies midway between two real roots.
- A positive a opens the parabola upwards, making the vertex its minimum; a negative a opens it downwards and the vertex is the maximum.
- Complex roots are given as p ± qi, where p is -b / 2a and q is √(-discriminant) / 2a.
- With a = 0 there is no x² term, so the equation is linear and the solution is x = -c / b. With a and b both zero there is no equation left to solve.
Examples
Two real roots
a, b, c
1, -5, 6
Result
Discriminant 1 · x₁ = 3, x₂ = 2 · vertex (2.5, -0.25)
25 - 24 = 1, so the roots are (5 ± 1) / 2. The vertex x is midway between them, which is the quick check that two roots are right.
A repeated root
a, b, c
1, -6, 9
Result
Discriminant 0 · x₁ = 3 · vertex (3, 0)
36 - 36 = 0. The vertex sits on the x-axis, which is what a perfect square always gives, the parabola touches rather than crosses.
Complex roots
a, b, c
1, 2, 5
Result
Discriminant -16 · x₁ = -1 + 2i, x₂ = -1 − 2i · vertex (-1, 4)
4 - 20 = -16 and √16 = 4, so the roots are (-2 ± 4i) / 2. The vertex is above the axis with the parabola opening upwards, so it never reaches y = 0.
Frequently asked questions
What does the discriminant actually tell me?
It tells you the nature of the roots before you compute them. Positive means two distinct real roots and a parabola crossing the x-axis twice; zero means one repeated root and a parabola touching it; negative means two complex roots and a parabola that never reaches it.
Why show complex roots instead of "no solution"?
Because "no real solution" is the accurate phrase and the complex roots are genuinely there. They matter in electrical engineering, control systems and signal processing, where a negative discriminant describes an oscillating response rather than an error.
What happens if I set a to zero?
The x² term vanishes and the equation is linear, so it reports x = -c / b instead. Dividing by 2a would be division by zero, which is why the case is detected rather than computed. With b zero as well there is no equation to solve.
What is the vertex useful for?
It is the turning point. The minimum when a is positive, the maximum when a is negative. Optimisation problems usually want the vertex rather than the roots, and its y value tells you at a glance whether the parabola reaches the axis at all.
Can it solve cubic or higher equations?
No, it covers degree two and the degenerate linear case. Cubics have a general formula but it is unwieldy and numerically unstable, and beyond degree four no general formula exists. Those need numerical root finding, which is a different tool.
Why do the roots sometimes show long decimals?
Because an irrational root has no exact decimal form. Where the discriminant is not a perfect square the roots involve a surd, and any decimal is a rounding. They are shown to six places, enough to substitute back and confirm.