Quadratic Equation Solver
Solve ax² + bx + c = 0 step by step. Get exact and decimal roots, including complex roots, plus the discriminant, vertex, factored form and a graph.
How to Solve a Quadratic Equation
A quadratic equation has the form ax² + bx + c = 0, where a is not 0. Its solutions are x = (−b ± √(b² − 4ac)) / (2a). The ± gives two answers: one with + and one with −. For example, x² − 5x + 6 = 0 has a = 1, b = −5, c = 6, so x = (5 ± √1) / 2, which gives x = 3 and x = 2.
The part under the square root, D = b² − 4ac, tells you what kind of roots to expect before you finish. If D > 0 there are two real roots and the parabola crosses the x-axis twice. If D = 0 there is one repeated root and the parabola touches the x-axis at its vertex. If D < 0 there are no real roots; the roots are complex numbers and the parabola never meets the x-axis.
The graph of y = ax² + bx + c is a parabola. Its vertex is at x = −b / (2a), and the y-value there is c − b² / (4a). The same equation can be written in vertex form, a(x − h)² + k, or, when the roots are r₁ and r₂, in factored form, a(x − r₁)(x − r₂). The roots always add up to −b/a and multiply to c/a.
Disclaimer: This calculator performs standard mathematical operations for general and educational use only. We are not a substitute for professional review — for calculations where accuracy is critical, such as financial filings, engineering work, or academic submissions, please verify the result independently.
Frequently Asked Questions
About this calculator
This quadratic equation solver finds the roots of any equation of the form ax² + bx + c = 0. Enter a, b and c as whole numbers, decimals or fractions. You get the roots in exact form (such as 3 ± 2√3 or −1 ± 2i) and as decimals, the discriminant, the vertex, the factored and vertex forms, a step-by-step solution, and a graph of the parabola with the roots and vertex marked.
What is a quadratic equation?
A quadratic equation is an equation where the highest power of x is 2: ax² + bx + c = 0, with a not equal to 0. The numbers a, b and c are called coefficients. The solutions are called roots. A quadratic always has exactly two roots if you count a repeated root twice and allow complex numbers. Its graph, y = ax² + bx + c, is a U-shaped curve called a parabola. The real roots are the points where the parabola crosses the x-axis.
Three ways to solve a quadratic
- Factoring: write the left side as a product, for example x² − 5x + 6 = (x − 2)(x − 3). A product is 0 only when one factor is 0, so x = 2 or x = 3. This is fast, but it only works easily when the roots are nice numbers.
- Completing the square: rewrite the equation as a(x − h)² + k = 0, then solve (x − h)² = −k/a. This is how the quadratic formula is derived, and it gives the vertex (h, k) at the same time.
- The quadratic formula: x = (−b ± √(b² − 4ac)) / (2a). It works for every quadratic, including ones with irrational or complex roots. This solver uses it, and shows each step.
How the solver works
The discriminant first. The solver calculates D = b² − 4ac. If D > 0 there are two different real roots, if D = 0 there is one repeated root, and if D < 0 the roots are complex: x = −b/(2a) ± (√|D| / (2a))i.
Exact answers. When a, b and c are whole numbers, decimals or fractions, the solver multiplies them by a common number to make them whole, which does not change the roots. It then simplifies the square root, for example √48 = 4√3, and reduces the fraction. So −0.5x² + 3x + 1.5 = 0 gives the exact roots 3 ± 2√3 instead of only 6.464102 and −0.464102.
Accurate decimals. The textbook formula can lose almost all its accuracy when b² is much larger than 4ac, because it subtracts two numbers that are almost equal. The solver uses the stable form instead: it finds q = −(b ± √D)/2 with the sign of b, then x₁ = q/a and x₂ = c/q. For x² + 100,000,000x + 1 = 0, this gives the small root −0.00000001 correctly, where the plain formula gives 0.
Special cases. If a = 0, the equation is linear (bx + c = 0) and the solver says so and solves it. If a = b = 0, the equation has either no solution or every x is a solution.
Worked examples
- x² − 5x + 6 = 0: D = 25 − 24 = 1, so x = (5 ± 1)/2, which gives x = 2 and x = 3. Factored form: (x − 2)(x − 3).
- 2x² − 7x + 3 = 0: D = 49 − 24 = 25, so x = (7 ± 5)/4, which gives x = 1/2 and x = 3. Factored form: (2x − 1)(x − 3).
- x² − 2x + 1 = 0: D = 4 − 4 = 0, so there is one repeated root, x = 1. The parabola touches the x-axis at its vertex (1, 0).
- x² + 2x + 5 = 0: D = 4 − 20 = −16, so there are no real roots. The roots are x = −1 ± 2i, and the parabola stays above the x-axis with its lowest point at (−1, 4).
- x² − x − 1 = 0: D = 5, so x = (1 ± √5)/2. The positive root, 1.618034, is the golden ratio.
Quadratics in real life
- Projectile motion: a ball thrown upward at 20 m/s from 1.5 m above the ground has height h(t) = −4.9t² + 20t + 1.5 meters after t seconds. Solving h(t) = 0 gives t ≈ 4.16 s, the moment it lands (the other root, about −0.07 s, has no meaning here). The vertex gives the highest point: about 21.9 m after 2.04 s.
- Area: a garden is 3 m longer than it is wide and has an area of 40 m². If the width is x, then x(x + 3) = 40, so x² + 3x − 40 = 0. The roots are 5 and −8, and a width cannot be negative, so the garden is 5 m by 8 m.
- Profit: if profit is P(x) = −2x² + 120x − 1,000 for x items, the break-even points are the roots, x = 10 and x = 50. The vertex shows that profit is highest at x = 30, where P = 800.
- Engineering and physics: braking distance, lens and mirror equations, and electrical circuits often lead to quadratic equations.
- Exact and decimal roots — Shows roots as fractions, simplified square roots or complex numbers (such as (−1 ± √19)/3 or −1 ± 2i), with decimal values next to them.
- Discriminant and root type — Calculates b² − 4ac and explains whether there are two real roots, one repeated root or two complex roots.
- Step-by-step solution — Shows each step of the quadratic formula with your numbers filled in.
- Vertex, factored and vertex forms — Gives the vertex, axis of symmetry, y-intercept, factored form, vertex form, and the sum and product of the roots.
- Interactive graph — Plots the parabola with the roots and vertex marked. Move over the graph to read any point.