Quadratic Formula Calculator: Solve ax² + bx + c = 0
Enter a, b and c to solve a quadratic equation. You get both roots, real or complex, the discriminant, the vertex of the parabola and the factored form.
Last reviewed
Solutions
x₁ = 3 x₂ = 2
x² - 5x + 6 = 0
- Discriminant b² − 4ac
- 1
- Kind of roots
- two real roots
- Sum of roots −b/a
- 5
- Product of roots c/a
- 6
- Vertex
- (2.5, -0.25)
- Factored form
- 1(x - 3)(x - 2)
Roots are shown to 12 significant figures. Complex roots come as a pair p ± qi, where i is the square root of −1.
The quadratic formula
A quadratic equation has the form ax² + bx + c = 0, where a, b and c are numbers and a is not zero. Wolfram MathWorld gives its solutions as:
x = (−b ± √(b² − 4ac)) ÷ (2a)
This is the quadratic formula. The ± sign gives two solutions, one with the plus and one with the minus. By the fundamental theorem of algebra there are always two, counting a repeated one twice, and as MathWorld says, they may be both real or both complex.
The discriminant decides the roots
The expression under the square root, b² − 4ac, is the discriminant.
- Positive: two different real roots. The parabola crosses the x-axis twice.
- Zero: one repeated real root, x = −b ÷ 2a. The parabola just touches the axis.
- Negative: two complex roots, −b ÷ 2a ± (√(4ac − b²) ÷ 2a)i. The parabola does not reach the axis.
Worked examples
x² − 5x + 6 = 0. Here a = 1, b = −5, c = 6. The discriminant is 25 − 24 = 1, so x = (5 ± 1) ÷ 2, giving x = 3 and x = 2. It factors as (x − 3)(x − 2).
2x² + 3x − 2 = 0. The discriminant is 9 + 16 = 25, so x = (−3 ± 5) ÷ 4, giving x = 0.5 and x = −2.
x² + 2x + 5 = 0. The discriminant is 4 − 20 = −16. The square root of −16 is 4i, so x = (−2 ± 4i) ÷ 2, giving −1 + 2i and −1 − 2i.
x² − 2x + 1 = 0. The discriminant is 4 − 4 = 0, so there is one repeated root, x = 1, and the equation is (x − 1)² = 0.
x² − 2 = 0. The discriminant is 8, so x = ±√8 ÷ 2 = ±√2, which is ±1.41421356237.
| a | b | c | Discriminant | Roots |
|---|---|---|---|---|
| 1 | -5 | 6 | 1 | 3 and 2 |
| 2 | 3 | -2 | 25 | 0.5 and -2 |
| 1 | 2 | 5 | -16 | -1 + 2i and -1 - 2i |
| 1 | -2 | 1 | 0 | 1 |
| 1 | 0 | -2 | 8 | 1.41421356237 and -1.41421356237 |
Checking your answer
Vieta’s formulas, which MathWorld states for the two roots, give a quick check: the roots add up to −b ÷ a and multiply to c ÷ a. For x² − 5x + 6 the roots 3 and 2 add to 5 = −(−5) ÷ 1 and multiply to 6 = 6 ÷ 1. The calculator shows both the sum and the product next to the roots.
The vertex
The parabola y = ax² + bx + c has its turning point at x = −b ÷ 2a, with height y = c − b² ÷ 4a. For x² − 5x + 6 that is (2.5, −0.25). It is the lowest point when a is positive and the highest when a is negative, and it sits halfway between two real roots.
Common mistakes
- Forgetting the sign of b. The formula starts with −b, so b = −5 gives +5.
- Putting 2a under only part of the fraction. The whole numerator is divided by 2a.
- Dropping the factor of 4 in 4ac.
- Leaving a as zero. The equation is then linear.
- Rounding the discriminant before the square root. The calculator keeps full precision.
For the sides of a right triangle, use the right triangle calculator, and for square roots and powers the root calculator and the exponent calculator.
Checking roots with sum and product
For a quadratic ax² + bx + c = 0 with roots x₁ and x₂, the roots add up to −b ÷ a and multiply to c ÷ a. For 2x² − 8x + 6 = 0 the roots are 1 and 3. Their sum is 4, which is 8 ÷ 2, and their product is 3, which is 6 ÷ 2. If the sum and product of your answers do not match, one of the roots is wrong.
Completing the square
Any quadratic can be written as a(x + b ÷ 2a)² + (4ac − b²) ÷ 4a. The squared term is zero at the vertex, which is why the vertex lies at x = −b ÷ 2a, halfway between the roots.
A throw in the air
The height of a ball thrown upward at 20 m/s from 1.5 m is h = −4.9t² + 20t + 1.5 metres after t seconds, using g = 9.8 m/s². It reaches the ground when h = 0, so t = (20 + √(400 + 29.4)) ÷ 9.8 = (20 + 20.722) ÷ 9.8 = 4.155 seconds. The other root is negative, which is a time before the throw, so it is ignored.
How it is calculated
All of the arithmetic is exact decimal arithmetic to 50 digits, and results are shown to 12 significant figures, with trailing zeros dropped.
Frequently asked questions
What is the quadratic formula?
For ax² + bx + c = 0 with a not equal to zero, x = (−b ± √(b² − 4ac)) ÷ (2a). The two signs give the two solutions.
What is the discriminant?
The discriminant is b² − 4ac, the part under the square root. If it is positive there are two different real roots, if it is zero there is one repeated root, and if it is negative the roots are a pair of complex numbers.
What if a is zero?
Then the equation is not quadratic. It is the linear equation bx + c = 0, with the single solution x = −c ÷ b, and the calculator tells you so instead of dividing by zero.
What are complex roots?
When the discriminant is negative the square root is of a negative number, which is a multiple of i, the square root of −1. The roots are then p + qi and p − qi, where p = −b ÷ 2a. The parabola does not cross the x-axis.
What are Vieta's formulas?
The two roots add up to −b ÷ a and multiply to c ÷ a. They give a quick check on your answers: for x² − 5x + 6 the roots 2 and 3 add to 5 and multiply to 6.
How is the vertex found?
The vertex is at x = −b ÷ 2a, halfway between the roots, and its height is c − b² ÷ 4a. It is the lowest point of the parabola if a is positive and the highest if a is negative.
Related calculators
- Right Triangle CalculatorChoose what you know about the right triangle and enter it.
- Exponent CalculatorEnter a base and an exponent.
- Root CalculatorEnter a number and a root index.
- Factor CalculatorEnter a whole number to list all its factors and factor pairs.
- Greatest Common Factor CalculatorEnter two to six whole numbers.
- Percentage CalculatorPick the question you are actually asking.
- Matrix CalculatorType a matrix with one row per line, choose what to calculate and read the answer in exact fractions.