Quadratic equation calculator

Enter coefficients a, b and c of ax² + bx + c = 0. The calculator computes the discriminant Δ = b² − 4ac and the real roots x = (−b ± √Δ)/(2a). With a = 1, b = −5, c = 6 the roots are x = 2 and x = 3 (Δ = 1). When Δ < 0 it reports no real roots — no complex numbers. When a = 0 it falls back to the linear equation bx + c = 0.

Input data

Coefficients of ax² + bx + c = 0

Result

Enter a, b and c. Δ and the roots will appear here.

When a = 0, the calculator falls back to bx + c = 0. Plain linear ax + b = 0 lives on a separate page. A negative discriminant means no real roots on this page.

How it works

How x² − 3x + 2 = 0 is solved
Δ1
√Δ1
x₁, x₂1, 2

A quadratic equation is ax² + bx + c = 0 with a not zero. You look for the x values that make the left side zero. The calculator uses the coefficients a, b and c that you enter and computes the discriminant Δ = b² − 4ac. With a = 1, b = −3, c = 2 the equation is x² − 3x + 2 = 0, Δ = 1 and the roots are 1 and 2.

The quadratic formula is x = (−b ± √Δ) / (2a). When Δ > 0, plus and minus give two different places on the axis. When Δ = 0, you get one double root x = −b / (2a). When Δ < 0, the result says there are no real roots. Mathematical model: the quadratic formula with discriminant — the classical school and textbook path.

Vieta’s formulas link the sum and product of the roots to the coefficients: x₁ + x₂ = −b/a and x₁ · x₂ = c/a. For 1, −3, 2: 1 + 2 = 3 and 1 · 2 = 2. The parabola y = ax² + bx + c has vertex at x = −b/(2a); the chart next to the result marks the same zeros when a ≠ 0.

When a = 0 it is no longer a parabola. The calculator then solves bx + c = 0, so x = −c/b when b ≠ 0. All-zero a, b, c give infinitely many solutions; a = b = 0 and c ≠ 0 give none. A period and a comma are equivalent.

Worked examples on the page: 1, −3, 2 → x = 1 and 2; 1, 2, 1 → x = −1 (double); 1, 0, 1 → no real roots; 2, 0, −8 → x = −2 and 2; 0, 2, −4 → x = 2 (linear). The panel shows a, b, c, Δ, x₁ and x₂ beside the primary root description.

Formula

Δ = b2 − 4ac, then x = (−b ± √Δ) / (2a) (when a ≠ 0 and Δ ≥ 0).

Symbol a is the coefficient of x² (field a). b of x; c is the constant term. The discriminant Δ decides how many real roots exist.

Mathematical model: quadratic formula with discriminant (completing the square; history: al-Khwarizmi; Vieta for sum and product).

Theory, definition and derivation

Definition

A quadratic equation over the reals is an equation of the form ax² + bx + c = 0, where a, b, c ∈ ℝ and a ≠ 0. The unknowns are the values of x that make the degree-two polynomial vanish. The discriminant Δ = b² − 4ac decides how many real roots exist. The quadratic formula x = (−b ± √Δ) / (2a) gives them explicitly when Δ ≥ 0. This page implements exactly that path in the browser’s floating-point arithmetic and rounds displayed roots to six decimal places (round(x · 10⁶) / 10⁶).

When a = 0 the equation degenerates to bx + c = 0: if b ≠ 0 then x = −c/b; if b = c = 0 — infinitely many solutions; if b = 0 and c ≠ 0 — none.

Historical and conceptual context

Quadratic procedures were known in Babylonia. Al-Khwarizmi (9th century) systematized completing the square. In Europe the discriminant form was popularized by Cardano (16th century). Geometric square treatments also appear in Euclid’s Elements (Book II).

Conceptually a quadratic equation joins algebra (polynomial roots) with geometry (intersections of the parabola y = ax² + bx + c with the x-axis). The vertex sits at x = −b/(2a) — the same place as the double root when Δ = 0. In physics, projectile motion in vacuum is parabolic; optics and mechanics reuse the same quadratic structures. This calculator does not solve higher-degree equations or systems — only ax² + bx + c = 0 (or the linear degeneration).

Formal properties

Coefficient domain: a, b, c ∈ ℝ. For a ≠ 0: Δ = b² − 4ac. If Δ > 0, two distinct real roots; if Δ = 0, one double root; if Δ < 0, no roots in ℝ (roots exist in ℂ, outside this page). Vieta’s formulas: x₁ + x₂ = −b/a, x₁ · x₂ = c/a (for two roots, including a double root read as x₁ = x₂).

The parabola opens upward when a > 0 and downward when a < 0. The axis of symmetry is x = −b/(2a).

Full derivation

Step 1. Assume a ≠ 0. Divide by a: x² + (b/a)x + c/a = 0.

Step 2. Complete the square: x² + (b/a)x = (x + b/(2a))² − (b/(2a))². Hence (x + b/(2a))² = (b² − 4ac)/(4a²) = Δ/(4a²).

Step 3. When Δ ≥ 0: x + b/(2a) = ± √Δ / (2a), so x = (−b ± √Δ) / (2a). That is the same formula the calculator computes.

Step 4 (Vieta). For two roots, sum and product follow from expanding a(x − x₁)(x − x₂) = ax² − a(x₁+x₂)x + a x₁ x₂ and matching ax² + bx + c.

Step 5 (degeneration). When a = 0 the equation is no longer degree 2; the linear path bx + c = 0 is handled separately, with no Δ and no parabola chart.

Special cases

Examples: 1, −3, 2 → Δ = 1, x = 1 and 2; 1, 2, 1 → x = −1; 1, 0, 1 → no real roots; 2, 0, −8 → x = −2 and 2; 0, 2, −4 → x = 2.

When b = 0 and Δ > 0, roots are symmetric about zero. When c = 0 and a ≠ 0, one root is x = 0.

Numerical notes

The calculator computes delta = b·b − 4·a·c, then roots with √(delta) and division by 2·a. The comparison delta > 0 / === 0 / < 0 is raw in floating-point arithmetic — when Δ is extremely close to zero, rounding can matter. Display uses rounding to 10⁶. A period and a comma are equivalent in the parser.

The SVG chart ranges around the roots (or [−3, 3] with no zeros).

The result panel shows a, b, c, Δ and the roots x₁ and x₂ when they exist. When Δ > 0 both roots differ; when Δ = 0 the calculator shows the double root; when Δ < 0 the message reports no real roots — without switching to complex numbers. The parabola chart y = ax² + bx + c appears only when a ≠ 0 and helps you see the x-axis intersections.

Vieta’s formulas give a quick check: the sum of roots should be near −b/a and the product near c/a. For 1, −3, 2 the sum is 3 = −(−3)/1 and the product is 2 = 2/1. For 1, 2, 1 the double root −1 satisfies (−1)+(−1) = −2 and (−1)·(−1) = 1. That check is not a separate form mode — it follows from the same quadratic formula.

When a = 0 the page does not draw a parabola and does not compute Δ. The linear branch bx + c = 0 is intentional: empty fields may be treated as zero, but the linear result must still be finite. A higher-degree equation, a two-equation system, or a quadratic inequality lies outside this calculator.

Related notions and sources

Related: linear equation, linear function value, difference of squares, square root. Sources: Wikipedia — Quadratic equation; MathWorld — Quadratic Equation; al-Khwarizmi; Euclid, Elements II.

In school practice, compute Δ first, then the roots, and finally check by substituting into ax² + bx + c. For 1, −3, 2: 1 − 3 + 2 = 0 and 4 − 6 + 2 = 0. Educational tool; it does not replace a textbook or a teacher’s check.

How to use

  1. Enter a, for example 1.
  2. Enter b and c, for example −3 and 2. Period or comma in a decimal.
  3. Click Calculate or wait for the live result. 1, −3, 2 give Δ = 1 and x = 1 and 2.
  4. Check the panel: a, b, c, Δ, x₁, x₂ and the parabola chart.
  5. Compute a linear equation on the neighboring page.

Symbol glossary

ax² + bx + c = 0. Δ = b² − 4ac. For 1, −3, 2 the roots are x = 1 and 2.

a
Coefficient of x². Field a. Zero → linear branch.
b
Coefficient of x. Field b. Enters Δ and −b/(2a).
c
Constant term. Field c. Product of roots = c/a (Vieta).
Δ
Discriminant b² − 4ac. For 1, −3, 2: Δ = 1.
x₁, x₂
Roots (−b ± √Δ)/(2a). When Δ = 1: 1 and 2.

Examples

Example 1

  • a = 1
  • b = −3
  • c = 2

x₁ = 1, x₂ = 2

What are the roots at a=1, b=−3, c=2? 1 and 2.

Example 2

  • a = 1
  • b = 2
  • c = 1

x = −1

What is the root at a=1, b=2, c=1? −1 (double).

Example 3

  • a = 1
  • b = 0
  • c = 1

none

Does x²+1=0 have real roots? No (Δ=−4).

Example 4

  • a = 2
  • b = 0
  • c = −8

x = −2 and 2

What are the roots of 2x²−8=0? −2 and 2.

Example 5

  • a = 0
  • b = 2
  • c = −4

x = 2

What is x at a=0, b=2, c=−4? 2 (linear).

Example 6

  • a = 1
  • b = −5
  • c = 6

x = 2 and 3

What are the roots of x²−5x+6=0? 2 and 3.

Example 7

  • a = 0
  • b = 0
  • c = 0

∞

What if a=b=c=0? Infinitely many solutions.

Example 8

  • a = 0
  • b = 0
  • c = 1

none

What if a=b=0, c=1? No solutions.

Related calculators

Common questions

What does this calculator compute?

It solves the quadratic equation ax² + bx + c = 0 in real numbers. With a = 1, b = −3, c = 2 the discriminant is Δ = 1 and the roots are x = 1 and x = 2. When a = 0 it falls back to the linear equation bx + c = 0.

What does the discriminant Δ = b² − 4ac mean?

The discriminant decides how many real roots you get. Δ > 0 gives two distinct x, Δ = 0 one double root, Δ < 0 no real roots. For 1, −3, 2 you get Δ = 1.

What is the quadratic formula?

For a ≠ 0: x = (−b ± √Δ) / (2a). Plus and minus are the two places on the axis when Δ > 0. When Δ = 0 you get x = −b / (2a). The calculator rounds to six decimal places when the number is not short.

What are Vieta’s formulas?

For ax² + bx + c = 0 with roots x₁, x₂: the sum x₁ + x₂ = −b/a and the product x₁ · x₂ = c/a. For 1, −3, 2: sum 1 + 2 = 3 = −(−3)/1, product 1 · 2 = 2 = c/a. The result panel shows this check when there are two roots.

Does a negative discriminant give complex roots here?

No on this page. The calculator stays with real numbers and reports that there are no real roots. Complex roots need a separate tool.

What if a = 0?

It is no longer quadratic. The calculator solves bx + c = 0, so x = −c/b when b ≠ 0. If b = 0 and c = 0 there are infinitely many solutions; if b = 0 and c ≠ 0 there are none. Plain ax + b = 0 lives on the linear-equation page.

Does a comma in 1.5 work?

Yes. 1.5 and 1,5 are the same coefficient. The formula does not change with the decimal separator.

Why is there a chart next to the result?

The parabola y = ax² + bx + c shows the same zeros on the x-axis. When a = 0 it does not draw the chart, because there is no quadratic term.

How is this different from a linear equation?

Here you have x², a discriminant Δ, and possibly two roots. On the linear page it stays ax + b = 0 and one x = −b/a, with no parabola and no discriminant.

Do the currency and unit settings in the page header affect the result?

No. The result depends only on coefficients a, b and c. The currency and unit settings in the page header do not affect this result.

How do I solve a quadratic equation?

Compute Δ = b² − 4ac. When Δ > 0: x = (−b ± √Δ)/(2a). When Δ = 0: x = −b/(2a). When Δ < 0: no real roots on this page. Example x² − 5x + 6 = 0: Δ = 1, x = 2 and x = 3.

What is the discriminant formula?

Δ = b² − 4ac. The sign of Δ decides how many real roots you get: two, one double root, or none. With a = 1, b = −3, c = 2 you get Δ = 1.

What are the roots of x² − 5x + 6 = 0?

x = 2 and x = 3. Enter a = 1, b = −5, c = 6: Δ = 25 − 24 = 1, then (−(−5) ± 1)/2. Vieta: sum 5, product 6.

What if the discriminant is negative?

There are no real roots. The calculator does not switch to complex roots — you get a message that there are no solutions in ℝ.

Can a be zero?

Yes, but then it is no longer quadratic. The page solves bx + c = 0. Plain ax + b = 0 lives on the linear-equation page.

With a = 1, b = −3, c = 2 the discriminant is Δ = 1 and the roots are x = 1 and x = 2. Vieta: sum 3, product 2. Compute a linear equation on the neighboring page.

Knowledge sources

The formula, discriminant and historical note come from recognized sources.

Page updated November 3, 2026.