ThisCalculator

Everyday

Quadratic Formula Calculator: Step-by-Step

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

This quadratic formula calculator solves any quadratic equation of the form ax² + bx + c = 0 for real or complex roots. You enter the coefficients a, b, and c, and it returns the two roots (or one repeated root) using the standard quadratic formula, along with the discriminant value.

Formula

For a quadratic equation written in standard form:

ax² + bx + c = 0

the solutions are given by:

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

where:

  • a is the coefficient of x² (a ≠ 0),
  • b is the coefficient of x,
  • c is the constant term,
  • the symbol ± means you calculate once with a plus and once with a minus, giving two roots.

The expression under the square root, b² − 4ac, is called the discriminant. It tells you the nature of the roots:

  • If the discriminant is positive, there are two distinct real roots.
  • If it is zero, there is exactly one real root (a repeated root).
  • If it is negative, there are two complex conjugate roots.

Worked Example

Using the default values from the calculator above: a = 1, b = −3, c = 2.

  1. Write the equation: x² − 3x + 2 = 0.
  2. Calculate the discriminant: (−3)² − 4·1·2 = 9 − 8 = 1.
  3. Since the discriminant is positive, there are two real roots.
  4. Apply the formula: x = (3 ± √1) / (2·1) = (3 ± 1) / 2.
  5. First root: (3 + 1)/2 = 2.
  6. Second root: (3 − 1)/2 = 1.

The calculator outputs x₁ = 2 and x₂ = 1, which matches. You can verify by plugging either value back into the original equation: 2² − 3·2 + 2 = 4 − 6 + 2 = 0.

How to Use the Calculator

Enter the coefficients a, b, and c from your equation. Make sure the equation is in standard form before entering values:

  • Move all terms to one side so the equation equals zero.
  • Write the x² term first, then the x term, then the constant.
  • If a term is missing, enter 0 for that coefficient (for example, 2x² − 5 = 0 becomes a = 2, b = 0, c = −5).
  • Keep the sign of each coefficient: a negative b or c must be entered with a minus sign.

The calculator uses the standard formula and shows the discriminant so you can immediately see whether the roots are real or complex. If the discriminant is negative, the outputs x₁ and x₂ will show “NaN” because real-number arithmetic cannot take the square root of a negative number. In that case, the roots are complex: x = (−b ± i√(−discriminant)) / (2a), where i is the imaginary unit.

Common Mistakes and How to Avoid Them

Even with a calculator, errors creep in from the input side. The most frequent issues are:

  • Forgetting to rearrange to standard form. If you enter coefficients from an equation like 3x + 2 = x², you must first subtract 3x and 2 from both sides to get −x² + 3x + 2 = 0, so a = −1, b = 3, c = 2.
  • Dropping negative signs. A coefficient of −5 is not the same as 5. The sign is part of the coefficient.
  • Misreading the discriminant. A negative discriminant does not mean “no solution” – it means two complex solutions. Many students stop at the square root of a negative number, but the quadratic formula still works in the complex number system.
  • Rounding too early. If you are doing the calculation by hand, keep several decimal places until the final answer. Rounding the discriminant or the square root prematurely can change the roots noticeably.

When to Use the Quadratic Formula

The quadratic formula is the most general method for solving quadratic equations. It works for every quadratic equation, including those that cannot be factored easily and those with irrational or complex roots. You might also use factoring or completing the square, but the formula is often the fastest and most reliable, especially when the coefficients are not simple integers.

Quadratic equations appear in physics (projectile motion), geometry (area problems), economics (profit maximization), and engineering (optimization). For example, the height h of an object thrown upward can be modeled as h = −4.9t² + v₀t + h₀ (in meters, with t in seconds), and solving for t when h = 0 gives the time the object hits the ground.

Limitations and Alternatives

The quadratic formula assumes a ≠ 0. If a = 0, the equation is linear, not quadratic, and the formula would involve division by zero. Also, the formula gives exact algebraic solutions, but for numerical work with very large or very small coefficients, you may encounter floating-point rounding errors. In such cases, a more numerically stable form is:

x₁ = (−b − sign(b)·√(b² − 4ac)) / (2a) and x₂ = c / (a·x₁).

If you only need approximate roots, graphing the function y = ax² + bx + c and finding the x-intercepts is a quick visual alternative. For higher-degree polynomials, the quadratic formula does not apply; you would need numerical methods or the cubic/quartic formulas.

Frequently Asked Questions

What if the discriminant is negative?

If b² − 4ac < 0, the equation has two complex conjugate roots. For example, x² + 2x + 5 = 0 has a = 1, b = 2, c = 5, discriminant = 4 − 20 = −16, so the roots are x = (−2 ± 4i)/2 = −1 ± 2i. This calculator only outputs real roots, so it will show an error. You can compute complex roots by taking the square root of the absolute value of the discriminant and adding the imaginary unit i.

Can I use the formula if a is negative?

Yes. The formula works for any nonzero a, including negative values. For example, −x² + 4x − 3 = 0 has a = −1, b = 4, c = −3. The discriminant is 16 − 12 = 4, and the roots are x = (−4 ± 2)/(−2), giving x = 1 and x = 3. Just be careful with the signs when entering negative coefficients.

How do I enter a coefficient that is a fraction?

You can enter a fraction as a decimal (e.g., 0.5) or as a division expression if the calculator supports it – but this calculator only accepts numbers, so convert fractions to decimals first. For example, (1/2)x² + (3/4)x − 2 = 0 becomes a = 0.5, b = 0.75, c = −2. The result will be approximate if the decimal is rounded.

Why does the calculator show “NaN” for some inputs?

“NaN” stands for “Not a Number” and appears when the discriminant is negative, because the square root of a negative number is not a real number. This is the calculator’s way of indicating complex roots. To get the complex roots, compute the real part (−b/(2a)) and the imaginary part (±√(−discriminant)/(2a)).

What is the difference between real and complex roots?

Real roots are numbers that lie on the number line (e.g., 2, −1.5, √3). Complex roots are of the form p + qi, where p and q are real numbers and i = √(−1). If the discriminant is positive, both roots are real; if it is zero, both roots are the same real number; if it is negative, the roots are complex conjugates – they have the same real part and opposite imaginary parts.

Can the quadratic formula solve equations with missing terms?

Yes. If an equation lacks an x term or a constant, enter 0 for that coefficient. For example, 3x² − 12 = 0 has b = 0. The formula still works: discriminant = 0 − 4·3·(−12) = 144, so x = ±√144/(6) = ±2. Similarly, 2x² + 5x = 0 has c = 0, giving roots x = 0 and x = −2.5.

Related

Formula used
in a | Coefficient a | - | 1 | 0
in b | Coefficient b | - | -3 | 0
in c | Coefficient c | - | 2 | 0
out x1 | First root | - | (-b + sqrt(b^2 - 4*a*c)) / (2*a) | 4
out x2 | Second root | - | (-b - sqrt(b^2 - 4*a*c)) / (2*a) | 4
out disc | Discriminant | - | b^2 - 4*a*c | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.