Quadratic Equation Calculator
A quadratic equation has x squared as its highest power and is solved with the quadratic formula. Enter a, b and c to see the discriminant and the real roots when they exist.
Your numbers
Result
- Discriminant (Δ)
- 1
- Roots
- Two distinct real roots
| Step | Detail |
|---|---|
| Equation | 1x² + -5x + 6 = 0 |
| Discriminant b² - 4ac | -5² - 4·1·6 = 1 |
| x = (-b ± √Δ) / 2a | x1 = 3, x2 = 2 |
The quadratic formula
For ax² + bx + c = 0, first compute the discriminant Δ = b² − 4ac, then the roots: x = (−b ± √Δ) / 2a.
Take x² − 5x + 6 = 0. Here a = 1, b = −5 and c = 6, so Δ = (−5)² − 4·1·6 = 25 − 24 = 1. The formula then gives x = (5 ± 1) / 2, which is x = 3 and x = 2. Substituting either back into the original equation returns zero, which is always the fastest way to confirm you did not drop a sign.
Two details trip people up. The −b at the front applies to the coefficient with its own sign: when b is −5, −b is +5, not −5. And the 2a in the denominator sits under the entire numerator, not just the square root. Writing the fraction out on one line before evaluating avoids both.
The formula also requires a ≠ 0. With a = 0 the x² term vanishes and the equation is linear, not quadratic — there is nothing for the formula to solve, which is why this calculator flags that case separately.
What the discriminant tells you
The discriminant is the part of the formula living under the square root, and its sign alone decides how many real roots exist — you can answer that question without finishing the calculation.
Δ > 0: the square root is a real positive number, so the ± produces two genuinely different answers. Two distinct real roots.
Δ = 0: the square root is zero, the ± adds and subtracts nothing, and both roots collapse onto the same value, x = −b / 2a. One repeated root, often called a double root.
Δ < 0: you would need the square root of a negative number, which does not exist among the real numbers. There is no real solution. The equation is not broken — its two roots are a complex conjugate pair, −b/2a ± i·√(−Δ)/2a — but nothing real satisfies it.
One more thing the discriminant reveals: when Δ is a perfect square, the square root is a whole number and the roots come out rational, which means the quadratic factors neatly over the integers. If Δ is 1, 4, 9, 16 and so on, stop and factor by hand; it is faster than the formula.
Where the formula comes from: completing the square
The quadratic formula is not an arbitrary rule handed down to be memorised. It is what you get by solving the general equation once using a technique called completing the square, so that nobody has to repeat the work.
Start from ax² + bx + c = 0 and divide through by a: x² + (b/a)x + c/a = 0. Move the constant across: x² + (b/a)x = −c/a. Now add (b/2a)² to both sides — the exact amount that turns the left side into a perfect square. It becomes (x + b/2a)², while the right side becomes (b² − 4ac) / 4a².
Take the square root of both sides and you get x + b/2a = ±√(b² − 4ac) / 2a. Subtract b/2a and the quadratic formula falls out.
This derivation explains the discriminant. b² − 4ac is simply whatever ends up under the root sign after the rearrangement, which is why its sign governs whether a real solution exists at all. Completing the square is also worth knowing in its own right: it converts a quadratic into vertex form and is the standard route to the vertex of a parabola.
Reading the parabola
Every quadratic draws a parabola, and the roots are exactly where that curve crosses the horizontal axis. If a > 0 the curve opens upward; if a < 0 it opens downward.
Because the two roots differ only by the ±, they sit symmetrically on either side of x = −b / 2a. That value is the axis of symmetry and the x-coordinate of the vertex — the lowest point of an upward parabola, the highest of a downward one. It is also the midpoint of the two roots, which gives you a free check: average your answers and you should land exactly on −b / 2a. For x² − 5x + 6, the roots 2 and 3 average to 2.5, and −(−5)/2 = 2.5.
The height of that vertex works out to −Δ / 4a, which makes the three discriminant cases visual. With a > 0, a positive Δ puts the vertex below the axis so the curve must cut through it twice; Δ = 0 rests the vertex exactly on the axis, touching at a single point; and a negative Δ lifts the whole parabola above the axis, where it never crosses at all.
Checking roots, and one numerical warning
There is a much quicker check than substitution. The two roots always add to −b/a and multiply to c/a. For x² − 5x + 6, that means the roots sum to 5 and multiply to 6 — and 2 and 3 satisfy both, which is really all the familiar "find two numbers that add to this and multiply to that" factoring trick is.
When a = 1 this is especially powerful: any pair of integers whose sum is −b and whose product is c are the roots, no formula required.
A warning for anyone implementing this in code. When b² is far larger than 4ac, √Δ comes out very close to |b|, and one of the two numerators becomes a subtraction of two nearly equal numbers. That is catastrophic cancellation: the significant digits annihilate each other and the smaller root can be returned with almost no correct precision, even though the formula is algebraically exact. The standard fix is to compute the root whose numerator involves an addition of like signs, then obtain the second from the product relation x₁ · x₂ = c/a instead of running the formula twice.
Frequently asked questions
Sources
Embed this calculator
Copy the code and paste it into your site or blog. Credit with a link back to Contania is included, and the height adjusts itself.
<iframe src="https://contania.app/embed/math/quadratic-equation" title="Quadratic Formula Calculator (ax² + bx + c = 0)" width="100%" height="720" loading="lazy" style="border:1px solid #e5e0d8;border-radius:12px;max-width:640px"></iframe>
<script>window.addEventListener("message",function(e){if(e.data&&e.data.type==="contania:embed-height"){var f=document.querySelector('iframe[src="https://contania.app/embed/math/quadratic-equation"]');if(f){f.style.height=e.data.height+"px"}}});</script>Related calculators
Linear Equation
Solve a linear equation of the form ax + b = cx + d for x, with the step-by-step work. Handles no-solution and infinite-solution cases.
CalculateSquare Root
Find the square root of any number, plus the cube root and the square. See whether the number is a perfect square.
CalculatePythagorean
Find the hypotenuse or a missing leg of a right triangle with the Pythagorean theorem, a² + b² = c². Enter the two known sides.
CalculateRatio
Simplify a ratio to its lowest terms, or solve a proportion to find a missing value. Enter two numbers to reduce A:B, or add a third to solve A:B = C:?.
Calculate