About the quadratic equation solver
A quadratic equation is any equation of the form ax² + bx + c = 0 where a, b, c are real numbers and a is not zero. Its graph is a parabola, and the roots are the x-values where that parabola crosses (or touches) the x-axis. Quadratics are everywhere in school and applied maths: projectile motion in physics (vertical position is a quadratic in time), the area of geometric shapes, optimisation of profit or cost in business problems, and the closed-form solution to constant-coefficient differential equations all reduce to solving a quadratic. This solver returns every quantity a student or engineer typically wants: both roots (real or complex), the discriminant, the sum and product of roots, the parabola's vertex, and the axis of symmetry.
The solver runs entirely in your browser. Coefficients you type stay on your device, results update as you type, and the page works offline once cached.
How the quadratic formula works
The quadratic formula isolates x by completing the square on ax² + bx + c = 0. The general result is:
x = ( -b ± √(b² - 4ac) ) / (2a) Discriminant D = b² - 4ac Vertex = ( -b/(2a), c - b²/(4a) ) Axis of symmetry = x = -b/(2a) Sum of roots = -b/a (Vieta) Product of roots = c/a (Vieta)
The discriminant D = b² minus 4ac is the single most informative quantity, because it tells you the type of roots before you compute them:
- D > 0: two distinct real roots. The parabola crosses the x-axis at two points.
- D = 0: one repeated real root at x = -b/(2a). The parabola just touches the x-axis (tangent).
- D < 0: two complex conjugate roots of the form p ± qi. The parabola never touches the x-axis.
Worked example: x² - 5x + 6 = 0
Take the page default coefficients a = 1, b = -5, c = 6.
- Compute the discriminant. D = (-5)² - 4(1)(6) = 25 - 24 = 1. Positive, so expect two distinct real roots.
- Plug into the formula. x = (5 ± √1) / 2 = (5 ± 1) / 2.
- Split into two roots. x = (5 + 1)/2 = 3, and x = (5 - 1)/2 = 2.
- Check with Vieta. Sum 2 + 3 = 5 = -b/a. Product 2 × 3 = 6 = c/a. Matches.
- Vertex. -b/(2a) = 5/2 = 2.5. y at x = 2.5 is 2.5² - 5(2.5) + 6 = -0.25. So the vertex is (2.5, -0.25), a minimum because a is positive.
Discriminant cases compared
| Equation | D = b²-4ac | Roots | Graph |
|---|---|---|---|
| x² - 5x + 6 = 0 | 1 (positive) | 2 and 3 | Two x-intercepts |
| x² - 6x + 9 = 0 | 0 | 3 (repeated) | Touches axis once |
| x² + 4 = 0 | -16 (negative) | ±2i | Floats above axis |
| 2x² + 3x - 2 = 0 | 25 | 0.5 and -2 | Two x-intercepts |
| x² + x + 1 = 0 | -3 | -0.5 ± 0.866i | Floats above axis |
Common pitfalls
- Forgetting that a cannot be zero. If a = 0 the equation is linear, not quadratic. The solver detects this and switches to bx + c = 0, but pen-and-paper users often divide by zero.
- Sign errors on b. When b is negative, -b is positive. Writing the formula as plus b (not minus b) is the single most common school mistake.
- Reading the discriminant inside the square root with the wrong sign. b² is always positive; the 4ac term carries its own sign through the minus. With a = 1, c = -6, the discriminant is b² minus 4(1)(-6) = b² plus 24, not minus 24.
- Reporting only one root when D is positive. The plus-or-minus in the formula always yields two answers when D > 0; both should be reported.
- Confusing repeated roots with no solution. D = 0 has a real solution; D < 0 has no real solution but two complex ones. Some textbooks merge the two cases sloppily.
- Floating-point noise near D = 0. For very small discriminants the solver may report 0.000001 instead of zero. If you see a tiny imaginary part on what should be a real root, treat it as numerical noise.
Frequently asked questions
What is the quadratic formula and how does the discriminant work?
The quadratic formula is x = (-b plus or minus the square root of (b squared minus 4ac)) divided by 2a. The expression b squared minus 4ac is called the discriminant. When the discriminant is positive the parabola crosses the x-axis at two points and you get two distinct real roots. When the discriminant is exactly zero the parabola just touches the x-axis at one point, giving a single repeated root at x equals minus b over 2a. When the discriminant is negative the parabola never touches the x-axis and the two roots are complex conjugates of the form p plus or minus qi.
Why does the solver also return the vertex and axis of symmetry?
Every quadratic ax squared plus bx plus c is the equation of a parabola. The vertex is the parabola's turning point and the axis of symmetry is the vertical line through it, x equals minus b over 2a. The y-coordinate of the vertex is the maximum value (when a is negative) or minimum value (when a is positive) of the function, which is what physics, optimisation, and projectile problems usually want. The solver reports vertex and axis because most homework and engineering questions need them alongside the roots.
What is Vieta's formulas and why do you show sum and product of roots?
Francois Viete in 1591 noted that for any quadratic ax squared plus bx plus c equals zero the sum of the two roots equals minus b over a and the product equals c over a. These shortcuts let you sanity-check the solver's output without redoing the full formula, and they are the basis of factoring quadratics by inspection. If a equals 1, b equals minus 5, and c equals 6, the roots must sum to 5 and multiply to 6, which immediately gives 2 and 3.
What if a equals zero?
If a equals zero the equation is no longer quadratic, it is linear: bx plus c equals zero, with a single solution x equals minus c over b. The solver detects this case and returns the linear answer instead of dividing by zero in the quadratic formula. If both a and b are zero and c is non-zero there is no solution; if all three are zero every x is a solution.
Can the solver handle decimal or negative coefficients?
Yes. The input fields accept any real number including negatives, fractions written as decimals (for example 0.5 for one half), and very small or large values. JavaScript uses 64-bit floating-point arithmetic, so results are accurate to about 15 significant digits. For symbolic exact answers like x equals (3 plus square root 5) divided by 2 you would need a computer algebra system; this solver reports the decimal approximation to four places.
