The Quadratic Formula and the Discriminant

Learning goals

  • Use the quadratic formula to solve a quadratic equation, identifying aa, bb, and cc
  • Predict the number of real roots a quadratic has from Δ=b2−4ac\Delta = b^2 - 4ac
  • Test whether a quadratic with integer coefficients factors over the rationals, using whether Δ\Delta is a perfect square

From completing the square to a formula

Take the destination on faith for one example before deriving it. For any ax2+bx+c=0ax^2 + bx + c = 0 with a≠0a \ne 0 and b2−4ac≥0b^2 - 4ac \ge 0, so that a real solution exists, the solutions turn out to be x=−b±b2−4ac2ax = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}. For x2+3x−4=0x^2 + 3x - 4 = 0, that means a=1a = 1, b=3b = 3, c=−4c = -4, so

x=−3±32−4(1)(−4)2(1)=−3±252=−3±52,x = \frac{-3 \pm \sqrt{3^2 - 4(1)(-4)}}{2(1)} = \frac{-3 \pm \sqrt{25}}{2} = \frac{-3 \pm 5}{2},

giving x=1x = 1 or x=−4x = -4. Check either one in the original equation and it holds. That is the whole workflow: identify aa, bb, cc, substitute, simplify. What is not yet clear is why this always works whenever a real solution exists, and what the formula tells you on the quadratics where one does not. That is what the derivation below proves, once and for all.

Everything rests on one derivation, so watch every step. We start from the general quadratic equation and complete the square on it exactly as the previous lesson taught, the only difference being that the coefficients are letters.

The quadratic formula, derived by completing the square#

Begin with ax2+bx+c=0ax^2 + bx + c = 0, where a≠0a \ne 0 so the equation is genuinely quadratic.

Divide through by aa, which is legal precisely because a≠0a \ne 0, to make the leading coefficient 11:

x2+ba x+ca=0.x^2 + \frac{b}{a}\,x + \frac{c}{a} = 0.

Move the constant to the right, then complete the square on the left. Half of the coefficient ba\tfrac{b}{a} is b2a\tfrac{b}{2a}, and its square is b24a2\tfrac{b^2}{4a^2}, so add that to both sides:

x2+ba x+b24a2=−ca+b24a2.x^2 + \frac{b}{a}\,x + \frac{b^2}{4a^2} = -\frac{c}{a} + \frac{b^2}{4a^2}.

The left side is now a perfect square by construction. Combine the right side over the common denominator 4a24a^2, writing ca=4ac4a2\tfrac{c}{a} = \tfrac{4ac}{4a^2}:

(x+b2a)2=b2−4ac4a2.\left(x + \frac{b}{2a}\right)^2 = \frac{b^2 - 4ac}{4a^2}.

This one line already holds the whole story, but push on to the formula. Multiply both sides by 4a24a^2, which clears every denominator at once: the left side becomes (2ax+b)2(2ax + b)^2, because 4a2(x+b2a)2=(2a(x+b2a))2=(2ax+b)24a^2\left(x + \tfrac{b}{2a}\right)^2 = \left(2a\left(x + \tfrac{b}{2a}\right)\right)^2 = (2ax + b)^2.

(2ax+b)2=b2−4ac.(2ax + b)^2 = b^2 - 4ac.

Now take square roots of both sides. This step needs b2−4ac≥0b^2 - 4ac \ge 0, because a real square root of a negative number does not exist; the previous lesson fixed the rule that k\sqrt{k} names the non-negative root, so undoing a square needs a ±\pm to recover both possibilities:

2ax+b=±b2−4ac.2ax + b = \pm\sqrt{b^2 - 4ac}.

Finally subtract bb and divide by 2a2a:

x=−b±b2−4ac2a.x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}.

That is the quadratic formula, and it carried its one hypothesis along the whole way: it needs b2−4ac≥0b^2 - 4ac \ge 0. If b2−4ac<0b^2 - 4ac < 0, the squared quantity (2ax+b)2(2ax+b)^2 would have to equal a negative number, which no real square ever does, so the equation has no real solution at all. Hold that thought; it becomes the whole next half of the lesson.

The formula deserves its place because of what the derivation just proved. It is not a pattern that happens to work on the examples in a textbook. It is the exact result of completing the square on every quadratic at once, so it inherits that guarantee for any a≠0a \ne 0.

 x=−b±b2−4ac2a \boxed{\,x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}\,}

The roots straddle the axis of symmetry

This section is about the case b2−4ac>0b^2 - 4ac > 0, where there are two distinct real roots. (If b2−4ac=0b^2 - 4ac = 0 there is only one root, sitting on the axis itself, so nothing straddles anything; if b2−4ac<0b^2 - 4ac < 0 there is no real root to place on the graph at all. Both of those cases get their own treatment soon.) Read the formula slowly, because it is telling you something the first lesson of this chapter promised. Split it into its two pieces:

x=−b2a⏟the axis  ±  b2−4ac2a⏟the offset.x = \underbrace{-\frac{b}{2a}}_{\text{the axis}} \;\pm\; \underbrace{\frac{\sqrt{b^2 - 4ac}}{2a}}_{\text{the offset}}.

The first piece, −b2a-\tfrac{b}{2a}, is exactly the axis of symmetry that Quadratic Functions and Parabolas dug out of ax2+bx+cax^2 + bx + c using symmetry alone. The second piece is a single signed offset added on one side and subtracted on the other. So the formula says the two roots sit the same distance to either side of the line x=−b2ax = -\tfrac{b}{2a}, one to its left and one to its right. That common distance is the magnitude b2−4ac2∣a∣\tfrac{\sqrt{b^2 - 4ac}}{2\lvert a\rvert}. The roots are a mirror pair about the axis, the same fact the parabola showed you before any algebra. The two xx-intercepts are reflections of each other, so their midpoint lands on the axis. The graph knew where the roots were, up to that one offset, and the formula supplies it as ±b2−4ac2a\pm\tfrac{\sqrt{b^2 - 4ac}}{2a}.

This also explains, with no extra work, why the roots average to −b2a-\tfrac{b}{2a}. Add the two values from the formula and the ±\pm pieces cancel:

−b+b2−4ac2a+−b−b2−4ac2a=−2b2a=−ba,\frac{-b + \sqrt{b^2 - 4ac}}{2a} + \frac{-b - \sqrt{b^2 - 4ac}}{2a} = \frac{-2b}{2a} = -\frac{b}{a},

so their average is −b2a-\tfrac{b}{2a}, the axis, precisely as symmetry demanded.

Worked example 1 A quadratic that does not factor nicely

Solve x2−6x+7=0x^2 - 6x + 7 = 0.

Try factoring first, honestly. You want two integers with product 77 and sum −6-6; the only integer pairs multiplying to 77 are 1,71, 7 and −1,−7-1, -7, summing to 88 and −8-8, never −6-6. The integer search fails, so reach for the formula. Here a=1a = 1, b=−6b = -6, c=7c = 7:

x=−(−6)±(−6)2−4(1)(7)2(1)=6±36−282=6±82.x = \frac{-(-6) \pm \sqrt{(-6)^2 - 4(1)(7)}}{2(1)} = \frac{6 \pm \sqrt{36 - 28}}{2} = \frac{6 \pm \sqrt{8}}{2}.

Simplify the radical: 8=4⋅2=22\sqrt{8} = \sqrt{4 \cdot 2} = 2\sqrt{2}, so

x=6±222=3±2.x = \frac{6 \pm 2\sqrt{2}}{2} = 3 \pm \sqrt{2}.

The two roots are 3+2≈4.413 + \sqrt{2} \approx 4.41 and 3−2≈1.593 - \sqrt{2} \approx 1.59. Notice they straddle x=3x = 3, which is the axis −b2a=62=3-\tfrac{b}{2a} = \tfrac{6}{2} = 3, each a distance 2\sqrt{2} away. The integer search never had a chance, because the answers are irrational, but the formula found them without breaking stride.

Check your understanding

Solve 2x2+4x−1=02x^2 + 4x - 1 = 0 with the quadratic formula.

Answer choices

The discriminant and the vertex height

The quantity under the square root did all the deciding in the derivation, so it earns a name. The discriminant of ax2+bx+cax^2 + bx + c is

Δ=b2−4ac.\Delta = b^2 - 4ac.

The Greek letter Δ\Delta (capital delta) is standard for it. Everything interesting about the number of real roots is packed into the sign of Δ\Delta, and the reason is not a coincidence of algebra. The vertex sits at x=−b2ax = -\tfrac{b}{2a}, a fact the first lesson of this chapter already found; its height, the yy-coordinate, turns out to be a fixed multiple of Δ\Delta, once aa is fixed too.

The vertex height is −Δ4a-\dfrac{\Delta}{4a}#

The first lesson of this chapter located the vertex of f(x)=ax2+bx+cf(x) = ax^2 + bx + c at x=−b2ax = -\tfrac{b}{2a}. Evaluate ff there to find its height:

f ⁣(−b2a)=a(b24a2)+b(−b2a)+c=b24a−b22a+c.f\!\left(-\frac{b}{2a}\right) = a\left(\frac{b^2}{4a^2}\right) + b\left(-\frac{b}{2a}\right) + c = \frac{b^2}{4a} - \frac{b^2}{2a} + c.

Put the first two terms over 4a4a, using b22a=2b24a\tfrac{b^2}{2a} = \tfrac{2b^2}{4a}, and combine everything over 4a4a:

f ⁣(−b2a)=b2−2b24a+c=−b2+4ac4a=−b2−4ac4a=−Δ4a.f\!\left(-\frac{b}{2a}\right) = \frac{b^2 - 2b^2}{4a} + c = \frac{-b^2 + 4ac}{4a} = -\frac{b^2 - 4ac}{4a} = -\frac{\Delta}{4a}.

So the yy-coordinate of the vertex is exactly −Δ4a-\tfrac{\Delta}{4a}.

This little identity turns the sign of Δ\Delta into a statement about the picture, once you also know the sign of aa. Take a parabola that opens upward, so a>0a > 0. Then −Δ4a-\tfrac{\Delta}{4a} has the opposite sign to Δ\Delta: when Δ>0\Delta > 0 the vertex sits below the xx-axis, so the upward arms must cross the axis twice. When Δ=0\Delta = 0 the vertex sits on the axis, so the parabola just touches it. When Δ<0\Delta < 0 the vertex sits above the axis, so the whole upward parabola floats clear of it and never meets it. For a parabola that opens downward, a<0a < 0, every “above” and “below” swaps: the same positive Δ\Delta now puts the vertex above the axis instead of below it, because flipping the sign of aa flips the sign of −Δ4a-\tfrac{\Delta}{4a} too. What never changes is whether the axis gets crossed, which is why the root-count table below depends on Δ\Delta alone, with no mention of aa‘s sign at all.

The three sign cases of the discriminant as three vertex heightsThree upward parabolas of identical shape. Delta greater than zero has its vertex below the x-axis and two crossings; delta equal to zero has its vertex on the axis and one touch; delta less than zero has its vertex above the axis and no crossing.Δ > 0two real rootsΔ = 0one real rootΔ < 0no real roots
One parabola shape, slid up and down. The only thing that changes across the three panels is the height of the vertex, which the identity vertex y = minus delta over 4a ties directly to the sign of the discriminant. A vertex below the axis (delta positive) forces two crossings, a vertex on the axis (delta zero) gives one, and a vertex above the axis (delta negative) gives none.

Three signs, three outcomes, proved both ways

The picture makes the three cases believable. The completed-square line from the derivation makes them certain, and it even runs backward: each root count comes from exactly one sign of Δ\Delta, never two. This is the most careful passage in the lesson, so read the logic, not just the conclusions.

The discriminant counts the real roots#

Return to the line the derivation reached before any square roots:

(x+b2a)2=Δ4a2.\left(x + \frac{b}{2a}\right)^2 = \frac{\Delta}{4a^2}.

The denominator 4a24a^2 is positive, since a≠0a \ne 0, so the right side has the same sign as Δ\Delta. A real number xx solves the equation exactly when the left side, a real square, can equal the right side. Every real number Δ\Delta is positive, zero, or negative, and nothing else, so those are the only three cases to check.

If Δ>0\Delta > 0, the right side is a positive number, and a positive number has two distinct real square roots, so x+b2a=±Δ2ax + \tfrac{b}{2a} = \pm\tfrac{\sqrt{\Delta}}{2a} gives two distinct values of xx.

If Δ=0\Delta = 0, the right side is 00, so the equation is (x+b2a)2=0\left(x + \tfrac{b}{2a}\right)^2 = 0, which holds only for x=−b2ax = -\tfrac{b}{2a}, and holds there: one root, sitting on the axis where the parabola is tangent to it.

If Δ<0\Delta < 0, the right side is negative, but the left side is a square and no real square is negative, so no real xx works.

Now run it backward, which is the point people skip. The three signs of Δ\Delta cover every possibility with none left over, and the three outcomes, two roots, one root, no roots, can never overlap. So each outcome could only have come from its one matching sign: two distinct real roots only from Δ>0\Delta > 0, since the other two signs give exactly one root or none, and likewise for the other two cases. Each statement in the table below is therefore an “if and only if”, not just an “if”.

Sign of Δ\DeltaUnder the square rootReal rootsParabola and the xx-axis
Δ>0\Delta > 0positive radicand; ±\pm gives two valuestwo distinctcrosses it twice
Δ=0\Delta = 0zero; ±\pm gives one valueexactly one (a double root)tangent to it
Δ<0\Delta < 0negative; no real square root existsnonenever meets it

This holds for every real a≠0a \ne 0, bb, cc, with no hypothesis about the coefficients being whole or rational. The number of real roots is a question the discriminant answers completely. In Chapter 5 the number system itself is enlarged so that the Δ<0\Delta < 0 row, too, acquires roots; for now, “no real roots” is the full and honest answer.

Worked example 2 Counting roots without solving

For each equation, use only the discriminant to say how many real solutions it has.

For 2x2−5x+1=02x^2 - 5x + 1 = 0: here a=2a = 2, b=−5b = -5, c=1c = 1, so

Δ=(−5)2−4(2)(1)=25−8=17>0,\Delta = (-5)^2 - 4(2)(1) = 25 - 8 = 17 > 0,

which means two distinct real roots.

For x2−4x+4=0x^2 - 4x + 4 = 0: Δ=(−4)2−4(1)(4)=16−16=0\Delta = (-4)^2 - 4(1)(4) = 16 - 16 = 0, so exactly one real root. Indeed the left side is (x−2)2(x - 2)^2, with the double root x=2x = 2.

For x2+x+1=0x^2 + x + 1 = 0: Δ=12−4(1)(1)=1−4=−3<0\Delta = 1^2 - 4(1)(1) = 1 - 4 = -3 < 0, so no real roots. This is the very quadratic the factoring lesson proved is positive for every real xx. The discriminant now certifies the same fact in one subtraction, and the parabola y=x2+x+1y = x^2 + x + 1 floats entirely above the axis.

Check your understanding

How many real solutions does 3x2−2x+5=03x^2 - 2x + 5 = 0 have?

Answer choices

When a quadratic factors, and over what

The factoring lesson left a question open on purpose. It showed that x2−2x^2 - 2 has real zeros yet refuses to factor over the rationals, and it warned that “factors” is meaningless until you name the number system. The discriminant closes that question, but only if you keep two claims apart, because they are genuinely different and blurring them is the classic error at this exact spot.

The first claim is a real test with a real hypothesis.

The perfect-square test (for rational coefficients only)#

Let ax2+bx+cax^2 + bx + c have rational coefficients (integers are the common case), with a≠0a \ne 0. The roots are −b±Δ2a\tfrac{-b \pm \sqrt{\Delta}}{2a}, and since aa and bb are rational, these roots are rational exactly when Δ\sqrt{\Delta} is rational. A factoring lesson result says a quadratic with rational coefficients factors over the rationals exactly when it has a rational root. Chaining the two,

factors over Q  ⟺  rational root  ⟺  Δ rational  ⟺  Δ is the square of a rational number.\begin{aligned} \text{factors over } \mathbb{Q} &\iff \text{rational root} \\ &\iff \sqrt{\Delta}\ \text{rational} \\ &\iff \Delta\ \text{is the square of a rational number}. \end{aligned}

For integer coefficients Δ\Delta is an integer. If Δ<0\Delta < 0 there is no real square root at all, so no real (and hence no rational) root either. If Δ≥0\Delta \ge 0, then Δ\sqrt{\Delta} is rational exactly when Δ\Delta is a perfect square; a non-negative integer that is not a perfect square has an irrational square root. So a quadratic with integer coefficients factors over the rationals if and only if its discriminant is a non-negative perfect square. That is the version you will use almost every time, since most coefficients you meet are integers; the “square of a rational number” version above is what actually holds when the coefficients are rational but not whole.

The hypothesis is not decoration. The test speaks only about quadratics whose coefficients are rational, and it says nothing about a quadratic with irrational coefficients. State it with its hypothesis attached every single time.

The second claim is the trap, and it is false: a non-negative discriminant does not mean a quadratic “factors nicely.” Having real roots and factoring over the rationals are different properties. A quadratic with Δ>0\Delta > 0 has two real zeros, and each real zero buys a real factor. So such a quadratic always factors over the reals, but with integer coefficients it factors over the rationals only when that Δ\Delta is a perfect square on top of being positive. The next example holds the two apart.

Worked example 3 Real roots, yet no rational factorization

Does 3x2+5x−13x^2 + 5x - 1 factor over the rationals? Does 3x2+5x−23x^2 + 5x - 2?

For 3x2+5x−13x^2 + 5x - 1, the coefficients are integers, so run the test:

Δ=52−4(3)(−1)=25+12=37.\Delta = 5^2 - 4(3)(-1) = 25 + 12 = 37.

Now 3737 is positive, so there are two distinct real roots, but 3737 is not a perfect square, so 37\sqrt{37} is irrational and the roots −5±376\tfrac{-5 \pm \sqrt{37}}{6} are irrational. The quadratic does not factor over the rationals, even though it factors over the reals as 3(x−−5+376)(x−−5−376)3\left(x - \tfrac{-5 + \sqrt{37}}{6}\right)\left(x - \tfrac{-5 - \sqrt{37}}{6}\right). Real roots did not buy a rational factorization.

Change the constant by one, to 3x2+5x−23x^2 + 5x - 2, and the story flips:

Δ=52−4(3)(−2)=25+24=49=72,\Delta = 5^2 - 4(3)(-2) = 25 + 24 = 49 = 7^2,

a perfect square, so this one does factor over the rationals, as (3x−1)(x+2)(3x - 1)(x + 2). The two quadratics look almost identical, both have two real roots, and the discriminant quickly predicts which one an integer factoring search can crack, before you spend time searching. This is the honest retirement of the factoring lesson’s open question: “factors” always needs a number system named, and the discriminant is what names it.

Check your understanding

The equation 2x2+7x+3=02x^2 + 7x + 3 = 0 has integer coefficients and discriminant Δ=49−24=25\Delta = 49 - 24 = 25. What does that tell you?

Answer choices

Designing with the discriminant, and choosing a method

Because Δ\Delta controls the root count, you can run the logic backwards: fix the number of roots you want and solve for the coefficient that delivers it. The condition Δ=0\Delta = 0 in particular is the exact knife edge between two roots and none. So problems that ask for “exactly one solution” or a graph “tangent to the axis” are really asking you to set the discriminant to zero.

Worked example 4 Forcing a single root

For which values of kk does x2+kx+9=0x^2 + kx + 9 = 0 have exactly one real solution?

Exactly one real solution is the case Δ=0\Delta = 0. With a=1a = 1, b=kb = k, c=9c = 9,

Δ=k2−4(1)(9)=k2−36.\Delta = k^2 - 4(1)(9) = k^2 - 36.

Set it to zero: k2−36=0k^2 - 36 = 0, so k2=36k^2 = 36 and k=±6k = \pm 6. Both work, and they are geometrically the two ways to slide the parabola until its vertex just kisses the axis. At k=6k = 6 the equation is x2+6x+9=(x+3)2=0x^2 + 6x + 9 = (x + 3)^2 = 0 with double root −3-3; at k=−6k = -6 it is (x−3)2=0(x - 3)^2 = 0 with double root 33. A single condition on the discriminant pinned down both designs.

The formula always works, which tempts you to reach for it every time, but “always works” is not the same as “always fastest.” Match the method to the equation. If a quadratic factors on sight, like x2−3x−10=(x−5)(x+2)x^2 - 3x - 10 = (x - 5)(x + 2), factoring reads off the roots in seconds and the formula is slower busy work. If the equation is already a square, or one step from being one, like x2=2x^2 = 2 or (x−3)2=5(x - 3)^2 = 5, taking a square root directly beats expanding into aa, bb, cc and running the full formula. Reach for the formula once neither shortcut is available, which tends to happen when the coefficients are awkward or the roots turn out irrational. A quick glance at the discriminant tells you which world you are in before you commit. With integer coefficients, a perfect-square discriminant means the quadratic factors over the rationals, so a factoring search will succeed; with rational, non-integer coefficients the matching condition is that Δ\Delta is the square of a rational number. Either way, any other value means factoring over the rationals is hopeless, and the formula is your reliable route.

One caution belongs with any formula that produces radicals. The quadratic formula is a statement about exact arithmetic. The value 3+23 + \sqrt{2} is an exact root of x2−6x+7x^2 - 6x + 7; the decimal 4.4144.414 is only an approximation. Rounding too early can quietly corrupt an answer, especially when the formula subtracts two nearly equal numbers. Keep radicals in exact form as long as you can, and round only at the very end if a decimal is what the problem wants.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Core practice

Practice problems at the level of the course, to be worked out on paper. Hints one at a time, then the answer or the full worked solution, with your progress kept in this browser.

Core practice Work it out on paper 10 problems Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (optional)

People were solving quadratics for three thousand years before anyone wrote a single formula that covers every one of them.

Old Babylonian scribes, in what is now Iraq, left clay tablets from about 1800 BCE recording numerical procedures for this kind of problem. They set the same puzzle over and over. A number and its partner have a known sum and a known product; find them. The procedure pressed into the clay is the one you ran in the last lesson. It goes move for move: halve, square, subtract, take the root. What the scribes recorded was a method that worked on specific numbers, worked out fresh each time; what they lacked was a way to write “for every aa, bb and cc” and be done with every case at once.

Stating the rule in general also meant accepting answers people did not want. Around the year 628 the astronomer Brahmagupta, working in India, wrote out a verbal rule for the quadratic. It covers the equation almost completely. His arithmetic elsewhere let a negative quantity stand as a number in its own right, which was rare. Most mathematicians before him treated a negative answer as not a real solution at all, and many continued to for a long time afterward. They reported one solution where there were two.

Both of those inheritances sit inside the single line you proved today. The ±\pm is the scribes’ pair of numbers. Its minus branch is the kind of quantity Brahmagupta’s arithmetic already admitted, even where nobody yet wrote a rule that returned both roots at once. One derivation, carried out once in letters instead of worked fresh on every new set of numbers, closes three thousand years of solving the same kind of problem again and again by hand.