In short
For any quadratic equation ax^2 + bx + c = 0 with a \neq 0, the two solutions are x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}. This formula is derived by completing the square on the general equation, works for every quadratic without exception, and contains a single number — the discriminant D = b^2 - 4ac — that decides whether the roots are real and distinct, real and equal, or complex.
Solve 3x^2 + 7x - 2 = 0. Try to factor it — 3 and -2 do not produce any integer pair that adds to 7. You could complete the square, but the fractions will be different from the last problem, and different again from the next one. Every quadratic requires its own custom algebra.
Unless you do the algebra once with letters. Complete the square on the general equation ax^2 + bx + c = 0, and you get a single formula that solves every quadratic equation ever written. Plug in a = 3, b = 7, c = -2, and out come both answers. No guessing, no case-by-case work — just substitution. That formula is the subject of this article.
Deriving the formula
The derivation is completing the square on the general equation. Five steps, each fully shown.
Start with
Step 1. Divide both sides by a.
Why: completing the square needs the coefficient of x^2 to be 1. Dividing by a achieves that. This is safe because a \neq 0 (otherwise the equation is linear, not quadratic).
Step 2. Move the constant term to the right side.
Why: the left side now has only x^2 and x terms — the two pieces that will form the perfect square. The constant goes to the right to stay out of the way.
Step 3. Add \left(\dfrac{b}{2a}\right)^2 to both sides.
Why: this is the completing-the-square move. The coefficient of x is b/a. Half of that is b/(2a). Squaring gives b^2/(4a^2). Adding this to both sides creates a perfect square on the left without changing the equation. The geometric picture from Quadratic Equations — Introduction — the missing corner of the square — is exactly this b^2/(4a^2).
Step 4. Recognise the left side as a perfect square and simplify the right.
Why: the left side matches the pattern x^2 + 2px + p^2 = (x + p)^2 with p = b/(2a). On the right, write -c/a as -4ac/(4a^2) to get a common denominator with b^2/(4a^2), then combine: \bigl(b^2 - 4ac\bigr)/(4a^2). The numerator b^2 - 4ac is the number that will control everything.
Step 5. Take the square root of both sides, then isolate x.
Why: a square root always allows both the positive and negative value — that \pm is the reason quadratics have two solutions instead of one. Subtracting b/(2a) from both sides isolates x, and combining over the common denominator 2a gives the formula in its standard single-fraction form.
The quadratic formula
For any equation ax^2 + bx + c = 0 with a \neq 0:
The two solutions are obtained by taking the + sign and the - sign separately.
Indian mathematicians had a recognisable form of this result by the 7th century — Brahmagupta stated rules equivalent to the formula in the Brahmasphutasiddhanta, covering both positive and negative values of the discriminant. The method of completing the square itself is older still.
Using the formula
The formula is a machine: feed it a, b, c, and it produces the two roots. The only skill involved is careful substitution — especially with negative signs.
Here is the procedure, compressed into three clean steps:
- Read off a, b, c. Compare your equation with ax^2 + bx + c = 0. Get the signs right — if the equation is x^2 - 7x + 10 = 0, then b = -7 (not 7).
- Compute the discriminant D = b^2 - 4ac. This single number tells you what kind of roots to expect before you finish.
- Plug into the formula. x = \dfrac{-b \pm \sqrt{D}}{2a}. Write out both roots.
The discriminant deserves its own moment. Before you touch the \pm and the division, compute D first and look at its sign.
Nature of roots — a preview
The quantity D = b^2 - 4ac is called the discriminant because it discriminates between three fundamentally different outcomes.
| Value of D | What the roots look like | Geometrically |
|---|---|---|
| D > 0 | Two distinct real roots | The parabola cuts the axis at two points |
| D = 0 | One repeated real root (x = -b/2a) | The parabola just touches the axis at its vertex |
| D < 0 | Two complex conjugate roots | The parabola sits entirely above or below the axis |
If D is a perfect square (like D = 49), the roots are rational. If D is positive but not a perfect square (like D = 12), the roots involve an irrational square root. If D is zero, the \pm contributes nothing and the two roots collapse into one. If D is negative, \sqrt{D} is not a real number and the roots are complex — you'll meet them properly in complex numbers.
Computing D first is valuable for two reasons. It tells you how many real answers to expect, so you can spot mistakes early — if D = 0 but you somehow got two different roots, something went wrong. And it tells you what form the answer will take — rational, irrational, or complex — before you do the final arithmetic.
An interactive discriminant explorer
Drag the point below to vary the value of c in the equation x^2 - 4x + c = 0. The readouts show c, the discriminant D = 16 - 4c, and the two roots. Watch the roots merge when D = 0 and become complex when D goes negative.
Two worked examples
Example 1: Solve 2x² + 3x − 5 = 0
Step 1. Read off the coefficients.
Why: comparing 2x^2 + 3x - 5 = 0 with ax^2 + bx + c = 0, the leading coefficient is 2, the middle coefficient is 3, and the constant is -5. The sign on c is negative — get this right, because it enters the discriminant as -4ac = -4(2)(-5) = +40.
Step 2. Compute the discriminant.
Why: D = 49 > 0, and 49 is a perfect square (7^2), so the roots will be rational numbers. Good — you can expect clean fractions.
Step 3. Apply the formula.
Step 4. Separate the two roots.
Result. x = 1 or x = -\dfrac{5}{2}.
Quick check via Vieta's formulas: the sum of the roots should be -b/a = -3/2. Indeed 1 + (-5/2) = -3/2. The product should be c/a = -5/2. Indeed 1 \times (-5/2) = -5/2. Both match.
Example 2: Solve 3x² − 6x + 2 = 0
Step 1. Read off the coefficients.
Why: the middle coefficient is -6, not 6. Writing -b in the formula will give -(-6) = 6, which is positive. Getting this sign right is the most common point of failure.
Step 2. Compute the discriminant.
Why: D = 12 > 0, so two real roots are coming. But 12 is not a perfect square, so the roots will involve \sqrt{12} = 2\sqrt{3} — irrational numbers.
Step 3. Apply the formula.
Step 4. Simplify. Factor a 2 from the numerator:
The two roots are x_1 = 1 + \dfrac{\sqrt{3}}{3} \approx 1.577 and x_2 = 1 - \dfrac{\sqrt{3}}{3} \approx 0.423.
Result. x = \dfrac{3 + \sqrt{3}}{3} or x = \dfrac{3 - \sqrt{3}}{3}.
Quick check: sum of roots = (3 + \sqrt{3})/3 + (3 - \sqrt{3})/3 = 6/3 = 2. Should equal -b/a = 6/3 = 2. Correct. Product = [(3 + \sqrt{3})(3 - \sqrt{3})]/9 = (9 - 3)/9 = 6/9 = 2/3. Should equal c/a = 2/3. Correct.
Common errors with the formula
The formula itself is simple; the mistakes are in the substitution. Here are the ones that appear most often.
-
"b = 6 when the equation is x^2 - 6x + 5 = 0." No, b = -6. The sign is part of the coefficient. When you write -b in the formula, you get -(-6) = 6, which is positive. If you started with b = 6, you would get -b = -6, flipping the sign of your answer.
-
"The formula is x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2}." The denominator is 2a, not 2. When a \neq 1, this error changes both roots. It is the second most common mistake after the sign error on b.
-
"\sqrt{b^2 - 4ac} = b - 2\sqrt{ac}." The square root does not distribute over subtraction. \sqrt{A - B} \neq \sqrt{A} - \sqrt{B} in general. The square root applies to the entire expression b^2 - 4ac as a single block.
-
"The \pm gives two formulas, so there are always two different answers." Not when D = 0. In that case \pm\sqrt{0} = 0, and both "roots" are the same value -b/(2a). The formula still works — it just gives a repeated root.
-
"I computed D < 0, so the equation has no solutions." It has no real solutions. It still has two complex solutions, x = (-b \pm i\sqrt{|D|})/(2a). Whether this matters depends on whether you are working in \mathbb{R} or \mathbb{C}.
Common confusions
A few conceptual traps beyond the mechanical errors.
-
"Completing the square and the quadratic formula are two different methods." They are the same method. The quadratic formula is completing the square, done once in general. Every time you use the formula, you are implicitly running the five-step derivation with your specific a, b, c.
-
"The quadratic formula replaces factoring." It can, but factoring is often faster when it works. If you see x^2 - 7x + 12 = 0, you can spot (x - 3)(x - 4) in seconds; computing D = 49 - 48 = 1, then x = (7 \pm 1)/2, takes longer. The formula is the fallback when factoring fails, not a replacement for it.
-
"The vertex of the parabola is at x = -b/(2a) by coincidence." It is not a coincidence. The vertex is where the parabola turns around, which is the midpoint of the two roots. The midpoint of \dfrac{-b + \sqrt{D}}{2a} and \dfrac{-b - \sqrt{D}}{2a} is \dfrac{-b}{2a}. The \pm\sqrt{D} parts cancel, leaving only -b/(2a). The vertex formula is built into the quadratic formula.
-
"The discriminant only matters for deciding the type of roots." It also tells you about the geometry of the parabola. When D > 0, the distance between the two roots is \sqrt{D}/|a| — so a larger discriminant means the roots are farther apart and the parabola dips deeper below the axis (if a > 0). When D < 0, the magnitude of D tells you how far above the axis the vertex sits.
Going deeper
If you came here to learn the quadratic formula, its derivation, and how to apply it, you have it — you can stop here. The rest of this section is for readers who want to see the formula from the perspective of the general theory.
Why the derivation works geometrically
The five algebraic steps of the derivation have a clean geometric interpretation. The original equation ax^2 + bx + c = 0 asks where a parabola crosses the x-axis. Dividing by a scales the parabola vertically so it has leading coefficient 1. Moving the constant shifts the picture so you are solving x^2 + (b/a)x = -c/a — asking where the simpler parabola y = x^2 + (b/a)x meets the line y = -c/a. Completing the square rewrites the left side as (x + b/(2a))^2 - (b/(2a))^2 — which is the vertex form of the parabola, placing the vertex at x = -b/(2a) and y = -(b^2 - 4ac)/(4a). The formula then reads off the two x-values where this parabola meets the axis.
Every step that feels like symbol-pushing has a picture behind it. The algebra and the geometry are saying the same thing in different languages.
The formula in different civilisations
The quadratic formula has been independently discovered multiple times across human history. Brahmagupta's 7th-century treatment in India handled both signs of the discriminant and both signs of the roots — a significant advance over earlier formulations that only considered positive roots. The method of completing the square itself appears in the work of al-Khwarizmi in 9th-century Baghdad, where "algebra" gets its name (al-jabr, meaning "restoration" or "completion"). The formula as a single closed-form expression was standardised in European mathematics by the 16th century, but the essential ideas were older by many centuries and spread across multiple civilisations.
From quadratic to cubic
The quadratic formula is the simplest instance of a general question: given a polynomial equation of degree n, can you write a formula for the roots in terms of the coefficients using only arithmetic and radicals (\sqrt{\ }, \sqrt[3]{\ }, etc.)? For n = 2, the answer is yes — that is the formula on this page. For n = 3 and n = 4, the answer is also yes, though the formulas are far more complicated. For n = 5 and beyond, the answer is provably no — there is no such formula, as proved by Abel and Galois in the early 19th century.
The quadratic formula sits at the beginning of one of the deepest stories in mathematics: the question of what algebra can and cannot do.
Where this leads next
The quadratic formula opens several doors.
- Discriminant and Nature of Roots — a full treatment of D = b^2 - 4ac and what it implies, with all three cases worked out.
- Sum and Product of Roots — Vieta's formulas in detail, derived from the quadratic formula and applied to symmetric functions.
- Completing the Square — the method behind the formula, treated as a technique in its own right for vertex form, integration, and more.
- Quadratic Equations — Introduction — the foundational article on what quadratics are and why they matter.
- Polynomial Factorization — how the quadratic formula connects to factoring polynomials of higher degree.