Book contents
Contents
raw Math
RAW Book Algebra Polynomial Equations

Solving Quadratic Equations

Robert Eisele

A quadratic equation in standard form is

\[ax^2 + bx + c = 0, \qquad a, b, c \in \mathbb{R}, \qquad a \neq 0\]

The requirement \(a \neq 0\) is what makes it quadratic rather than linear: if \(a\) were \(0\), the \(x^2\) term would vanish and only a linear equation would remain. A solution of the equation is also called a root or a zero of the quadratic polynomial \(ax^2+bx+c\) — not to be confused with taking a square root, even though the two words look alike. Over the real numbers, a quadratic equation has either no solution, exactly one solution, or exactly two distinct solutions; which of these three cases occurs is decided by the discriminant derived below. This chapter is the degree-\(2\) special case of the general theory in Introduction to Polynomials, which covers arbitrary degree.

Quadratic Equation Calculator

\[ax^2 + bx + c = 0\]

\(a\) \(b\) \(c\)
Calculate

How Many Solutions?

Not every quadratic equation behaves the same way. Three small examples show all three possible outcomes.

The equation \(x^2+1=0\) has no real solution: since \(x^2\geq0\) for every real \(x\), the left-hand side satisfies \(x^2+1\geq1\) and can never equal \(0\), so \(\mathbb{L}=\varnothing\).

The equation \(x^2+2x+1=0\) has exactly one real solution: the left-hand side is the perfect square \((x+1)^2\), and a square is \(0\) exactly when its base is \(0\), so \(x=-1\) is the only solution, \(\mathbb{L}=\{-1\}\).

The equation \(x^2-1=0\) has exactly two real solutions: factoring the difference of squares gives \((x-1)(x+1)=0\), which holds exactly when \(x-1=0\) or \(x+1=0\), so \(\mathbb{L}=\{-1,1\}\).

The Zero-Product Property

The last two examples above both relied on the same fact: for real numbers \(p\) and \(q\),

\[pq=0 \iff p=0 \text{ or } q=0\]

where the "or" is inclusive — both factors are allowed to be \(0\) at once. This is what lets an already factored quadratic equation be solved by inspection. For example, \(x^2-3x=0\) factors as \(x(x-3)=0\) by pulling out the common factor \(x\), so the zero-product property immediately gives \(x=0\) or \(x=3\), i.e. \(\mathbb{L}=\{0,3\}\).

Factoring with Vieta's Formulas

Most quadratic equations don't arrive pre-factored, but they can often be factored by inspection once the right pattern is known. If a monic quadratic equation \(x^2+Bx+C=0\) factors as \((x-r)(x-s)=0\) for some \(r,s\), then expanding the product gives

\[(x-r)(x-s) = x^2-(r+s)x+rs\]

Comparing coefficients with \(x^2+Bx+C\) shows that \(r\) and \(s\) must satisfy

\[r+s=-B \qquad\text{and}\qquad rs=C\]

These two relations are known as Vieta's formulas, named after François Viète. For \(x^2-8x+12=0\), we need two numbers with sum \(8\) and product \(12\); \(2\) and \(6\) work, since \(2+6=8\) and \(2\cdot6=12\), so \(x^2-8x+12=(x-2)(x-6)\) and \(\mathbb{L}=\{2,6\}\).

The Proper Way: Solving via Sum and Product

Guessing \(r\) and \(s\) works when the numbers are small and friendly, but it is not a method — it is luck. Vieta's formulas can be turned into an actual solution procedure by asking directly: what do two numbers with a prescribed sum and product look like, in general? This turns out to be a cleaner and more conceptually direct route to the quadratic formula than the completing-the-square trick usually taught first, because every step answers a question about \(r\) and \(s\) themselves rather than performing an algebraic manipulation whose purpose isn't obvious until the end.

Two numbers have a fixed sum \(r+s=-B\) exactly when they sit symmetrically around their mean \(-\frac{B}{2}\). So instead of treating \(r\) and \(s\) as two independent unknowns, write them as one unknown offset \(u\) from that mean:

\[r=-\frac{B}{2}-u, \qquad s=-\frac{B}{2}+u\]

This approach satisfies the sum condition automatically, for any value of \(u\):

\[r+s = \left(-\frac{B}{2}-u\right)+\left(-\frac{B}{2}+u\right) = -B\]

The product condition is the one equation left to solve, and it is a difference of squares:

\[ rs = \left(-\frac{B}{2}-u\right)\left(-\frac{B}{2}+u\right) = \left(\frac{B}{2}\right)^2-u^2 \]

Setting this equal to \(C\) and solving for \(u\) gives

\[u^2 = \left(\frac{B}{2}\right)^2-C \qquad\Longrightarrow\qquad u = \sqrt{\left(\frac{B}{2}\right)^2-C}\]

whenever the right-hand side is nonnegative. Substituting back into \(r=-\frac{B}{2}-u\) and \(s=-\frac{B}{2}+u\) gives both roots at once:

\[x_{1,2} = -\frac{B}{2} \pm \sqrt{\left(\frac{B}{2}\right)^2-C}\]

This is exactly the pq-formula derived again below from a different angle, and the same substitution generalizes immediately to the non-monic case: dividing \(ax^2+bx+c=0\) by \(a\) first turns it into \(x^2+\frac{b}{a}x+\frac{c}{a}=0\), i.e. \(B=\frac{b}{a}\) and \(C=\frac{c}{a}\), so

\[ x_{1,2} = -\frac{b}{2a} \pm \sqrt{\left(\frac{b}{2a}\right)^2-\frac{c}{a}} = -\frac{b}{2a} \pm \sqrt{\frac{b^2-4ac}{4a^2}} = \frac{-b\pm\sqrt{b^2-4ac}}{2a} \]

which is the full quadratic formula, reached without ever needing to recognize or construct a perfect square by algebraic manipulation — only the symmetric placement of two numbers around their mean.

Revisiting \(x^2-8x+12=0\) from above with \(B=-8\), \(C=12\): the mean of the two roots is \(-\frac{B}{2}=4\), so we write \(r=4-u\), \(s=4+u\) and require \((4-u)(4+u)=12\), i.e. \(16-u^2=12\), so \(u^2=4\) and \(u=2\). This gives \(r=4-2=2\) and \(s=4+2=6\), matching the guess-and-check result from before — but now reached systematically, without having to spot the factorization by eye.

Completing the Square

The classical alternative to the symmetric method above turns the equation into a perfect square by an explicit algebraic manipulation, rather than by an approach about the roots themselves. It reaches the same formula, just by a different route. Starting again from

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

we isolate the constant term:

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

Now split the middle term into two equal parts:

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

Interpret \(x^2\) as a square of side length \(x\), and the two terms \(\frac{b}{2a}x\) as rectangles of size \(x \times \frac{b}{2a}\). These pieces almost form a larger square.

\(x^2\) \(\frac{b}{2a}x\) \(\frac{b}{2a}x\) \(=-\frac{c}{a}\)

To complete the square, add the missing square with side length \(\frac{b}{2a}\) on both sides:

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

The left-hand side is now a perfect square, and the right-hand side simplifies to

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

Taking square roots gives

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

and isolating \(x\) yields the quadratic formula again:

\[x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\]

As a worked example, consider \(x^2-6x+3=0\). Moving the constant to the right gives \(x^2-6x=-3\); half of \(-6\) is \(-3\), whose square is \(9\), so adding \(9\) to both sides gives \(x^2-6x+9=6\), i.e. \((x-3)^2=6\). Taking both square roots, \(x-3=\pm\sqrt{6}\), so \(x_{1,2}=3\pm\sqrt{6}\) and \(\mathbb{L}=\{3-\sqrt6,\,3+\sqrt6\}\). Similarly, for \(x^2+10x+20=0\), moving the constant over gives \(x^2+10x=-20\); half of \(10\) is \(5\), whose square is \(25\), so \(x^2+10x+25=5\), i.e. \((x+5)^2=5\), giving \(x_{1,2}=-5\pm\sqrt5\) and \(\mathbb{L}=\{-5-\sqrt5,\,-5+\sqrt5\}\).

The Discriminant

The expression under the square root in the quadratic formula is important enough to have its own name, the discriminant:

\[\Delta = b^2-4ac\]

In the normalized form used while completing the square above, the same information appears as

\[D = \left(\frac{b}{2a}\right)^2-\frac{c}{a} = \frac{\Delta}{4a^2}\]

Since \(4a^2>0\) whenever \(a\neq0\), \(D\) and \(\Delta\) always have the same sign, so either one can be used to decide how many real solutions the equation has:

This is exactly what happened in the three warm-up examples above: \(x^2+1=0\) has \(\Delta=0^2-4\cdot1\cdot1=-4<0\) (no real solution), \(x^2+2x+1=0\) has \(\Delta=2^2-4\cdot1\cdot1=0\) (a double root at \(x=-1\)), and \(x^2-1=0\) has \(\Delta=0^2-4\cdot1\cdot(-1)=4>0\) (two distinct roots \(\pm1\)).

The PQ-Formula

Another common variant is the PQ formula. It starts from the monic quadratic equation

\[x^2 + \underbrace{\frac{b}{a}}_{=p}x + \underbrace{\frac{c}{a}}_{=q} = 0\]

and derives the roots by completing the square:

\[ \begin{array}{rrl} & x^2 + px + q &= 0\\ \Leftrightarrow & x^2 + px + \left(\frac{p}{2}\right)^2 - \left(\frac{p}{2}\right)^2 + q &= 0\\ \Leftrightarrow & \left(x + \frac{p}{2}\right)^2 - \left(\frac{p}{2}\right)^2 + q &= 0\\ \Leftrightarrow & \left(x + \frac{p}{2}\right)^2 &= \left(\frac{p}{2}\right)^2 - q\\ \Leftrightarrow & x + \frac{p}{2} &= \pm\sqrt{\left(\frac{p}{2}\right)^2 - q}\\ \Leftrightarrow & x_{1,2} &= -\frac{p}{2} \pm \sqrt{\left(\frac{p}{2}\right)^2 - q} \end{array} \]

which is exactly the result found earlier from the symmetric sum-and-product approach, with \(p=B\) and \(q=C\). As a worked example, take \(x^2-2x=6-3x\); bringing every term to one side gives \(x^2+x-6=0\), so \(p=1\), \(q=-6\). The discriminant \(D=\left(\frac12\right)^2-(-6)=\frac{25}{4}>0\), so there are two distinct solutions \(x_{1,2}=-\frac12\pm\sqrt{\frac{25}{4}}=-\frac12\pm\frac52\), i.e. \(x_1=2\), \(x_2=-3\), giving \(\mathbb{L}=\{-3,2\}\). For a double-root example, \(\frac12x^2-2x+2=0\) multiplied by \(2\) becomes \(x^2-4x+4=0=(x-2)^2\), so \(D=0\) and \(\mathbb{L}=\{2\}\).

Vieta's Formulas for the General Equation

The factoring argument used earlier for the monic case \(x^2+Bx+C\) applies just as well to the general equation \(ax^2+bx+c=0\) with roots \(x_1,x_2\), since dividing by \(a\) turns it into the monic form with \(B=\frac{b}{a}\) and \(C=\frac{c}{a}\):

\[x_1+x_2=-\frac{b}{a} \qquad\text{and}\qquad x_1x_2=\frac{c}{a}\]

These relations are useful in both directions: they let a monic-looking pair of nice roots be found by inspection (as done above), and they let any pair of computed roots be checked without redoing the whole calculation — simply verify that they sum and multiply to the expected values.

Intercept Form

A quadratic equation can also be written in intercept form using the roots \((x_1, 0)\) and \((x_2, 0)\):

\[a(x - x_1)(x - x_2) = 0\]

Converting from standard form to intercept form can be done with the quadratic formula, the PQ formula, or by completing the square.

Two More Compact Algebraic Derivations

The general (non-monic) formula can also be reached directly, without first dividing by \(a\) or introducing \(B\) and \(C\). Completing the square on \(ax^2+bx+c=0\) itself:

\[ \begin{array}{rrl} & ax^2 + bx + c &= 0\\ \Leftrightarrow & ax^2 + bx &= -c\\ \Leftrightarrow & x^2 + \frac{b}{a}x &= -\frac{c}{a}\\ \Leftrightarrow & x^2 + \frac{b}{a}x + \frac{b^2}{4a^2} &= -\frac{c}{a} + \frac{b^2}{4a^2} = -\frac{4ac}{4a^2} + \frac{b^2}{4a^2}\\ \Leftrightarrow & \left(x + \frac{b}{2a}\right)^2 &= \frac{b^2 - 4ac}{4a^2}\\ \Leftrightarrow & x + \frac{b}{2a} &= \pm\sqrt{\frac{b^2 - 4ac}{4a^2}}\\ \Leftrightarrow & x &= -\frac{b}{2a} \pm \frac{\sqrt{b^2 - 4ac}}{2a}\\ \Leftrightarrow & x_{1,2} &= \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \end{array} \]

An alternative algebraic route avoids fractions entirely by multiplying through by \(4a\) first, so that the linear term becomes twice a product that a binomial square can absorb directly:

\[ \begin{array}{rrl} & ax^2 + bx + c &= 0\\ \Leftrightarrow & 4a^2x^2 + 4abx + 4ac &= 0\\ \Leftrightarrow & (2ax)^2 + 2 \cdot 2axb + b^2 - b^2 + 4ac &= 0\\ \Leftrightarrow & (2ax + b)^2 - b^2 + 4ac &= 0\\ \Leftrightarrow & (2ax + b)^2 &= b^2 - 4ac\\ \Leftrightarrow & 2ax + b &= \pm\sqrt{b^2 - 4ac}\\ \Leftrightarrow & 2ax &= -b \pm\sqrt{b^2 - 4ac}\\ \Leftrightarrow & x_{1,2} &= \frac{-b \pm\sqrt{b^2 - 4ac}}{2a} \end{array} \]

An Alternative Derivation via Calculus

A quadratic polynomial has a single turning point, and the quadratic formula can be reached by locating it directly instead of completing a square. Starting from the normalized form

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

the horizontal position of the turning point is found by differentiating the left-hand side and setting the result to \(0\):

\[\frac{d}{dx} \left(x^2 + \frac{b}{a}x + \frac{c}{a}\right) = 2x+\frac{b}{a} = 0 \qquad\Longrightarrow\qquad x = -\frac{b}{2a}\]

Shifting the equation by this offset (substituting \(x\to x-\frac{b}{2a}\)) removes the linear term entirely:

\[\begin{array}{rrl} &\left(x - \frac{b}{2a}\right)^2 + \frac{b}{a}\left(x - \frac{b}{2a}\right) + \frac{c}{a} &= 0\\ \Leftrightarrow & x^2 - \frac{b^2 - 4ac}{4a^2} &= 0\\ \Leftrightarrow & x &= \pm\sqrt{\frac{b^2 - 4ac}{4a^2}} \end{array}\]

Undoing the shift and simplifying gives the quadratic formula once more:

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

Overview of Solution Methods

Several routes to the same quadratic formula have been shown above, each suited to different situations: