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

ax^2 + bx + c = 0

Step 1. Divide both sides by a.

x^2 + \frac{b}{a}\,x + \frac{c}{a} = 0

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.

x^2 + \frac{b}{a}\,x = -\frac{c}{a}

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.

x^2 + \frac{b}{a}\,x + \frac{b^2}{4a^2} = -\frac{c}{a} + \frac{b^2}{4a^2}

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.

\left(x + \frac{b}{2a}\right)^2 = \frac{b^2 - 4ac}{4a^2}

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.

x + \frac{b}{2a} = \pm\,\frac{\sqrt{b^2 - 4ac}}{2a}
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

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.

Five-step derivation of the quadratic formula shown as a flowchartFive rectangular boxes arranged vertically, connected by arrows. Each box contains one equation from the derivation. The first box contains the original equation ax squared plus bx plus c equals zero. Arrows labelled with the operation performed connect each step to the next. The final box at the bottom is highlighted in red and contains the quadratic formula. ax² + bx + c = 0 ÷ a x² + (b/a)x = −c/a + (b/2a)² x² + (b/a)x + b²/4a² = (b² − 4ac)/4a² recognise perfect square (x + b/2a)² = (b² − 4ac)/4a² √ both sides, isolate x x = (−b ± √(b² − 4ac)) / 2a
The five steps of the derivation, from the general equation to the formula. Each arrow names the single algebraic move that takes you from one line to the next. The derivation is completing the square, performed once and for all on letters so you never have to repeat it on numbers.

The quadratic formula

For any equation ax^2 + bx + c = 0 with a \neq 0:

x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

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:

  1. 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).
  2. Compute the discriminant D = b^2 - 4ac. This single number tells you what kind of roots to expect before you finish.
  3. 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.

Three parabolas showing the three cases of the discriminantThree small parabolas side by side on three separate axes. The left parabola crosses the horizontal axis at two distinct points, labelled D greater than zero with two real roots. The middle parabola touches the axis at exactly one point, labelled D equals zero with one repeated root. The right parabola floats above the axis without touching it, labelled D less than zero with no real roots. D > 0 two real roots D = 0 one repeated root D < 0 no real roots
The discriminant controls which picture you get. Positive: the parabola crosses the axis twice. Zero: it just grazes the axis at the vertex. Negative: the parabola hovers above (or below) the axis, never touching it. One number, three worlds.

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.

Interactive discriminant explorer for x squared minus 4x plus cAn interactive slider on a horizontal line from c equals 0 to c equals 8. A draggable red point controls the value of c. Above, readouts display c, the discriminant D equals 16 minus 4c, and the two roots of the equation. As the reader drags the point past c equals 4, the discriminant changes sign and the roots transition from real to complex. 0 2 4 6 8 ↔ drag to change c
Drag the red point along the line to change $c$. At $c = 4$, the discriminant $D = 0$ and the two roots merge into one ($x = 2$). For $c < 4$, $D > 0$ and the roots are real and distinct. For $c > 4$, $D < 0$ — the readouts show both roots collapsing to $x = 2$ because the formula shows only the real part.

Two worked examples

Example 1: Solve 2x² + 3x − 5 = 0

Step 1. Read off the coefficients.

a = 2, \quad b = 3, \quad c = -5

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.

D = b^2 - 4ac = 9 - 4(2)(-5) = 9 + 40 = 49

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.

x = \frac{-3 \pm \sqrt{49}}{2 \cdot 2} = \frac{-3 \pm 7}{4}

Step 4. Separate the two roots.

x_1 = \frac{-3 + 7}{4} = \frac{4}{4} = 1 \qquad x_2 = \frac{-3 - 7}{4} = \frac{-10}{4} = -\frac{5}{2}

Result. x = 1 or x = -\dfrac{5}{2}.

Parabola y equals 2x squared plus 3x minus 5 with roots at 1 and negative five halvesThe graph of y equals 2x squared plus 3x minus 5 plotted from x equals negative 4 to x equals 3. The parabola opens upward and crosses the horizontal axis at x equals negative 2.5 and x equals 1. The vertex is below the axis at the midpoint of the roots. Axis labels and tick marks are shown. x y −2 −1 1 2 3 −3 5 x = −⁵⁄₂ x = 1 vertex
The parabola $y = 2x^2 + 3x - 5$ crosses the axis at $x = -5/2$ and $x = 1$, exactly the two roots from the formula. The vertex sits below the axis at the midpoint of the roots, $x = -3/4$. Because $a = 2 > 0$, the parabola opens upward.

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.

a = 3, \quad b = -6, \quad c = 2

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.

D = (-6)^2 - 4(3)(2) = 36 - 24 = 12

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.

x = \frac{-(-6) \pm \sqrt{12}}{2 \cdot 3} = \frac{6 \pm 2\sqrt{3}}{6}

Step 4. Simplify. Factor a 2 from the numerator:

x = \frac{2(3 \pm \sqrt{3})}{6} = \frac{3 \pm \sqrt{3}}{3} = 1 \pm \frac{\sqrt{3}}{3} = 1 \pm \frac{1}{\sqrt{3}}

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}.

Parabola y equals 3x squared minus 6x plus 2 with irrational rootsThe graph of y equals 3x squared minus 6x plus 2 plotted from x equals negative 0.5 to x equals 2.5. The parabola opens upward and crosses the horizontal axis at approximately x equals 0.42 and x equals 1.58. The vertex is at x equals 1 comma y equals negative 1, one unit below the axis. The roots are marked with red dots. x y 2 4 6 0.5 1 1.5 vertex (1, −1) 1 − √3/3 1 + √3/3
The parabola $y = 3x^2 - 6x + 2$ barely dips below the axis. Its vertex is at $(1, -1)$, only one unit below — and the two roots sit symmetrically on either side, at $1 - \sqrt{3}/3$ and $1 + \sqrt{3}/3$. The irrational roots are genuine points on the axis, even though you cannot write them as simple fractions.

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.

Common confusions

A few conceptual traps beyond the mechanical errors.

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.