Algebra

Quadratic Equation Calculator

Enter the coefficients of ax² + bx + c = 0 to find its roots and see how the discriminant determines the solution type.

Solve an equation from its coefficients

ax² + bx + c = 0

Enter all three numbers, including 0 for a missing term. Positive, negative, and decimal coefficients are accepted: up to 15 integer digits and 10 decimal places each.

Example: x² − 3x + 2 = 0.

Equation solutions

Enter a, b, and c, then select Calculate.

Calculations run in your browser. Press Enter in a coefficient field to calculate. Successful results appear in this tab's Recent calculations.

Use the roots to find a rectangle's dimensions

1. Turn the measurements into an equation

40 square metres, with a length 3 metres greater than the width

In this fictional example, let x be the width in metres. The length is x + 3 metres, and both dimensions must be positive.

x(x + 3) = 40 → x² + 3x − 40 = 0

Expand width × length, then subtract 40 from both sides to put the equation in the form shown above the inputs.

2. Enter the three coefficients

a = 1, b = 3, c = −40

Enter 1 in Coefficient a (x²), 3 in Coefficient b (x), and -40 in Constant c, then select Calculate.

x₁ = −8 · x₂ = 5

Enter these values yourself. Try an example keeps its original x² − 3x + 2 = 0 example.

3. Apply the problem's conditions

Width 5 m, length 8 m

Both −8 and 5 solve the equation. A negative width cannot describe this rectangle, so use x = 5 and length = 5 + 3 = 8.

5 × 8 = 40 m² · 8 − 5 = 3 m

The calculator shows all algebraic roots. Check units and the original conditions before choosing a root for a real-world problem.

Three quadratic examples

Two real roots

x² − 3x + 2 = 0

Δ = (−3)² − 4(1)(2) = 1

The roots are (3 − 1) ÷ 2 = 1 and (3 + 1) ÷ 2 = 2.

The equation also factors as (x − 1)(x − 2) = 0.

A repeated root

x² − 2x + 1 = 0

Δ = (−2)² − 4(1)(1) = 0

Both branches of the quadratic formula give x = 1. The calculator lists this repeated root once.

The equation is (x − 1)² = 0.

Complex roots

x² + 1 = 0

Δ = 0² − 4(1)(1) = −4

There are no real roots. Using i² = −1, the two roots are −i and +i.

They have the same real part, zero, and opposite imaginary parts.

Formula, special cases, and precision

For a ≠ 0, define the discriminant Δ = b² − 4ac. The quadratic formula is:

x = (−b ± √Δ) ÷ (2a)

The ± sign gives the two branches. When Δ = 0, they coincide. When Δ < 0, the roots can be written as −b/(2a) ± i√(−Δ)/(2|a|), with a positive imaginary magnitude and opposite signs.

When a = 0 and b ≠ 0, solve the linear equation using x = −c/b. If a = b = 0 and c = 0, every x is a solution. If a = b = 0 but c is nonzero, there is no solution. The discriminant is reported as not applicable in these cases.

The discriminant and its sign are calculated exactly from your decimal coefficients. Rational roots are kept as exact fractions and rounded only for display. Irrational roots use a separate 120-significant-digit calculation; for two real roots, a stable form of the quadratic formula preserves a small root when the other root is very large.

Results show 6 decimal places by default; 0, 2, 4, 6, or 10 are available. Exact halfway values round away from zero. ≈ marks a rounded result, including every finite decimal display of an irrational root. For complex roots, it applies if either displayed component is approximate. Negative zero is displayed as zero.

Two distinct roots can look equal after display rounding. A nonzero discriminant, root, or component can also look like zero at the selected precision. A note flags those cases; the classification always uses the exact, unrounded discriminant. Changing precision does not solve a new equation or add another history entry.

Reference: OpenStax — Quadratic Equations explains the quadratic formula, discriminant, and real and complex solutions.

Common questions

What if a term is missing?

Enter 0 for that coefficient. For x² − 4 = 0, enter a = 1, b = 0, and c = −4. All three fields are required so a blank cannot silently change the equation.

Can a, b, or c be negative?

Yes. Keep the signs from the equation after moving all terms to one side. For −x² + 3x − 2 = 0, enter −1, 3, and −2; its real roots are still 1 and 2.

What does a negative discriminant mean?

There are no real solutions, but there are two complex-conjugate roots. They have the same real part and imaginary parts with equal magnitude and opposite signs. The symbol i satisfies i² = −1.

Why are two roots shown as the same number?

They may differ beyond the selected decimal places. If the exact discriminant is positive, the roots remain distinct even when their rounded displays match. Increase precision or check the exact discriminant and calculation steps.

Can I enter fractions or an entire equation?

Enter three decimal coefficients, not an equation or expressions. To use 1/2 as a coefficient, enter 0.5. Correct thousands grouping is accepted, such as 1,000.25. Currency symbols, scientific notation, NaN, and Infinity are not accepted.

What are the input limits?

Each coefficient accepts up to 15 digits before the decimal point, 10 after it, and 64 characters, with an optional keyboard plus or minus sign. Use a leading zero for decimals such as 0.5. The solution is for the exact decimal coefficients entered.