IQRCalculator

Quadratic Equation Calculator

Roots of ax² + bx + c = 0, real or complex, with the discriminant, the vertex and an exact form where one exists.

Result

Solutionsx₁ = −1.4641016151, x₂ = 5.4641016151x² − 4x − 8 = 0
Exact form
x = 2 ± 2√3
Discriminant D
48
Vertex
(2, −12)
Axis of symmetry
x = 2
How it was calculated
  1. Discriminant
    D = b² − 4ac = (−4)² − 4 × 1 × (−8) = 48

    D > 0: two different real solutions.

  2. Quadratic formula
    x = (−b ± √D) ÷ 2a = (4 ± √48) ÷ 2
  3. Solutions
    x = 2 ± 2√3

Graph

How to use it

Rearrange the equation into the form ax² + bx + c = 0 and enter the three coefficients with their signs: for x² − 4x − 8 = 0, enter a = 1, b = −4 and c = −8. Decimal coefficients are allowed. The result shows the roots, the discriminant, the vertex, the axis of symmetry and a graph of the parabola.

The quadratic formula

x = (−b ± √D) ÷ 2a, where D = b² − 4ac
vertex = (−b ÷ 2a, c − b² ÷ 4a)D — the discriminant. D > 0: two real roots; D = 0: one repeated root; D < 0: two complex roots, −b ÷ 2a ± (√−D ÷ 2|a|)i

The parabola y = ax² + bx + c opens upwards when a > 0 and downwards when a < 0. Its axis of symmetry is the vertical line x = −b ÷ 2a through the vertex, and the real roots are the points where it crosses the x-axis.

Worked examples

Two irrational roots: x² − 4x − 8 = 0

Given: a = 1, b = −4, c = −8

  • D = (−4)² − 4 × 1 × (−8) = 16 + 32 = 48
  • x = (4 ± √48) ÷ 2, and √48 = 4√3, so x = 2 ± 2√3
  • As decimals: x₁ = −1.4641016151, x₂ = 5.4641016151
  • Vertex (2, −12); axis of symmetry x = 2

Rational roots: 2x² − 3x − 2 = 0

Given: a = 2, b = −3, c = −2

D = 9 + 16 = 25, a perfect square, so the roots are rational: x = (3 ± 5) ÷ 4, giving x = −1/2 or x = 2. The vertex is (0.75, −3.125).

Complex roots: x² + 2x + 5 = 0

Given: a = 1, b = 2, c = 5

D = 4 − 20 = −16, so there is no real solution: the lowest point of the parabola, the vertex (−1, 4), lies above the x-axis. The complex roots are x = (−2 ± 4i) ÷ 2 = −1 ± 2i.

Precision and special cases

  • Exact form: when a, b and c are all integers no larger than 1,000,000 in size, the roots are also given as a reduced fraction or a simplified radical. With decimal coefficients only the decimal roots are shown.
  • Numerical stability: decimal roots are computed as q = −½(b + sign(b) × √D), x₁ = q ÷ a and x₂ = c ÷ q, which avoids subtracting two nearly equal numbers. For x² + 100,000x + 1 = 0, the textbook formula evaluated in standard double precision gives a small root of −0.0000100000034, wrong from the eighth significant digit; this calculator returns −0.00001, matching the true root −0.000010000000001… to the 10 decimal places shown.
  • a = 0: the equation is linear, bx + c = 0, and the single solution x = −c ÷ b is returned. If a and b are both 0, there is no solution when c ≠ 0, and every x is a solution when c = 0.
  • Decimal results are rounded to 10 decimal places.

To simplify a square root on its own, such as √48 = 4√3, use the root calculator.

Questions

What does the discriminant tell me?

How many real roots there are, without solving: two if D is positive, one repeated root if D is 0, none (two complex roots) if D is negative. With integer coefficients, a perfect-square D also means the roots are rational.

Can I solve it by factoring instead?

When the roots are rational, yes. 2x² − 3x − 2 = (2x + 1)(x − 2), which is 0 when x = −1/2 or x = 2. When D is not a perfect square, as in x² − 4x − 8 = 0, there is no factorization with integers and the formula is the way to go.

How can I check the roots?

Use the sum and product of the roots: x₁ + x₂ = −b ÷ a and x₁ × x₂ = c ÷ a. For x² − 4x − 8 = 0, the roots 2 ± 2√3 add up to 4 and multiply to 4 − 12 = −8.

Method & sources