Quadratic Formula Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Introduction

This quadratic formula calculator solves equations written in the standard form ax^2 + bx + c = 0. You enter the coefficients a, b, and c, and the calculator returns the solution(s) for x. It also uses the discriminant to tell you whether the equation has two distinct real roots, one repeated real root, or a pair of complex conjugate roots.

Quadratic equations appear throughout algebra and applied math. In physics they show up in constant-acceleration motion (for example, projectile height as a function of time). In geometry they appear when you compute intersections between curves. In business and economics they can appear in optimization problems where a profit or cost curve is modeled as a parabola. The quadratic formula is a dependable method because it works for every quadratic equation with a ≠ 0, even when factoring is difficult or impossible.

If a = 0, the equation is no longer quadratic; it becomes linear. This page still handles that case by solving the resulting linear equation when possible. If both a and b are zero, the equation either has no solution (when c ≠ 0) or infinitely many solutions (when c = 0).

How to use

  1. Rewrite your equation so it matches ax^2 + bx + c = 0 (move all terms to one side).
  2. Enter the numeric values of a, b, and c in the fields below. Decimals and negative numbers are allowed.
  3. Select Solve equation to compute the roots.
  4. Read the result message to see whether the roots are real or complex and what their values are (rounded to 6 decimals).

Tip: If your equation is not already equal to zero, convert it first. For example, if you have 2x^2 = 8x - 6, move everything to one side: 2x^2 - 8x + 6 = 0, so a = 2, b = -8, c = 6.

Another common situation is when the equation is written with a leading negative or with terms out of order, such as -x^2 + 5 = 2x. Bring everything to one side and reorder by powers of x: -x^2 - 2x + 5 = 0. In that case a = -1, b = -2, and c = 5. The calculator accepts negative a values; the formula still works.

Formula and assumptions

For a true quadratic equation (a ≠ 0), the quadratic formula is:

x = (-b ± √(b² − 4ac)) / (2a)

The expression inside the square root is the discriminant: Δ = b² − 4ac. The discriminant determines the type of solutions:

  • Δ > 0: two distinct real roots.
  • Δ = 0: one repeated real root (a “double root”).
  • Δ < 0: two complex roots (a conjugate pair).

If a = 0, the equation becomes linear: bx + c = 0. In that case, the solution is x = -c / b when b ≠ 0. If a = 0 and b = 0, then the equation is either inconsistent (c ≠ 0, no solution) or true for all real numbers (c = 0, infinitely many solutions).

Interpretation note: the calculator reports numeric approximations. When the discriminant is negative, the square root involves √(-Δ), which produces an imaginary component. The calculator displays complex roots in the standard p ± qi form, where i is the imaginary unit satisfying i² = -1.

Worked examples

The examples below show how to identify coefficients, compute the discriminant, and interpret the result. You can copy the coefficients directly into the calculator form.

Example 1: two real roots

Solve x^2 − 3x + 2 = 0. Here a = 1, b = -3, c = 2.

  • Compute the discriminant: Δ = b² − 4ac = (-3)² − 4(1)(2) = 9 − 8 = 1.
  • Since Δ > 0, there are two real roots.
  • Compute the roots: x = (3 ± √1) / 2, so x = (3 + 1)/2 = 2 and x = (3 − 1)/2 = 1.

If you enter a = 1, b = -3, c = 2 in the calculator, you should see two real roots close to 2.000000 and 1.000000.

Example 2: one repeated real root

Solve 2x^2 + 8x + 8 = 0. Here a = 2, b = 8, c = 8.

  • Discriminant: Δ = 8² − 4(2)(8) = 64 − 64 = 0.
  • Since Δ = 0, there is exactly one real solution, but it occurs twice (a double root).
  • Root: x = -b/(2a) = -8/(4) = -2.

In a graphing context, a double root means the parabola touches the x-axis at one point and turns around there, rather than crossing the axis.

Example 3: complex roots

Solve x^2 + 2x + 5 = 0. Here a = 1, b = 2, c = 5.

  • Discriminant: Δ = 2² − 4(1)(5) = 4 − 20 = -16.
  • Since Δ < 0, the solutions are complex.
  • Real part: -b/(2a) = -2/2 = -1.
  • Imaginary magnitude: √(-Δ)/(2a) = √16/2 = 4/2 = 2.
  • Roots: x = -1 ± 2i.

Complex roots often appear in control theory, signal processing, and any setting where oscillations are modeled. Even if a real-world variable cannot be complex, complex roots can still be meaningful in intermediate calculations.

Common coefficient mistakes (and how to avoid them)

Many incorrect answers come from coefficient sign errors rather than the formula itself. Use these quick checks before you calculate.

  • Forgetting to move all terms to one side: If your equation is x^2 + 4x = 1, rewrite it as x^2 + 4x - 1 = 0. Here c is -1, not 1.
  • Dropping a negative sign: If you have x^2 - (3x - 2) = 0, distribute the minus: x^2 - 3x + 2 = 0. That makes b = -3 and c = 2.
  • Misreading the middle term: In x^2 - x + 6 = 0, the coefficient b is -1, not 1.
  • Using fractions: If your equation is (1/2)x^2 + (3/4)x - 2 = 0, you can enter decimals (a = 0.5, b = 0.75, c = -2) or multiply the entire equation by 4 to clear denominators: 2x^2 + 3x - 8 = 0. Both approaches produce the same roots.

A quick sanity check is to plug your computed root back into the original equation. If the left-hand side is close to zero (allowing for rounding), your coefficients and arithmetic are consistent.

Understanding the output

The result area reports one of several messages:

  • Two real roots: You will see two numbers. Either order is fine; both satisfy the equation.
  • One repeated real root: You will see a single number. Algebraically it counts as two identical solutions.
  • Complex roots: You will see two values in p ± qi form. They are conjugates, meaning the real part is the same and the imaginary parts have opposite signs.
  • Linear solution: If a = 0 and b ≠ 0, the calculator solves bx + c = 0.
  • No solution / all real numbers: If a = 0 and b = 0, the equation reduces to c = 0 (always true) or c ≠ 0 (never true).

The calculator rounds displayed values to six decimal places for readability. If you need more precision, you can rerun the calculation with scaled coefficients (for example, multiply all coefficients by 10 or 100) or use a symbolic math tool. Scaling does not change the roots as long as you multiply a, b, and c by the same nonzero factor.

Limitations and notes

  • Rounding: Results are displayed to 6 decimal places. Exact values may be repeating decimals or irrational numbers.
  • Very large or very small numbers: JavaScript uses floating-point arithmetic. Extremely large coefficients can lead to rounding error.
  • Equality checks: The calculator classifies the discriminant using comparisons to 0. For values extremely close to 0, floating-point precision may affect whether it is treated as zero.
  • Complex roots format: Complex solutions are shown in a ± bi form. The calculator does not simplify radicals or express results in exact symbolic form.
  • Not a graphing tool: This page computes roots only; it does not plot the parabola or show step-by-step factoring.

For best results, enter coefficients as they appear in standard form and double-check signs. If you are solving a word problem, confirm that the equation you set up matches the situation before interpreting the roots. When the equation models a real quantity (like time or distance), remember that not every mathematical root is physically meaningful; you may need to discard negative time values or other impossible solutions.

Frequently asked questions

Does the quadratic formula always work?

Yes, for any quadratic equation with a ≠ 0. It is derived by completing the square and does not rely on factoring. If a = 0, the equation is not quadratic; this calculator switches to the linear solution when possible.

Why do I get complex roots when I expected real ones?

Complex roots occur when the discriminant is negative. If you expected real roots, re-check the coefficients you entered, especially the sign of c after moving terms to one side. Also confirm you did not accidentally type b where c belongs (or vice versa).

What does a repeated root mean?

A repeated root happens when Δ = 0. The parabola touches the x-axis at exactly one point. In factoring terms, the quadratic can be written as a(x - r)^2, where r is the repeated root.

Can I enter integers, decimals, or negative numbers?

Yes. The inputs accept any real numbers that your browser can parse as numeric values, including negative values and decimals. If you have fractions, you can convert them to decimals or multiply the entire equation by a common denominator to clear fractions.

How can I verify the answer?

Substitute each reported root back into ax^2 + bx + c. For a correct root, the result should be very close to zero. Small nonzero values can occur due to rounding, especially when coefficients are large or when the discriminant is close to zero.

Enter coefficients

Use the standard form ax^2 + bx + c = 0. Decimals are allowed. If a = 0, the calculator will solve the linear equation bx + c = 0 when possible.

Enter coefficients and calculate.

Embed this calculator

Copy and paste the HTML below to add the Quadratic Formula Calculator (ax² + bx + c = 0) — Find Real or Complex Roots to your website.