The quadratic formula
A quadratic equation is any equation that can be written as ax² + bx + c = 0, where a is not 0. The numbers a, b and c are the coefficients: a sits in front of x², b in front of x, and c is the constant term. Every quadratic equation can be solved with one formula:
The ± sign gives the two roots: one with + and one with −. The roots are the values of x that make the equation true, and on the graph they are the points where the parabola y = ax² + bx + c crosses the x-axis.
What the discriminant tells you
Before you take any square root, the discriminant D = b² − 4ac already tells you what kind of roots to expect. This works because the formula takes the square root of D, and the square root of a negative number is not a real number.
| Discriminant | Roots | Graph |
|---|---|---|
| Positive perfect square (1, 4, 9, 25…) | Two different rational roots | Crosses the x-axis twice |
| Positive, not a perfect square | Two different irrational roots | Crosses the x-axis twice |
| Zero | One repeated root | Touches the x-axis at the vertex |
| Negative | Two complex roots, p ± qi | Never meets the x-axis |
The perfect square test applies when a, b and c are whole numbers. With fractions or decimals, the solver first multiplies the whole equation by a common denominator, which changes neither the roots nor the sign of D.
Worked example
Solve 3x² − 4x − 2 = 0. Here a = 3, b = −4 and c = −2. The discriminant is (−4)² − 4 × 3 × (−2) = 16 + 24 = 40. That is positive but not a perfect square, so there are two irrational roots.
Put the numbers into the formula: x = (4 ± √40) ÷ 6. Simplify the root by pulling out the largest square factor: 40 = 4 × 10, so √40 = 2√10. Now x = (4 ± 2√10) ÷ 6, and every term divides by 2, which gives x = (2 ± √10) ÷ 3. As decimals, the roots are about −0.3874 and 1.7208, which you can check with the scientific calculator.
A quick check: the two roots of ax² + bx + c = 0 always add up to −b/a and multiply to c/a. Here the sum is 4/3 and the product is −2/3, which matches (2 + √10)/3 + (2 − √10)/3 = 4/3.
Complex roots
When D is negative, write √D as √|D| × i, where i is the imaginary unit with i² = −1. For x² + 2x + 5 = 0, D = 4 − 20 = −16, so √D = 4i and x = (−2 ± 4i) ÷ 2 = −1 ± 2i. Complex roots of an equation with real coefficients always come as a pair p + qi and p − qi, called complex conjugates. The real part p is the x-coordinate of the vertex, which is why the graph is centered there even though it never reaches the x-axis.
Vertex, axis of symmetry and factored form
The graph of y = ax² + bx + c is a parabola. It opens upward when a is positive and downward when a is negative. Its turning point, the vertex, sits at x = −b ÷ 2a, exactly halfway between the two real roots. The vertical line through the vertex is the axis of symmetry, and the parabola is a mirror image on both sides of it. The y-intercept is simply c, the value of y at x = 0.
The same equation can be written in three ways, and the solver shows all of them:
- Standard form ax² + bx + c, which shows the y-intercept.
- Vertex form a(x − h)² + k, which shows the vertex (h, k). You get it by completing the square.
- Factored form a(x − x₁)(x − x₂), which shows the roots. With whole-number coefficients it only exists over the rational numbers when the discriminant is a perfect square, like 6x² + x − 2 = (3x + 2)(2x − 1).
Accurate decimals, even for extreme numbers
The textbook formula has a weak spot when a computer evaluates it with ordinary decimals. Take x² + 100,000,000x + 1 = 0. One root is very close to 0, and computing it as (−b + √D) ÷ 2a means subtracting two numbers that agree in almost every digit. In standard double precision, that subtraction gives about −7.45 × 10⁻⁹, while the true root is about −1.0 × 10⁻⁸, so a quarter of the value is lost.
The solver avoids this. It finds the larger root with the sign that adds two numbers of the same sign, q = −(b + sign(b)√D) ÷ 2, and gets the other root from the product of the roots, c ÷ q. Both versions are algebraically the same, but this one keeps every digit. The discriminant itself is computed exactly with whole numbers, and the exact roots with square roots and fractions involve no rounding at all.
Other ways to solve a quadratic
Factoring is the fastest method when the roots are whole numbers or simple fractions: x² − 5x + 6 = (x − 2)(x − 3), so x = 2 or x = 3. Completing the square rewrites the equation in vertex form and then takes a square root, which is how the quadratic formula itself is derived. Taking square roots directly works when there is no x term: x² = 9 gives x = ±3. The quadratic formula works in every case, which is why the solver uses it and shows the factored form alongside when one exists.
How to use the quadratic equation solver
- 1Type your equation, like 2x^2 − 4x = 6, or fill in a, b and c. You can use x² or x^2, decimals and fractions, and terms on both sides of the = sign.
- 2Read the roots at the top: exact values with fractions and square roots, and the decimals below them. Complex roots appear as p ± qi.
- 3Check the discriminant, vertex, factored form and the graph, and follow the steps through the quadratic formula. Copy the result with the steps, or copy a link that opens the solver with your equation.
Related guides
- Z-Table: Negative and Positive Standard Normal Table
- Percent Error vs Percent Change vs Percent Difference
- How to Read a Tape Measure: Every Mark and Fraction
Frequently asked questions
What is the quadratic formula?
For an equation ax² + bx + c = 0 with a not equal to 0, the solutions are x = (−b ± √(b² − 4ac)) ÷ 2a. The ± means you get one root with a plus and one with a minus. The part under the root, b² − 4ac, is the discriminant.
What does a negative discriminant mean?
There is no real number whose square is negative, so the equation has no real roots and its graph never touches the x-axis. It still has two complex roots, p + qi and p − qi, where i is the square root of −1. The solver shows them in that form.
What happens if a is 0?
Without the x² term the equation is linear, bx + c = 0, and it has one solution, x = −c ÷ b. If b is 0 as well, the equation is either true for every x (when c is 0) or has no solution at all. The solver handles all three cases and says which one you have.
Can I enter fractions and decimals?
Yes. Type a, b and c as whole numbers, decimals like 0.75, fractions like 3/4 or mixed numbers like 1 1/2. The solver works with exact fractions internally, so 1/3 stays 1/3 and is not rounded to 0.333 before solving.
How do I find the vertex of a parabola?
The x-coordinate of the vertex is h = −b ÷ 2a. Put it back into the equation to get the y-coordinate k. For y = 2x² − 4x − 6, h = 4 ÷ 4 = 1 and k = 2 − 4 − 6 = −8, so the vertex is (1, −8). The vertical line x = h is the axis of symmetry.
Why are some answers shown with a square root?
When the discriminant is not a perfect square, the roots are irrational: their decimals never end and never repeat. A form like (2 ± √10)/3 is the exact answer, while any decimal is rounded. The decimals next to it are rounded to 10 significant digits.
My equation is not in the form ax² + bx + c = 0. What do I do?
Type it the way you have it, like 2x^2 − 4x = 6 or x² = 3x − 1. The solver moves every term to the left side, collects like terms and fills in a, b and c for you. Products in parentheses, like (x + 1)(x − 2), need to be multiplied out first.