This quadratic formula calculator solves ax² + bx + c = 0. Enter the three coefficients and it returns the discriminant and the roots, including complex roots when the equation has no real solutions.
Quadratic Formula Calculator
Solve ax² + bx + c = 0 for x, including complex roots when the discriminant is negative.
Starting values: the calculator opens with a = 1, b = −3 and c = 2, which is x² − 3x + 2 = 0. The discriminant is 1, and the roots are 2 and 1.
The quadratic formula
A quadratic equation has the standard form ax² + bx + c = 0, with a not equal to 0. The quadratic formula gives its solutions directly:
x = (−b ± √(b² − 4ac)) ÷ (2a)
Where:
- a = the coefficient of x²
- b = the coefficient of x
- c = the constant term
- b² − 4ac = the discriminant, often written Δ
The ± means you compute the formula twice, once with plus and once with minus, to get the two roots.
What the discriminant tells you
The part under the square root decides how many solutions the equation has and what kind they are.
- Δ greater than 0: two different real roots.
- Δ equal to 0: one real root, repeated. The parabola just touches the x-axis.
- Δ less than 0: no real roots. The two solutions are complex numbers.
Check the discriminant first. It is quick to compute and tells you what to expect before you do any more work.
How the calculator reports complex roots
When the discriminant is negative, the calculator shows each root as a real part plus or minus an imaginary part. The real part is −b ÷ (2a), and the imaginary part is √(4ac − b²) ÷ (2a), taken as a positive size, with the two roots differing in the sign of the imaginary part. If a is 0 the equation is not quadratic, and the calculator rejects it.
Worked examples
Example 1: two real roots (the default)
Solve x² − 3x + 2 = 0, so a = 1, b = −3, c = 2.
- Discriminant = (−3)² − 4 × 1 × 2 = 9 − 8 = 1.
- Square root of 1 = 1.
- x = (3 ± 1) ÷ 2, so x = 2 or x = 1.
Check: (x − 1)(x − 2) = x² − 3x + 2. The roots match.
Example 2: an irrational pair
A published worked example solves 4x² + 4x − 1 = 0. Here a = 4, b = 4, c = −1.
- Discriminant = 16 − 4 × 4 × (−1) = 16 + 16 = 32.
- x = (−4 ± √32) ÷ 8. Since √32 = 4√2, this simplifies to x = (−1 ± √2) ÷ 2.
The calculator gives the decimal values, about 0.2071 and −1.2071. The exact form above is useful when you need a tidy answer.
Example 3: a repeated root
Solve x² − 6x + 9 = 0. The discriminant is 36 − 36 = 0, so x = 6 ÷ 2 = 3, a single repeated root. The equation factors as (x − 3)².
Example 4: complex roots
Solve x² + 2x + 5 = 0. The discriminant is 4 − 20 = −16, which is negative, so there are no real roots. The real part is −2 ÷ 2 = −1 and the imaginary part is √16 ÷ 2 = 2. The solutions are −1 + 2i and −1 − 2i.
Getting the equation into standard form
The formula only works once the equation equals zero on one side. If you have 2x² = 5x + 3, move everything to the left: 2x² − 5x − 3 = 0, so a = 2, b = −5, c = −3. Keep the signs with their coefficients. A missing term has a coefficient of 0, so x² − 9 = 0 uses a = 1, b = 0, c = −9.
Common mistakes
- Dropping the sign of b. When b is negative, −b is positive.
- Applying the division to only the square root. The whole numerator is divided by 2a.
- Forgetting that a = 0 is not a quadratic equation.
- Stopping at the discriminant. It tells you the type of roots, not their values.
If your equation has a perfect-square left side, the factored shortcut in the square trinomial calculator can be quicker than the full formula.
Using the roots: factored form and the vertex
Once you have the roots, you can rewrite the quadratic in factored form. If the roots are r and s, then ax² + bx + c = a(x − r)(x − s). For the default equation the roots are 2 and 1, so x² − 3x + 2 = (x − 2)(x − 1). Multiply it back out to confirm: x² − 3x + 2.
Two quick checks catch most arithmetic slips. The sum of the roots equals −b ÷ a, and the product of the roots equals c ÷ a. For the default, 2 + 1 = 3 and −(−3) ÷ 1 = 3. The product 2 × 1 = 2 matches c ÷ a = 2. These relations hold for complex roots too: for x² + 2x + 5, the roots −1 + 2i and −1 − 2i add to −2, which is −b ÷ a.
The graph of a quadratic 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 when they exist. For the default equation that is x = 1.5, midway between 1 and 2. Substituting back gives y = 1.5² − 3 × 1.5 + 2 = −0.25, the lowest point of the curve.
When the roots are not real
If the discriminant is negative, the parabola never reaches the x-axis. The vertex formula still locates the turning point, and the real part of the complex roots equals the vertex x-coordinate. This is a useful way to sanity-check a complex answer: the real part you read from the calculator should equal −b ÷ (2a).
Frequently asked questions
What does the discriminant mean?
It is b² − 4ac. If it is positive there are two real roots, if it is zero there is one repeated real root, and if it is negative there are no real roots, only complex ones.
What happens if a is zero?
The equation is then linear, not quadratic, so the quadratic formula does not apply. The calculator rejects a = 0.
Can it solve equations with complex roots?
Yes. When the discriminant is negative it shows each root as a real part plus or minus an imaginary part.
Do I need to rearrange the equation first?
Yes. Put it in the form ax² + bx + c = 0 before entering the coefficients, and use 0 for any term that is missing.
