The Quadratic Formula

Learning goals

  • Derive the quadratic formula by completing the square on ax2+bx+c=0ax^2 + bx + c = 0
  • Write a quadratic in standard form and read off aa, bb, cc with their signs
  • Apply the formula, simplifying radicals and reducing the fraction to find the roots
  • Use D=b2−4acD = b^2 - 4ac to predict real, repeated, or complex roots before solving

Deriving the formula by completing the square

First try 2x2+5x−3=02x^2+5x-3=0, with a=2a=2, b=5b=5, c=−3c=-3. Dividing by 22 and moving the constant gives x2+52x=32x^2+\tfrac52x=\tfrac32. Half of 52\tfrac52 is 54\tfrac54; add its square, 2516\tfrac{25}{16}:

(x+54)2=2416+2516=4916.\left(x+\frac54\right)^2=\frac{24}{16}+\frac{25}{16}=\frac{49}{16}.

Thus x+54=±74x+\tfrac54=\pm\tfrac74, so x=−5±74x=\tfrac{-5\pm7}{4}: the roots are 12\tfrac12 and −3-3. Now follow those same steps with letters in place of the coefficients.

Deriving the quadratic formula from ax2+bx+c=0ax^2 + bx + c = 0#

Start from the general quadratic equation, where aa, bb, and cc are real numbers with a≠0a \ne 0. If aa were 00 there would be no x2x^2 term and the equation would not be quadratic at all:

ax2+bx+c=0.ax^2 + bx + c = 0.

To use the pattern from the previous lesson, first make the leading coefficient 11 by dividing every term by aa. Because a≠0a\ne0, this division is allowed:

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

Move the constant term to the right side, so the left holds only the two terms that carry xx:

x2+bax=−ca.x^2 + \frac{b}{a}x = -\frac{c}{a}.

Now complete the square on the left. Half of the coefficient of xx is b2a\dfrac{b}{2a}, and squaring it gives b24a2\dfrac{b^2}{4a^2}. Add that constant to both sides, which keeps the equation balanced:

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

The left side is now a perfect square. Since half of ba\tfrac{b}{a} is b2a\tfrac{b}{2a}, it factors as

(x+b2a)2=b24a2−ca.\left(x + \frac{b}{2a}\right)^2 = \frac{b^2}{4a^2} - \frac{c}{a}.

Combine the right side into one fraction. The common denominator is 4a24a^2, and rewriting ca=4ac4a2\dfrac{c}{a} = \dfrac{4ac}{4a^2} lets the two pieces subtract cleanly:

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

Take both square roots. Recall from Fractional Exponents and Radicals that a radical names one value: 9=3\sqrt9=3. The ±\pm supplies the two possible signs when solving for the quantity squared. If b2−4acb^2-4ac is negative, use the convention from Completing the Square: −k=ik\sqrt{-k}=i\sqrt k for k>0k>0, where i2=−1i^2=-1. Its square is −k-k, and the two signs still give both square roots. The denominator 4a24a^2 is positive, and 4a2=2∣a∣\sqrt{4a^2}=2|a|. To check the fraction below, square it: the numerator becomes b2−4acb^2-4ac, even when this is negative, and the denominator becomes 4a24a^2. Both sign choices therefore solve the completed square:

x+b2a=±b2−4ac2∣a∣.x+\frac{b}{2a}=\pm\frac{\sqrt{b^2-4ac}}{2|a|}.

Replacing 2∣a∣2|a| with 2a2a gives the same pair of values: if a<0a<0, it merely exchanges the two sign choices. We may therefore write

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

Finally subtract b2a\dfrac{b}{2a} from both sides to isolate xx:

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

Both terms on the right already share the denominator 2a2a, so they merge into a single fraction, and that fraction is the quadratic formula:

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

The only restriction on the real coefficients was a≠0a\ne0, so the formula applies to every quadratic with real coefficients. It gives the same roots as completing the square.

Check your understanding

In the derivation, why must every term be divided by aa before completing the square?

Answer choices

Check your understanding

In the derivation, why is (b2a)2\left(\dfrac{b}{2a}\right)^2, and not b2a\dfrac{b}{2a} or ba\dfrac{b}{a}, the constant added to both sides to complete the square?

Answer choices

What the formula says

Here is the result on its own, worth memorizing because you will use it constantly:

ax2+bx+c=0⟹x=−b±b2−4ac2a.ax^2 + bx + c = 0 \quad\Longrightarrow\quad x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}.

The single ±\pm packs both solutions into one line. Read with a plus it gives one root; read with a minus it gives the other. The one part people misread is the denominator: the 2a2a divides the entire numerator, both the −b-b and the b2−4ac\sqrt{b^2 - 4ac} together, not just one piece of it.

Anatomy of the quadratic formulaNegative b plus or minus the square root of b squared minus 4ac is one numerator. Both terms are divided by 2a.b² − 4ac is the discriminant−b ± √(b² − 4ac)2aDivide the whole numeratorby 2a.
The entire numerator is divided by 2a. The quantity b² - 4ac under the square root is the discriminant.

To use the formula you first need the three numbers aa, bb, and cc. They are the coefficients when the equation is written in standard form, with everything on one side and zero on the other:

ax2+bx+c=0.ax^2 + bx + c = 0.

Here aa is the coefficient of x2x^2, bb is the coefficient of xx, and cc is the constant term. Read them with their signs. In 3x2−5x+2=03x^2 - 5x + 2 = 0 the coefficients are a=3a = 3, b=−5b = -5, and c=2c = 2; the minus sign belongs to bb. A wrong sign here gives a wrong answer, so check the signs before you substitute.

The discriminant

Look again at the quantity under the square root:

D=b2−4ac.D = b^2 - 4ac.

This is the discriminant. Its sign tells you what kind of roots the equation has. For a=1a=1, it equals 4R4R, where R=(b2)2−cR=(\tfrac b2)^2-c was the number on the right of the completed square. Multiplication by 44 preserves the sign, so the same three cases occur.

If D>0D > 0, then D\sqrt{D} is a nonzero real number, and the ±\pm pulls it once above and once below −b-b, giving two different real roots.

If D=0D = 0, then D=0\sqrt{D} = 0, and adding or subtracting 00 makes no difference, so the two roots fall together into one repeated real root, x=−b2ax = -\dfrac{b}{2a}.

If D<0D<0, there are two nonreal complex roots. Recall i2=−1i^2=-1 and D=i−D\sqrt D=i\sqrt{-D}: for example (6i)2=−36(6i)^2=-36, and the convention from Completing the Square chooses −36=6i\sqrt{-36}=6i. The formula gives −b2a±−D2ai-\tfrac{b}{2a}\pm\tfrac{\sqrt{-D}}{2a}i. These form a conjugate pair, with the same real part and opposite coefficients of ii (their imaginary parts).

Discriminant D=b2−4acD = b^2 - 4acThe square root D\sqrt{D}Roots of the quadratic
D>0D > 0a nonzero real numbertwo distinct real roots
D=0D = 0zeroone repeated real root
D<0D < 0imaginarytwo complex conjugate roots

You can name the type of roots from DD alone, without ever finishing the solve.

Check your understanding

Without solving, what does the discriminant tell you about the roots of 2x2−3x+5=02x^2 - 3x + 5 = 0?

Answer choices

Applying the formula

To solve a quadratic with the formula, put the equation in standard form, read off aa, bb, and cc with their signs, substitute, and simplify.

Worked example 1 Solve 2x2+5x−3=02x^2 + 5x - 3 = 0

The equation is already in standard form, so read off a=2a = 2, b=5b = 5, and c=−3c = -3, keeping the sign on cc. Substitute into the formula, watching the double negative in −4ac-4ac:

x=−5±52−4(2)(−3)2(2)=−5±25+244.x = \frac{-5 \pm \sqrt{5^2 - 4(2)(-3)}}{2(2)} = \frac{-5 \pm \sqrt{25 + 24}}{4}.

The term −4(2)(−3)=+24-4(2)(-3) = +24 is positive because cc was negative, so the discriminant is 25+24=4925 + 24 = 49, a perfect square:

x=−5±494=−5±74.x = \frac{-5 \pm \sqrt{49}}{4} = \frac{-5 \pm 7}{4}.

Now split the ±\pm into its two cases:

x=−5+74=24=12,x=−5−74=−124=−3.x = \frac{-5 + 7}{4} = \frac{2}{4} = \frac{1}{2}, \qquad x = \frac{-5 - 7}{4} = \frac{-12}{4} = -3.

The roots are x=12x=\tfrac12 and x=−3x=-3. Here the coefficients are integers and the discriminant is a perfect square, so the roots are rational. Factoring could also find them.

Worked example 2 Solve 3x2−6x+1=03x^2 - 6x + 1 = 0

Read off a=3a = 3, b=−6b = -6, and c=1c = 1. Because b=−6b = -6, the term −b-b is +6+6, and b2=(−6)2=36b^2 = (-6)^2 = 36 is positive; a common slip is to write −36-36 here. Substitute:

x=−(−6)±(−6)2−4(3)(1)2(3)=6±36−126=6±246.x = \frac{-(-6) \pm \sqrt{(-6)^2 - 4(3)(1)}}{2(3)} = \frac{6 \pm \sqrt{36 - 12}}{6} = \frac{6 \pm \sqrt{24}}{6}.

Here the integer discriminant 2424 is not a perfect square, so the roots are irrational. Simplify the radical using 24=4×624 = 4 \times 6 and 4=2\sqrt{4} = 2:

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

Every term in the fraction shares a factor of 22, so divide the numerator and denominator by 22 to reduce:

x=2(3±6)6=3±63.x = \frac{2\left(3 \pm \sqrt{6}\right)}{6} = \frac{3 \pm \sqrt{6}}{3}.

The roots are x=3+63x = \dfrac{3 + \sqrt{6}}{3} and x=3−63x = \dfrac{3 - \sqrt{6}}{3}, both real and irrational. Reduce only by a factor common to −b-b, the radical, and the denominator; here that shared factor is 22.

Check your understanding

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

Answer choices

The formula also finds roots that are not real. When the discriminant is negative, the substitution gives a square root of a negative number, which you write using the imaginary unit ii.

Worked example 3 Solve x2+4x+13=0x^2 + 4x + 13 = 0 (complex roots)

Read off a=1a = 1, b=4b = 4, and c=13c = 13, and substitute:

x=−4±42−4(1)(13)2(1)=−4±16−522=−4±−362.x = \frac{-4 \pm \sqrt{4^2 - 4(1)(13)}}{2(1)} = \frac{-4 \pm \sqrt{16 - 52}}{2} = \frac{-4 \pm \sqrt{-36}}{2}.

The discriminant is −36-36, negative, so the roots are complex. Rewrite the root of the negative with ii, using −36=i36=6i\sqrt{-36} = i\sqrt{36} = 6i:

x=−4±6i2.x = \frac{-4 \pm 6i}{2}.

Divide both parts of the numerator by 22:

x=−42±6i2=−2±3i.x = \frac{-4}{2} \pm \frac{6i}{2} = -2 \pm 3i.

The roots are the conjugate pair x=−2+3ix = -2 + 3i and x=−2−3ix = -2 - 3i. When the discriminant is negative, the two roots form a conjugate pair like this, matching in real part and opposite in imaginary part, the coefficient of ii.

Worked example 4 Solve 4x2−12x+9=04x^2 - 12x + 9 = 0 (a repeated root)

Read off a=4a = 4, b=−12b = -12, and c=9c = 9. Substitute, being careful that −b=12-b = 12 and b2=(−12)2=144b^2 = (-12)^2 = 144:

x=12±(−12)2−4(4)(9)2(4)=12±144−1448=12±08.x = \frac{12 \pm \sqrt{(-12)^2 - 4(4)(9)}}{2(4)} = \frac{12 \pm \sqrt{144 - 144}}{8} = \frac{12 \pm \sqrt{0}}{8}.

The discriminant is 00, so 0=0\sqrt{0} = 0 and the ±\pm adds nothing. The two roots collapse into one:

x=128=32.x = \frac{12}{8} = \frac{3}{2}.

There is a single repeated root, x=32x = \tfrac{3}{2}. Whenever the discriminant is zero, the quadratic factors as aa times a squared linear expression, a(x−r)2a(x - r)^2, so the same root appears twice; here 4x2−12x+9=(2x−3)24x^2 - 12x + 9 = (2x - 3)^2.

Check your understanding

Solve x2−6x+10=0x^2 - 6x + 10 = 0 with the quadratic formula.

Answer choices

A quadratic does not always arrive in standard form. When it does not, move every term to one side first, so that the other side is 00, and only then read off aa, bb, and cc.

Worked example 5 Solve x2=3x+10x^2 = 3x + 10 by first reaching standard form

As written, the equation is not set to 00, so you cannot read the coefficients yet. Subtract 3x3x and 1010 from both sides to gather everything on the left:

x2−3x−10=0.x^2 - 3x - 10 = 0.

Now it is in standard form with a=1a = 1, b=−3b = -3, and c=−10c = -10. Substitute, noting that −4ac=−4(1)(−10)=+40-4ac = -4(1)(-10) = +40:

x=−(−3)±(−3)2−4(1)(−10)2(1)=3±9+402=3±492.x = \frac{-(-3) \pm \sqrt{(-3)^2 - 4(1)(-10)}}{2(1)} = \frac{3 \pm \sqrt{9 + 40}}{2} = \frac{3 \pm \sqrt{49}}{2}.

The discriminant is 4949, so

x=3±72⇒x=5  or  x=−2.x = \frac{3 \pm 7}{2} \quad\Rightarrow\quad x = 5 \ \text{ or }\ x = -2.

If you skip the move to standard form and read the coefficients off x2=3x+10x^2 = 3x + 10 directly, you get the signs wrong.

Check your understanding

Solve x2+x=12x^2 + x = 12 with the quadratic formula. (Reach standard form first.)

Answer choices

The next lesson uses the quadratic formula in real-world problems, where an unknown length, time, or price is a value that makes a quadratic equal zero.

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)

Where does the 44 in b2−4acb^2-4ac come from? Our derivation used a common denominator of 4a24a^2. A rule attributed to the Indian mathematician Shridhara clears the fractions at the start instead.

Historians place Shridhara around 900, though the date is uncertain. His original work on quadratics is lost; the rule survives in a quotation by the later mathematician Bhaskara II. It says to multiply by four times the squared-term coefficient, add the square of the linear coefficient, then take a square root.

Here is that approach in modern notation. From ax2+bx+c=0ax^2+bx+c=0, move cc to the other side and multiply by 4a4a. Then add b2b^2 to both sides:

4a2x2+4abx=−4ac,(2ax)2+2(2ax)b+b2=b2−4ac,(2ax+b)2=b2−4ac.\begin{aligned} 4a^2x^2+4abx&=-4ac, \\ (2ax)^2+2(2ax)b+b^2&=b^2-4ac, \\ (2ax+b)^2&=b^2-4ac. \end{aligned}

The multiplier makes a perfect square without halves. Taking both square roots now gives 2ax+b=±b2−4ac2ax+b=\pm\sqrt{b^2-4ac} and the same quadratic formula. The historical rule does not explicitly give both signs; that last step states the full modern solution.

Source: MacTutor’s account of Shridhara and the rule quoted by Bhaskara II.

Your progress

See all your progress →