Arithmetic, Algebra & Number Theory Equations, Systems & Polynomials Quadratic formula (Babylonian completing-the-square identity)

Quadratic Equation Calculator (Quadratic Formula)

Enter the three coefficients of ax² + bx + c = 0 and this calculator returns both roots, the discriminant that decides whether those roots are real or complex, and the vertex of the matching parabola. It works for every case a textbook throws at you: two real roots, one repeated root, a complex conjugate pair, and the degenerate case where a = 0 and the equation is really linear. Every intermediate value is shown so you can check your own hand working line by line.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Coefficient a (of x²)The number multiplying x². Enter it with its sign; if it is 0 the equation is linear, not quadratic.2
Coefficient b (of x)The number multiplying x, including its sign. Enter 0 if there is no x term.-7
Constant cThe term with no x. Move everything to the left side first so the right side is 0.3

It returns

  • Root x₁ = (−b + √Δ) / 2a — Shown as a dash when the discriminant is negative — the roots are then complex.
  • Root x₂ = (−b − √Δ) / 2a
  • Nature of the roots — Decided entirely by the sign of the discriminant.
  • Discriminant Δ = b² − 4ac
  • Imaginary part (±) of each complex root — Zero whenever the roots are real.
  • Vertex x (axis of symmetry)
  • Vertex y (minimum or maximum value)

The formula

x=b±b24ac2a
Δ=b24ac
(b2a,cb24a)

In plain text: x = (−b ± √(b² − 4ac)) / (2a)

  • xThe unknown; a value that makes ax² + bx + c equal zero
  • aCoefficient of x². Must be non-zero for the equation to be quadratic
  • bCoefficient of x
  • cConstant term
  • ΔDiscriminant, b² − 4ac. Its sign decides the nature of the roots

The formula is completing the square carried out once in general, so it holds for every real a ≠ 0, b and c.

Updated Category Equations, Systems & Polynomials Verified against published test cases Reading time 13 min

What a quadratic equation is and why one formula covers all of them

A quadratic equation is any equation you can rearrange into the shape ax² + bx + c = 0 with a ≠ 0. The highest power of the unknown is two, and that single fact controls everything else: there are always exactly two roots when you count a repeated root twice and allow complex numbers, and the graph of y = ax² + bx + c is always a parabola.

The quadratic formula is not a separate trick to memorise alongside factoring and completing the square. It is completing the square, performed once on the general equation so that nobody ever has to perform it again. Start with ax² + bx + c = 0, divide by a, move the constant across, add (b/2a)² to both sides to make a perfect square, take the square root of both sides, and subtract b/2a. What drops out is x = (−b ± √(b² − 4ac)) / (2a). Because that derivation never assumed anything about the numbers except a ≠ 0, the result is valid for every quadratic that exists.

You reach for it constantly outside algebra class. Projectile height under constant gravity is quadratic in time, so finding when a ball lands means solving a quadratic. Break-even analysis with a linear price–demand curve gives quadratic revenue. Circuit resonance, kinematics, the intersection of a line and a circle, and least-squares fitting all reduce to the same three coefficients.

Reading the formula: what each part does

Split the formula into three pieces and each one has a clear job.

−b / 2a is the centre. On its own it is the axis of symmetry of the parabola and the x-coordinate of the vertex. Both roots sit the same distance either side of it, which is why the sum of the roots is always −b/a: the two offsets cancel.

√Δ / 2a is the half-distance between the roots. The larger the discriminant, the further apart the roots lie. When Δ = 0 the offset vanishes and the two roots collapse onto the vertex.

Δ = b² − 4ac is the decider. Its sign, not its size, tells you what kind of answer to expect before you compute anything:

  • Δ > 0 — two distinct real roots; the parabola cuts the x-axis twice.
  • Δ = 0 — one repeated real root; the parabola touches the axis and turns back.
  • Δ < 0 — no real root; the roots are a complex conjugate pair p ± qi, where p = −b/2a and q = √(−Δ)/|2a|.

Two further identities are worth carrying in your head because they check your arithmetic in seconds. The roots always satisfy x₁ + x₂ = −b/a and x₁ · x₂ = c/a. These are Vieta's formulas, and they follow from multiplying out a(xx₁)(xx₂) and matching coefficients. If your two answers do not add to −b/a, you have made a sign error somewhere.

The vertex y-value comes from the same rearrangement: y = cb²/4a. It is the minimum of the curve when a > 0 and the maximum when a < 0, because the sign of a decides which way the parabola opens.

Worked example: solving 2x² − 7x + 3 = 0 by hand

Take the calculator's default equation, 2x² − 7x + 3 = 0, so a = 2, b = −7 and c = 3.

  1. Compute the discriminant. Δ = (−7)² − 4(2)(3) = 49 − 24 = 25. It is positive, so expect two distinct real roots.
  2. Take its square root. √25 = 5. A perfect square here is a strong hint that the trinomial also factors over the integers.
  3. Build the denominator. 2a = 2 × 2 = 4.
  4. First root. x₁ = (−(−7) + 5) ÷ 4 = (7 + 5) ÷ 4 = 12 ÷ 4 = 3.
  5. Second root. x₂ = (7 − 5) ÷ 4 = 2 ÷ 4 = 0.5.
  6. Check with Vieta. Sum: 3 + 0.5 = 3.5, and −b/a = 7/2 = 3.5 ✓. Product: 3 × 0.5 = 1.5, and c/a = 3/2 = 1.5 ✓.
  7. Find the vertex. x = −b/2a = 7 ÷ 4 = 1.75. y = cb²/4a = 3 − 49/8 = 3 − 6.125 = −3.125.
  8. Write the factored form. 2(x − 3)(x − 0.5), which clears to (x − 3)(2x − 1).

Substituting back is the final proof: 2(3)² − 7(3) + 3 = 18 − 21 + 3 = 0 ✓, and 2(0.5)² − 7(0.5) + 3 = 0.5 − 3.5 + 3 = 0 ✓.

Now change one number to see the discriminant work. Make it 2x² − 7x + 7 = 0. Then Δ = 49 − 56 = −7, negative, so the roots are complex: real part 7/4 = 1.75, imaginary part √7/4 ≈ 0.661438, giving 1.75 ± 0.661438i. The vertex is unchanged in x but sits at y = 7 − 49/8 = 0.875, above the axis — which is exactly why the curve never crosses it.

How to read the result

Start with the discriminant, not the roots. If your problem is physical — a time, a length, a quantity of stock — a negative discriminant usually means the situation you described cannot happen, not that you should reach for complex numbers. A ball thrown at 10 m/s never reaches 20 m, and the algebra says so by giving you Δ < 0.

Then check whether both roots are admissible. A quadratic from a word problem routinely produces one root that is physically meaningless: negative time, negative length, a discount above 100%. Solving the equation is not the same as answering the question, and marks are lost far more often at this step than in the arithmetic.

A perfect-square discriminant (0, 1, 4, 9, 16, 25, 36, 49 …) tells you the roots are rational, and therefore that the trinomial factors over the integers if a, b and c are integers. That is exactly the test the factoring trinomials calculator applies, and it is why 25 in the worked example above signalled a clean factorisation.

Finally, use the vertex to sanity-check the roots. The vertex x-value must lie exactly halfway between them. If it does not, one of your roots is wrong. And the sign of the vertex y-value must agree with the discriminant: with a > 0, a negative vertex y means the curve dips below the axis and two real roots exist.

Reference: discriminant, roots and graph for common cases

Every value below is the quadratic formula evaluated by hand; substitute the roots back to verify.
EquationΔ = b² − 4acRootsVertexGraph
x² − 3x − 4 = 0254 and −1(1.5, −6.25)Cuts the axis twice
2x² − 7x + 3 = 0253 and 0.5(1.75, −3.125)Cuts the axis twice
x² − 2x + 1 = 001 (repeated)(1, 0)Touches the axis
4x² + 12x + 9 = 00−1.5 (repeated)(−1.5, 0)Touches the axis
x² + 2x + 5 = 0−16−1 ± 2i(−1, 4)Never meets the axis
x² + 1 = 0−4±i(0, 1)Never meets the axis
−x² + 4x − 3 = 041 and 3(2, 1)Opens downward, cuts twice
x² − 2 = 08±√2 ≈ ±1.414214(0, −2)Cuts the axis twice, irrational roots

Rows with a perfect-square discriminant have rational roots and factor over the integers; the √2 row does not.

The formula fails silently when a = 0

Dividing by 2a is only legal when a ≠ 0. If you enter a = 0 this calculator does not divide by zero — it detects the degenerate case and solves the linear equation bx + c = 0 instead, reporting the single root x = −c/b and no vertex. Spreadsheets and hand-rolled code frequently do not, and return #DIV/0! or Infinity. If both a and b are zero the equation has no unknown left in it at all: it is either an identity (when c = 0) or a contradiction. The linear equation solver handles that whole family properly.

Mistakes that produce a wrong root

  • Not rearranging to = 0 first. The formula reads coefficients off ax² + bx + c = 0. For 3x² = 5x − 2 you must first write 3x² − 5x + 2 = 0, so c = +2, not −2.
  • Losing the sign of b. In x² − 3x − 4, b = −3, so −b = +3 and b² = +9. Squaring kills the sign; negating keeps it. Both appear in the formula, and mixing them up is the single most common error.
  • Dividing only one term by 2a. The whole numerator, −b and ±√Δ together, sits over 2a. Writing −b ± √Δ/2a without brackets loses the first term's division.
  • Reporting √Δ when Δ is negative. √(−16) is not −4. It is 4i, and the two roots become a conjugate pair.
  • Rounding the discriminant before taking the root. With decimal coefficients, rounding Δ from 0.0004 to 0 turns two close roots into one repeated root.
  • Keeping a root the problem forbids. Negative times, negative lengths and negative counts are still solutions of the equation but not answers to the question.
  • Assuming a negative discriminant means you made a mistake. Complex roots are correct answers in circuit analysis, control theory and signal processing; only the physical context decides whether to discard them.

When to use a different method

The quadratic formula always works, but it is not always the fastest route.

Factoring beats it whenever the coefficients are small integers and the discriminant is a perfect square: x² − 5x + 6 = 0 gives up its roots 2 and 3 faster by inspection than by formula. Use the factoring calculator to check whether an integer factorisation exists at all.

Completing the square is slower for finding roots but is the method that hands you the vertex form y = a(xh)² + k directly, which is what you want for graphing, for optimisation, and for integration substitutions later. The completing the square calculator shows that route step by step.

The square-root method handles the special case b = 0 in one line: ax² + c = 0 gives x = ±√(−c/a). Reaching for the full formula here wastes time. The square root calculator covers the arithmetic and the radical simplifier puts an irrational answer into exact surd form rather than a decimal.

For higher degrees the picture changes. Cubics have a general formula, but it is unpleasant enough that the cubic equation solver is the practical route; quartics have one that is worse still; and Abel and Ruffini proved in the early nineteenth century that no formula in radicals exists for the general quintic. Above degree two, numerical root-finding is the norm. If you need to reduce a higher-degree polynomial once you know one root, polynomial long division is the tool that peels it off.

A historical note that is more than trivia: Babylonian scribes were solving problems equivalent to quadratics around 1800 BCE by a procedure that is completing the square in words, and Brahmagupta stated an explicit rule including negative quantities in 628 CE. The formula you use today is a compressed record of that work.

Key terms

Root (or zero)
A value of x that makes the expression equal zero. Graphically, an x-intercept of y = ax² + bx + c.
Discriminant
The quantity b² − 4ac under the square root. Its sign determines whether the roots are two real, one repeated real, or a complex conjugate pair.
Vertex
The turning point of the parabola, at x = −b/2a. It is the minimum when a > 0 and the maximum when a < 0.
Axis of symmetry
The vertical line x = −b/2a about which the parabola is mirror-symmetric. Both roots lie the same distance from it.
Vieta's formulas
For a quadratic, x₁ + x₂ = −b/a and x₁·x₂ = c/a. A fast check on any pair of roots.
Complex conjugate pair
Two roots of the form p + qi and pqi. Real coefficients force complex roots to come in such pairs.

Frequently asked questions

What does the discriminant tell me?

Its sign tells you what kind of roots to expect before you do any more arithmetic. Positive means two distinct real roots and a parabola that cuts the x-axis twice; zero means one repeated real root and a parabola that just touches the axis; negative means no real root and a complex conjugate pair. If the coefficients are integers and the discriminant is a perfect square, the roots are rational and the trinomial factors over the integers.

Why does my calculator show a dash for the roots?

Because the discriminant is negative, so no real number solves the equation. The two roots exist, but they are complex. Read them off the Vertex x output, which is the real part of each root, and the Imaginary part output: the roots are that pair, one with a plus and one with a minus. For example, with a = 1, b = 2 and c = 5 the roots are −1 + 2i and −1 − 2i.

Can a quadratic have only one solution?

It has one distinct solution when the discriminant is exactly zero, but mathematicians still count it as two roots that happen to be equal — a root of multiplicity two. That convention keeps the fundamental theorem of algebra tidy, and it matters in practice: the factored form is a(x − r)², with the bracket squared, not a single bracket. Graphically the curve touches the x-axis at its vertex instead of crossing.

How do I solve a quadratic that is not written in standard form?

Move every term to one side so the other side is zero, then read off the coefficients. For 3x² = 5x − 2, subtract 5x and add 2 to get 3x² − 5x + 2 = 0, so a = 3, b = −5, c = 2. For (x + 1)(x − 4) = 6, expand first to x² − 3x − 4 = 6, then subtract 6 to reach x² − 3x − 10 = 0. Never read coefficients off an equation whose right side is not zero.

Is the quadratic formula the same as completing the square?

Yes — the formula is what you get by completing the square on the general equation ax² + bx + c = 0 once, symbolically. Every step of that derivation is reversible, so the two methods can never disagree. Completing the square is still worth doing by hand when you want the vertex form a(x − h)² + k, because it produces h and k directly rather than as a by-product.

What if a is zero?

Then there is no x² term and the equation is linear, not quadratic. The formula itself breaks down because it divides by 2a. This calculator detects the case and solves bx + c = 0 instead, giving the single root x = −c/b and leaving the vertex blank. If b is also zero, there is no unknown left: the equation is an identity when c = 0 and has no solution otherwise.

How do I check my answer quickly?

Use Vieta's formulas. The two roots must add to −b/a and multiply to c/a. For 2x² − 7x + 3 = 0 the roots 3 and 0.5 add to 3.5 = 7/2 and multiply to 1.5 = 3/2, both correct. This catches sign errors in a couple of seconds, which substituting one root back does not always do. Substitution remains the definitive check when Vieta passes but you still doubt the arithmetic.

Why do the roots I get differ slightly from a textbook's decimals?

Usually rounding. This calculator carries full double precision and displays six decimals, while textbooks often round to two or three. A more subtle cause is cancellation: when b² is enormously larger than 4ac, the subtraction −b + √Δ removes nearly all the significant digits of the smaller root. The algebraically identical form x = 2c / (−b ∓ √Δ) avoids that loss, and the calculator warns you when your coefficients enter that regime.

Do complex roots ever mean something physical?

Frequently. In an RLC circuit, complex roots of the characteristic quadratic mean the response oscillates as it decays rather than settling smoothly; the imaginary part is the ringing frequency and the real part is the decay rate. In a projectile problem, by contrast, complex roots mean the object never reaches the height you asked about. The mathematics is identical; only the model decides whether to keep the answer.

References

  • College Algebra (OpenStax), Chapter 2: Quadratic EquationsOpenStax, Rice University
  • Accuracy and Stability of Numerical Algorithms, 2nd ed. (cancellation in the quadratic formula) — SIAM (Nicholas J. Higham)
  • A History of Mathematics, 3rd ed. (Babylonian and Brahmagupta solutions of quadratics) — Wiley (Boyer & Merzbach)