What is x by the quadratic formula?
Enter a, b and c to solve ax² + bx + c = 0. You get both roots, real or complex, the discriminant, and the vertex.
- Roots
- x = 1 or x = 2
For a = 1, b = -3 and c = 2, the roots are x = 1 or x = 2.
- First real root (x₁)
- 1
- Second real root (x₂)
- 2
- Discriminant (b² − 4ac)
- 1
- Type of roots
- Two real roots
- Vertex x (axis of symmetry)
- 1.5
- Vertex y
- -0.25
- y value
- 2
Roots: x = 1 or x = 2. For a = 1, b = -3 and c = 2, the roots are x = 1 or x = 2.
y value by x value
How to calculate
Solves ax² + bx + c = 0 with the quadratic formula: real or complex roots, the discriminant, and the vertex, with a graph of the parabola.
Example with the default inputs (a 1, b -3, c 2, x value 0): For a = 1, b = -3 and c = 2, the roots are x = 1 or x = 2.
Method: x = (−b ± √(b² − 4ac)) ÷ 2a, the roots of ax² + bx + c = 0 with a ≠ 0.
- a must not be 0; b and c can be any real numbers, including 0.
- A negative discriminant gives two complex roots, re ± im·i, shown as text and as their real and imaginary parts.
- Real roots are listed smallest first. Roots and the vertex are shown to 6 decimal places.
Worked examples
Each example is checked against the calculator on every build.
- a 1, b -3, c 2, x value 0 gives Roots x = 1 or x = 2, First real root (x₁) 1, Second real root (x₂) 2, Discriminant (b² − 4ac) 1, Type of roots Two real roots, Vertex x (axis of symmetry) 1.5, Vertex y -0.25, y value 2.Source: hand calculation in content.mdx: D = 9 − 8 = 1, x = (3 ± 1) ÷ 2
- a 2, b 4, c 5, x value 1 gives Roots x = -1 ± 1.224745i, Real part -1, Imaginary part 1.224745, Discriminant (b² − 4ac) -24, Type of roots Two complex roots, Vertex y 3, y value 11.Source: hand calculation in content.mdx: D = 16 − 40 = −24, x = (−4 ± √24 i) ÷ 4; Python 3: math.sqrt(24) / 4 = 1.224744871391589
- a 1, b -6, c 9, x value 0 gives Roots x = 3, First real root (x₁) 3, Second real root (x₂) 3, Discriminant (b² − 4ac) 0, Type of roots One repeated real root, Vertex y 0.Source: hand calculation in content.mdx: D = 36 − 36 = 0, x = 6 ÷ 2 = 3
- a 1, b 0, c -2, x value 0 gives First real root (x₁) -1.414214, Second real root (x₂) 1.414214, Discriminant (b² − 4ac) 8.Source: hand calculation in content.mdx: x² = 2, x = ±√2; Python 3: math.sqrt(2) = 1.4142135623730951
- a -4.9, b 20, c 1.5, x value 2 gives First real root (x₁) -0.07367, Second real root (x₂) 4.155303, Vertex x (axis of symmetry) 2.040816, Vertex y 21.908163, y value 21.9.Source: hand calculation in content.mdx (a ball thrown up at 20 m/s from 1.5 m); Python 3: (-20 - math.sqrt(429.4)) / -9.8 = 4.155302961062383, (-20 + math.sqrt(429.4)) / -9.8 = -0.07367030800115855
- a 1, b 0, c 4, x value 0 gives Roots x = ±2i, Real part 0, Imaginary part 2.Source: hand calculation in content.mdx: x² = −4, x = ±2i
How it works
For the equation ax² + bx + c = 0 with a not 0, the quadratic formula gives the roots:
x = (−b ± √D) ÷ 2a, where D = b² − 4ac is the discriminant
- D > 0: two different real roots, listed smallest first as x₁ and x₂.
- D = 0: one repeated real root, x = −b ÷ 2a.
- D < 0: two complex roots, x = re ± im·i, with real part re = −b ÷ 2a and imaginary part im = √(−D) ÷ 2|a|.
For real roots the calculator uses a rearranged form of the same formula that avoids subtracting two nearly equal numbers (which loses digits when b² is much larger than 4ac): q = −(b + s√D) ÷ 2, where s is +1 when b ≥ 0 and −1 when b is negative, and then the roots are q ÷ a and c ÷ q. When q = 0 (b = 0 and c = 0), both roots are 0. The two forms give the same roots.
It also shows the parabola y = ax² + bx + c:
- Vertex x = −b ÷ 2a, which is also the axis of symmetry.
- Vertex y = c − b² ÷ 4a, the lowest value of y when a > 0 and the highest when a < 0.
- y value at the x you choose (0 unless you change it; leave the box empty to skip it): y = ax² + bx + c. The graph draws y for x from −10 to 10 and marks your x.
Assumptions
- a must not be 0. b and c can be any real numbers, including 0.
- Real roots are listed smallest first. The roots in the text are shown as elsewhere on the page: at most 6 decimal places (6 significant figures below 0.0001), with thousands separators and a plain hyphen for a minus sign. The separate values are not rounded.
- Coefficients so different in size that a root or the vertex is beyond about 1.8 × 10³⁰⁸ give no answer.
Worked examples by hand
x² − 3x + 2 = 0 (a = 1, b = −3, c = 2). D = (−3)² − 4 × 1 × 2 = 9 − 8 = 1, so there are two real roots: x = (3 ± 1) ÷ 2, which is x = 1 or x = 2. The vertex is at x = 3 ÷ 2 = 1.5, y = 2 − 9 ÷ 4 = −0.25. At x = 0, y = 2.
2x² + 4x + 5 = 0. D = 16 − 40 = −24, so there are two complex roots: x = (−4 ± √24 i) ÷ 4 = −1 ± 1.224745i. The vertex y is 5 − 16 ÷ 8 = 3, and at x = 1, y = 2 + 4 + 5 = 11.
x² − 6x + 9 = 0. D = 36 − 36 = 0, so there is one repeated root, x = 6 ÷ 2 = 3, and the vertex y is 0: the parabola touches the x-axis at (3, 0).
x² − 2 = 0 (b = 0). D = 0 + 8 = 8, and x = ±√8 ÷ 2 = ±√2, so x = −1.414214 or x = 1.414214.
A ball thrown up at 20 m/s from 1.5 m: its height after t seconds is −4.9t² + 20t + 1.5. D = 400 + 29.4 = 429.4 and √429.4 = 20.721969, so t = (−20 ± 20.721969) ÷ −9.8, which gives t = −0.073670 or t = 4.155303: the ball lands after about 4.16 seconds. The vertex is at t = 20 ÷ 9.8 = 2.040816 seconds, at a height of 1.5 + 400 ÷ 19.6 = 21.908163 m. At t = 2 the height is −19.6 + 40 + 1.5 = 21.9 m.
x² + 4 = 0. D = −16, so x = ±2i (real part 0, imaginary part 4 ÷ 2 = 2).
Other questions people ask
What is the quadratic formula?
For ax² + bx + c = 0 with a not 0, the solutions are x = (−b ± √(b² − 4ac)) ÷ 2a. The ± gives two roots: one with + and one with −. For x² − 3x + 2 = 0, x = (3 ± √1) ÷ 2, so x = 2 or x = 1.
What does the discriminant tell me?
The discriminant D = b² − 4ac says what kind of roots there are. If D is positive there are two different real roots, and the parabola crosses the x-axis twice. If D is 0 there is one repeated root, and the parabola touches the axis at its vertex. If D is negative there are two complex roots, and the parabola does not reach the axis.
What are complex roots?
When b² − 4ac is negative, its square root is imaginary: √−24 = √24 × i, where i = √−1. The roots then come as a pair re ± im·i. For 2x² + 4x + 5 = 0 they are x = −1 ± 1.224745i. Both parts are shown separately too.
What is the vertex of a parabola?
The turning point of the graph of y = ax² + bx + c. Its x is −b ÷ 2a, which is also the axis of symmetry, and its y is c − b² ÷ 4a. If a is positive the parabola opens upward and the vertex is its lowest point; if a is negative it is the highest point.
Why can a not be 0?
With a = 0 there is no x² term, so the equation bx + c = 0 is linear, not quadratic, and the formula would divide by 0. A linear equation has one root, x = −c ÷ b (when b is not 0).
When should I factor instead of using the formula?
Factoring is quicker when the roots are small whole numbers or simple fractions: x² − 3x + 2 = (x − 1)(x − 2). The quadratic formula always works, including for roots like √2 or complex roots that do not factor over whole numbers.