Queen of the Sciences RU

Part II · Algebra Chapter 10 of 60

Quadratic equations

The problem the last chapter ended with is nearly four thousand years old. Let's excavate it layer by layer, from a clay tablet to the quadratic formula, and see what the formula really says.

Ages 11–15 40 minutes

Builds on: 9 · Functions and graphs

You will learn

  • solve any quadratic equation and understand where the quadratic formula comes from
  • see from the discriminant and the parabola how many roots an equation has
  • guess roots with Vieta's formulas, factor a quadratic and find the vertex of a parabola

The last chapter ended with a question: at which $x$ does the function $y = x^2 + x$ take the value $\frac34$? On the graph the answer is almost visible. The parabola crosses the horizontal line $y = \frac34$ at two points, and the right-hand one seems to sit exactly above the mark $x = \frac12$. Substitute: $\frac14 + \frac12 = \frac34$. A good guess. But guessing isn't a method: replace $\frac34$ with $\frac{7}{10}$ and your eye won't help any more.

This problem was solved long before graphs, letters and the equals sign. Its statement was pressed with a reed stylus into a clay tablet about 3800 years old. Archaeologists dig down, from new to old; we'll go the other way, from the oldest find up to today's formula. Each layer has left its artefact: a scribe's recipe, a Baghdad scholar's drawing, a formula in letters, a theorem about the sum of the roots. By the end of the dig we'll have a way to solve any quadratic equation and an understanding of why it works the way it does.

Tablet BM 13901

The British Museum holds a clay tablet with the inventory number BM 13901. It was written by a Mesopotamian scribe in the Old Babylonian period, in the first half of the second millennium BC. It holds more than two dozen problems, all about squares. The first goes like this:

The area and the side of my square I have added: 0;45. Put down 1. Break off half of 1: 0;30 and 0;30 multiply together: 0;15. Add 0;15 to 0;45: 1, which is the square of 1. Tear out the 0;30 you multiplied from 1: 0;30, the side of the square.

Tablet BM 13901, problem 1. Mesopotamia, 19th–17th century BC. A free rendering after the historian Jens Høyrup's literal translation
Hand copy of the cuneiform tablet BM 13901: columns of cuneiform lines, with the broken areas hatched
A hand copy of tablet BM 13901: every line is wedges pressed into wet clay. Hatching marks the broken-off areas.

The Babylonians wrote numbers in base sixty (see the chapter on counting) and didn't separate the whole part from the fractional part: the same notation could mean $45$ or $\frac{45}{60}$. The scribe knew which was meant from the sense of the problem. Historians insert the separator themselves, as a semicolon. So $0{;}45 = \frac{45}{60} = \frac34$, $0{;}30 = \frac12$, $0{;}15 = \frac14$. In our notation the statement is the equation

$$x^2 + x = \frac34,$$

and the solution takes five steps. Take half the coefficient of $x$: $\frac12$. Square it: $\frac14$. Add it to the right side: $\frac14 + \frac34 = 1$. Take the square root: $1$. Subtract the same half: $1 - \frac12 = \frac12$. The answer $x = \frac12$ is the one we guessed from the graph.

The tablet explains nothing. There isn't a single "because", only commands: put down, break off, add, tear out. Almost all Babylonian mathematical texts are like this: collections of solved problems that scribes learned from. Where the recipe came from has to be reconstructed from circumstantial evidence, as usual in archaeology.

What the scribe did with his hands

The evidence is in the verbs. Numbers aren't "broken off" or "torn out": that's how you talk about pieces that get cut and moved around. The Danish historian Jens Høyrup proposed reading these texts literally, as instructions for a drawing, and many historians now share his reading. Let's see what comes out.

The side of the square is the unknown $x$, its area $x^2$. "Adding the area and the side" means attaching a strip of width $1$ and length $x$ to the square: its area is exactly $x$. The whole figure has area $\frac34$. Cut the strip in half lengthwise and move one half below the square. The area hasn't changed, but the figure has become a square with a missing $\frac12 \times \frac12$ corner. Fill in the corner by adding its area $\frac14$, and you get a whole square of area $1$ and side $1$. That side consists of $x$ and half the strip, so $x = 1 - \frac12$.

There's nothing special about the tablet's numbers. If the strip has width $b$ and the whole figure has area $c$, the same five steps solve the equation $x^2 + bx = c$.

If $b > 0$ and $c > 0$, the equation $x^2 + bx = c$ has exactly one positive root: $x = \sqrt{\left(\frac b2\right)^2 + c} - \frac b2$.

A proof by drawing. Press "Next": each step is one of the scribe's actions and an explanation of why it's legitimate. In the "Custom" tab you can set any $b$ and $c$; the "Al-Khwarizmi" tab will be needed in the next section.

The drawing proves that a positive root, if there is one, can only be this one: the rearrangement turns the condition $x^2 + bx = c$ into the equation $\left(x + \frac b2\right)^2 = \left(\frac b2\right)^2 + c$, and there is only one positive number with a given square. It remains to check that the number from the recipe works. It's positive: when $c > 0$ the number under the root is larger than $\left(\frac b2\right)^2$, so the root is larger than $\frac b2$. And it solves the equation: if $x + \frac b2 = \sqrt{\left(\frac b2\right)^2 + c}$, then squaring gives $x^2 + bx + \left(\frac b2\right)^2 = \left(\frac b2\right)^2 + c$, that is, $x^2 + bx = c$.

The area of the missing corner, a square whose side is half the strip. It's added so that the figure becomes a whole square. The area of the figure from the problem: the square together with the strip. Half the strip: the side of the big square is longer than $x$ by exactly this much. The tablet: $b = 1$, $c = \frac34$, so $x = \sqrt{\frac14 + \frac34} - \frac12 = 1 - \frac12 = \frac12$. Check: $\left(\frac12\right)^2 + \frac12 = \frac34$.

The technique has a name. The scribe's recipe is the square of a sum from the chapter on letters, read from right to left: $x^2 + bx$ is almost $\left(x + \frac b2\right)^2$, only the term $\left(\frac b2\right)^2$ is missing.

Completing the square means writing the expression $x^2 + bx$ as $\left(x + \frac b2\right)^2 - \left(\frac b2\right)^2$. In the drawing it's moving half the strip and filling in the corner.

Solve $x^2 + 6x = 16$ by the Babylonian recipe. We need the side of the square, that is, the positive root.

Half of $6$ is $3$, and its square is $9$. Add: $9 + 16 = 25$, whose root is $5$. Subtract the half: $5 - 3 = 2$. Check: $2^2 + 6 \cdot 2 = 4 + 12 = 16$.

Notice what's missing from the tablet. The equation $x^2 + x = \frac34$ has a second root, $x = -\frac32$: indeed, $\frac94 - \frac32 = \frac34$. But a square can't have a side of minus one and a half, and the scribe never even thought of such a root. This missing root will haunt us for several thousand more years.

Baghdad, around 820

The next layer lies two and a half thousand years higher. In Baghdad, at the court of the caliph al-Ma'mun, Muhammad ibn Musa al-Khwarizmi writes a book on "al-jabr and al-muqabala". We already opened it in the chapter on equations: its title gave us the word "algebra". It begins with equations we'd now call quadratic, and the most famous of them goes like this:

A square and ten of its roots are equal to thirty-nine dirhams. Halve the number of roots, which gives five. Multiply this by itself, which gives twenty-five. Add it to thirty-nine, which gives sixty-four. Take the root of this, eight, and subtract from it half the number of roots, that is, five. Three remains: this is the root of the square you sought, and the square itself is nine.

Muhammad al-Khwarizmi, The Compendious Book on Calculation by Completion and Balancing, c. 820. Retold after F. Rosen's English translation (1831)

By a "root" al-Khwarizmi means the unknown number, by a "square" its square, and dirhams (coins) simply mean a number. This is the equation $x^2 + 10x = 39$, and the recipe is the Babylonian one word for word. What's new lies elsewhere.

First, al-Khwarizmi proves the recipe with a drawing. One of his drawings matches the Babylonian one: ten roots become two strips $5 \times x$, the missing corner a square $5 \times 5 = 25$, and the whole square has area $39 + 25 = 64$ and side $8$. Another drawing is even more symmetric: strips of width $2\frac12$ are attached to all four sides of the square, and four corners of $6\frac14$ each have to be filled in, the same $25$ in all. Choose the "Al-Khwarizmi" tab in the drawing above and walk the path from $39$ to $3$.

Second, al-Khwarizmi works through every case. His algebra knows no negative numbers, and his coefficients are always positive quantities, so "move everything to one side and set it equal to zero" isn't possible. Instead of one equation there are six kinds:

As al-Khwarizmi puts itIn our letters
squares equal roots$ax^2 = bx$
squares equal a number$ax^2 = c$
roots equal a number$bx = c$
squares and roots equal a number$x^2 + bx = c$
squares and a number equal roots$x^2 + c = bx$
roots and a number equal squares$bx + c = x^2$

All the $a$, $b$, $c$ here are positive. For us it's a single equation $ax^2 + bx + c = 0$ with coefficients of different signs; for al-Khwarizmi it was six different problems, each with its own recipe and its own drawing.

The third novelty matters more than the first two. In the fifth kind, "squares and a number equal roots", there can be two roots. Al-Khwarizmi's example is $x^2 + 21 = 10x$. Half the roots is $5$, its square $25$; subtract $21$, leaving $4$, whose root is $2$. Now $2$ can be either subtracted from five or added to five: both numbers, $3$ and $7$, work. And al-Khwarizmi immediately warns: if the square of half the number of roots is less than the number, the problem is impossible. A thousand years later this condition would be called a negative discriminant.

But the second root of $x^2 + 10x = 39$ doesn't appear in the book. For al-Khwarizmi, as for the Babylonian scribe, a root is a length.

How many roots does $x^2 + 10x = 39$ have?

Substitute $-13$: $(-13)^2 + 10 \cdot (-13) = 169 - 130 = 39$. But $13$ doesn't work: $169 + 130 = 299$. Al-Khwarizmi found only $3$ because he was looking for the side of a square.

The formula: one for every case

Six recipes instead of one are the price of numbers without signs. Merging them into one formula took two things. The first was negative numbers, which Europe finally accepted only in the eighteenth and nineteenth centuries (chapter 2). The second was letters not only for the unknown but for the known numbers too. François Viète introduced them in 1591, as we told in the chapter on letters. With letters the recipe can be written once, for every equation at the same time.

A quadratic equation is an equation of the form $ax^2 + bx + c = 0$, where $a$, $b$, $c$ are numbers and $a \ne 0$. The numbers $a$, $b$, $c$ are called coefficients: $a$ the leading coefficient, $b$ the second, and $c$ the constant term.

The condition $a \ne 0$ isn't a formality: without $x^2$ the equation becomes linear and has to be solved differently, as in chapter 8. Now let's retrace the scribe's path, but with letters. The number $b^2 - 4ac$ that turns up along the way we'll call $D$; in the next section it gets a name.

Let $a \ne 0$ and $D = b^2 - 4ac \ge 0$. Then the roots of $ax^2 + bx + c = 0$ are the numbers $x_{1,2} = \frac{-b \pm \sqrt{D}}{2a}$, and it has no other roots. When $D = 0$ the two numbers coincide.

The idea is the scribe's: complete the left side to a full square. Only now the numbers can have any sign, so the drawing is just a hint, and we rely on the square of a sum, which holds for any numbers.

Divide both sides by $a$. That's allowed because $a \ne 0$, and it doesn't change the roots: dividing both sides by the same non-zero number is an equivalent transformation. Write $p = \frac ba$ and $q = \frac ca$; the equation is now $x^2 + px + q = 0$. Move $q$ to the right: $x^2 + px = -q$. The left side is what the scribe had: a square with side $x$ and a strip $p \times x$. Cut the strip in half lengthwise and turn one half to the top side of the square. The result is a square with side $x + \frac p2$ missing a $\frac p2 \times \frac p2$ corner: $x^2 + px = \left(x + \frac p2\right)^2 - \left(\frac p2\right)^2$. For negative $x$ or $p$ there's no picture, but the equation always holds: it's the square of a sum $\left(x + \frac p2\right)^2 = x^2 + px + \frac{p^2}{4}$ read from right to left. Add the corner $\left(\frac p2\right)^2$ to both sides: $\left(x + \frac p2\right)^2 = \frac{p^2}{4} - q$. Again the roots don't change: the same number was added to both sides. Bring the right side to the common denominator $4a^2$: $\frac{p^2}{4} - q = \frac{b^2}{4a^2} - \frac{c}{a} = \frac{b^2 - 4ac}{4a^2} = \frac{\p3{D}}{4a^2}$. We get the equation $\left(x + \frac{b}{2a}\right)^2 = \frac{D}{4a^2}$, equivalent to the original. The right side is non-negative since $D \ge 0$. Its square root is $\frac{\sqrt D}{2|a|}$: this number is non-negative, and its square is $\frac{D}{4a^2}$. Two numbers have this square, the root itself and its opposite, and no others: if $u^2 = r^2$, then $(u - r)(u + r) = 0$, and by the zero-product lemma $u = r$ or $u = -r$. These two numbers are written $\p2{\pm}\frac{\sqrt D}{2a}$; no absolute value is needed, because the $\pm$ sign runs through both signs anyway. So $x + \frac{b}{2a} = \pm\frac{\sqrt D}{2a}$. Subtract $\frac{b}{2a}$, the side of the square without half the strip, as the scribe did: $x = \frac{\p1{-b} \p2{\pm} \sqrt{\p3{D}}}{\p4{2a}}$. Every step was equivalent: dividing by a non-zero number, moving a term, adding the same number to both sides, and taking the square root with both signs. So the formula gives all the roots and no extra ones.
The drawing shows positive $x$ and $p$; for other numbers the same equation, the square of a sum, does the work.
The second coefficient with its sign reversed. If $b = -7$, this is $+7$: this minus is the most common source of mistakes. Two signs, two roots. In the scribe's problems the "plus" gives the positive root found on the tablet, and the "minus" the one that wasn't in the drawing. The number under the root decides how many roots there are. It's the subject of the next section. Twice the leading coefficient. With $a = 0$ there would be nothing to divide by, but then the equation isn't quadratic. Example: $2x^2 - 7x + 3 = 0$, with $a = 2$, $b = -7$, $c = 3$. Under the root $49 - 24 = 25$, so $x_{1,2} = \frac{7 \pm 5}{4}$, that is, $x_1 = 3$, $x_2 = \frac12$. Check: $2 \cdot 9 - 21 + 3 = 0$ and $2 \cdot \frac14 - \frac72 + 3 = 0$.

The quadratic formula is the Babylonian recipe written in letters: half the coefficient, square, sum, root, difference. All that's new is the $\pm$ sign and the fact that numbers can have any sign.

When the second coefficient is even, it's easier to use a formula with the twos cancelled in advance: smaller numbers, fewer mistakes.

If $b = 2k$ and $k^2 - ac \ge 0$, the roots of $ax^2 + 2kx + c = 0$ are the numbers $x_{1,2} = \frac{-k \pm \sqrt{k^2 - ac}}{a}$.

Substitute $b = 2k$ into the quadratic formula. The discriminant is $D = 4k^2 - 4ac = 4(k^2 - ac)$, so $D \ge 0$ exactly when $k^2 - ac \ge 0$. Next, $\sqrt{4(k^2 - ac)} = 2\sqrt{k^2 - ac}$: the number on the right is non-negative, and its square is $4(k^2 - ac)$. So $x_{1,2} = \frac{-2k \pm 2\sqrt{k^2 - ac}}{2a}$, and it remains to cancel the two. Example: for $x^2 - 6x + 5 = 0$ we have $k = -3$ and $x = 3 \pm \sqrt{9 - 5} = 3 \pm 2$, that is, $1$ and $5$.

Another proof of the formula, without a single fraction

Indian mathematicians knew a way to avoid division. Bhaskara II in the twelfth century gives it, citing an earlier author, Sridhara. Multiply $ax^2 + bx + c = 0$ by $4a$ and move $4ac$ to the right:

$$4a^2x^2 + 4abx = -4ac.$$

The left side is short of the square $(2ax + b)^2$ by $b^2$. Add it to both sides:

$$4a^2x^2 + 4abx + b^2 = b^2 - 4ac, \qquad (2ax + b)^2 = b^2 - 4ac.$$

Hence $2ax + b = \pm\sqrt{b^2 - 4ac}$, and the same formula comes out with no fractions along the way. It also shows where the four in it comes from: from the factor $4a$ that turns the left side into a square.

Solve $3x^2 + 5x - 2 = 0$.

Here $a = 3$, $b = 5$, $c = -2$. Under the root $b^2 - 4ac = 25 + 24 = 49$, so $x_{1,2} = \frac{-5 \pm 7}{6}$: $x_1 = \frac{2}{6} = \frac13$, $x_2 = \frac{-12}{6} = -2$. Check: $3 \cdot \frac19 + \frac53 - 2 = 0$ and $3 \cdot 4 - 10 - 2 = 0$.

The discriminant: how many roots

Everything you need to know about the number of roots is hidden in one number, the one under the root. The word "discriminant", from the Latin for "distinguishing", was introduced in 1851 by the English mathematician James Sylvester: this number distinguishes the cases.

The discriminant of the quadratic equation $ax^2 + bx + c = 0$ is the number $D = b^2 - 4ac$.

The square of the second coefficient. It is never negative. Four times the product of the outer coefficients. If $a$ and $c$ have opposite signs, this number is negative, we subtract a negative, and $D$ is certainly positive. Examples: for $x^2 + 2x + 5 = 0$ the discriminant is $4 - 20 = -16$; for $x^2 - 6x + 9 = 0$ it's $36 - 36 = 0$; for $2x^2 - 7x + 3 = 0$ it's $49 - 24 = 25$.

The equation $ax^2 + bx + c = 0$ with $a \ne 0$ has two distinct roots if $D > 0$; exactly one root if $D = 0$; and no real roots if $D < 0$.

It all comes down to the second-last step of the proof of the quadratic formula: the equation is equivalent to $(x - m)^2 = r$, where $m = -\frac{b}{2a}$ and $r = \frac{D}{4a^2}$. The denominator $4a^2$ is positive, so $r$ has the same sign as $D$.

Draw the graph of the left side, $y = (x - m)^2$. It's the parabola $y = x^2$ shifted along the axis by $m$ (chapter 9). It touches the $x$-axis at the point $m$ and nowhere dips below the axis: the square of any number is non-negative (chapter 2). The right side is the horizontal line $y = r$, and the roots of the equation are the $x$-coordinates of its common points with the parabola. If $D > 0$ then $r > 0$, and there are two common points: $x = m + \sqrt r$ and $x = m - \sqrt r$, which are different numbers. There are no others: $(x - m)^2 = \left(\sqrt r\right)^2$ implies $(x - m - \sqrt r)(x - m + \sqrt r) = 0$, and a product is zero only when one of its factors is (chapter 8). Lower the line to $r = 0$, that is, $D = 0$. The two points merge at the vertex: $(x - m)^2 = 0$ only at $x = m$, because the square of a non-zero number is positive. There's one root, $x = -\frac{b}{2a}$; sometimes people say "two coinciding roots". Lower the line below the axis: $D < 0$ and $r < 0$. The parabola doesn't go there, since a square is never negative, so there are no common points and no real roots. There are no other cases: the number $D$ is either greater than zero, equal to zero, or less. So $D > 0$ gives two roots, $D = 0$ one, and $D < 0$ none.

Let's look at the same thing through the eyes of the last chapter. The roots of $ax^2 + bx + c = 0$ are the points where the graph of $y = ax^2 + bx + c$ meets the $x$-axis. This graph is a parabola (we'll prove why in the section on the vertex), and the discriminant tells you whether it crosses the axis, touches it or misses it.

Move the sliders or drag the vertex of the parabola. Catch the moment when $D$ passes through zero, and try setting $a = 0$.

The quadratic formula is handy to read as "centre plus or minus half-width":

$$x_{1,2} = -\frac{b}{2a} \pm \frac{\sqrt D}{2a}.$$

The roots always sit symmetrically about the point $-\frac{b}{2a}$: the parabola's axis of symmetry passes through it, and its vertex lies on that axis. The discriminant sets the distance from the centre to the roots. The smaller it is, the closer the roots are to each other; at $D = 0$ they merge at the vertex, and at $D < 0$ there's nothing to make a distance from.

How many roots does $x^2 - 2026x - 1 = 0$ have?

No calculation needed. The coefficients $a = 1$ and $c = -1$ have opposite signs, so $-4ac = 4 > 0$ and $D = 2026^2 + 4 > 0$. The graph says the same: at $x = 0$ the upward parabola passes below the axis, through the point $(0, -1)$, so it crosses the axis twice.

Sum and product

François Viète (1540–1603) was a lawyer and a royal councillor who did mathematics in his spare time, and became one of the strongest algebraists of his century. For Henri IV he decoded intercepted Spanish dispatches, so successfully that the King of Spain, the story goes, complained to the Pope about sorcery. Among the things Viète noticed in algebra is a relation that schoolchildren in many countries learn by heart; in Russia there's even a rhyme about it.

If $x_1$ and $x_2$ are the roots of the quadratic equation $ax^2 + bx + c = 0$ (with $x_1 = x_2$ when $D = 0$), then their sum is $-\frac ba$ and their product is $\frac ca$.

The idea: write both roots in terms of their midpoint. Then everything extra cancels in the sum, and the product becomes a difference of squares.

There are roots, so $D \ge 0$, and by the quadratic formula $x_1 = m + w$, $x_2 = m - w$, where $m = -\frac{b}{2a}$ is the midpoint between the roots and $w = \frac{\sqrt D}{2a}$ is the distance from the midpoint to a root (with a sign; when $D = 0$ it's zero and the roots coincide). Each root is a walk along the number line from zero: first by $m$, then by $w$ to the right (for $x_1$) or to the left (for $x_2$). Add the walks: we cover $m$ twice, and the steps $+w$ and $-w$ cancel out. So $x_1 + x_2 = 2m = 2 \cdot \left(-\frac{b}{2a}\right) = \p1{-\frac ba}$. Multiply the roots using the difference of squares: $(m + w)(m - w) = m^2 - w^2$. Substitute $m$ and $w$: $m^2 - w^2 = \frac{b^2}{4a^2} - \frac{D}{4a^2} = \frac{b^2 - (b^2 - 4ac)}{4a^2} = \frac{4ac}{4a^2} = \p2{\frac ca}$. We have $x_1 + x_2 = -\frac ba$ and $x_1 x_2 = \frac ca$, for any roots of any quadratic equation.
The sum of the roots: the second coefficient divided by the leading one, with its sign reversed. The product of the roots: the constant term divided by the leading coefficient. Example: $2x^2 - 7x + 3 = 0$ has roots $3$ and $\frac12$. Their sum is $\frac72$, and $-\frac ba = -\frac{-7}{2} = \frac72$. Their product is $\frac32$, and $\frac ca = \frac32$.

Viète himself considered only positive roots. The relations were written out in general, with negative roots and for equations of any degree, by Albert Girard in 1629; we'll come back to them in the chapter on polynomials.

The formulas look especially simple when $a = 1$. Such an equation is called monic: for $x^2 + px + q = 0$ we get $x_1 + x_2 = -p$ and $x_1 x_2 = q$. Any quadratic equation becomes monic after dividing by $a$.

The theorem works in reverse as well, and it's this direction that lets you guess roots.

If numbers $x_1$ and $x_2$ satisfy $x_1 + x_2 = s$ and $x_1 x_2 = p$, then they are the roots of $x^2 - sx + p = 0$, and it has no other roots.

The idea: build the quadratic from two brackets.

Expand the brackets by the product of sums and group the terms with $x$: $(x - x_1)(x - x_2) = x^2 - x_1x - x_2x + x_1x_2 = x^2 - (x_1 + x_2)x + x_1x_2 = x^2 - sx + p$. This is an identity; it holds for every $x$. So the equation $x^2 - sx + p = 0$ is equivalent to $(x - x_1)(x - x_2) = 0$: the left sides are equal at every $x$. A product is zero if and only if at least one factor is zero (chapter 8). So the roots are $x = x_1$ and $x = x_2$, and only those.

That's why the roots of a monic equation with integer coefficients can often be guessed. For $x^2 - 7x + 12 = 0$ look for two numbers with sum $7$ and product $12$: they're $3$ and $4$, and by the converse there are no other roots. No discriminant needed.

Vieta's formulas also reveal the signs of the roots, which the discriminant keeps quiet about.

If $\frac ca < 0$, the equation $ax^2 + bx + c = 0$ has two roots of opposite signs. If $\frac ca > 0$ and $D \ge 0$, the roots have the same sign, the sign of their sum $-\frac ba$.

Let $\frac ca < 0$. Then $a$ and $c$ have opposite signs, $-4ac > 0$ and $D = b^2 - 4ac > 0$: there are two roots (remember $x^2 - 2026x - 1$). By Vieta their product is $\frac ca < 0$, and a product of two numbers is negative only when they have opposite signs. Now let $\frac ca > 0$ and $D \ge 0$. The product of the roots is positive, so neither is zero and they have the same sign. A sum of two numbers of the same sign has that sign, so the sign of the roots is the sign of the sum $-\frac ba$.

The discriminant can't tell you this: for $x^2 + 3x + 2 = 0$ it's positive, yet both roots, $-1$ and $-2$, are negative.

Babylonian scribes, incidentally, solved exactly such problems: the tablets are full of rectangles whose length plus width and whose area are known. Their method was to take half the sum and look for the deviation from it. If the numbers are $\frac s2 + u$ and $\frac s2 - u$, their sum is $s$ for any $u$, and their product $\left(\frac s2\right)^2 - u^2$ must equal $p$. Hence $u^2 = \left(\frac s2\right)^2 - p$. For $s = 7$, $p = 12$ we get $u^2 = \frac{49}{4} - 12 = \frac14$, $u = \frac12$, and the numbers are $3.5 \pm 0.5$. In 2019 the American mathematician Po-Shen Loh proposed teaching schoolchildren to solve quadratic equations exactly this way: no ready-made formula, just this one idea.

Drag the points $x_1$ and $x_2$. With "hold the sum" on, they move symmetrically about the midpoint, and you can see which product is largest. Some of the problems have a catch.

Two more tests save time in an exam.

If $a + b + c = 0$, the roots of $ax^2 + bx + c = 0$ are $1$ and $\frac ca$. If $a - b + c = 0$, its roots are $-1$ and $-\frac ca$.

Substitute $x = 1$: the left side is $a \cdot 1^2 + b \cdot 1 + c = a + b + c = 0$, so $1$ is a root. Since there's a root, $D \ge 0$ and Vieta's formulas apply: the product of the roots is $\frac ca$, so the second root is $\frac ca : 1 = \frac ca$ (if it's also $1$, there's just one root). At $x = -1$ the left side is $a - b + c$; if that's zero, $-1$ is a root, and the second is $\frac ca : (-1) = -\frac ca$.

For $5x^2 - 8x + 3 = 0$ the coefficients add up to $5 - 8 + 3 = 0$, so the roots are $1$ and $\frac35$, and there's no need to compute the discriminant.

Without solving $x^2 - 5x - 3 = 0$, find the sum of the squares of its roots, $x_1^2 + x_2^2$.

By Vieta $x_1 + x_2 = 5$ and $x_1 x_2 = -3$. Then $x_1^2 + x_2^2 = (x_1 + x_2)^2 - 2x_1x_2 = 25 + 6 = 31$. The roots themselves, $\frac{5 \pm \sqrt{37}}{2}$, are irrational, but the sum of their squares is a whole number.

Factoring the quadratic

The expression $ax^2 + bx + c$ with $a \ne 0$ is called a quadratic (a quadratic trinomial), and the roots of $ax^2 + bx + c = 0$ are its roots.

If the roots of a quadratic are known, Vieta lets you factor it.

If $x_1$ and $x_2$ are the roots of $ax^2 + bx + c$ (with $x_1 = x_2$ when $D = 0$), then $ax^2 + bx + c = a(x - x_1)(x - x_2)$ for every $x$. If there are no roots ($D < 0$), the quadratic can't be written as a product of two factors of degree one with real coefficients.

The idea: expand the right side and recognise the left side by Vieta. For the second part, argue by contradiction.

Expand the brackets as in the proof of the converse: $a(x - x_1)(x - x_2) = a\bigl(x^2 - (x_1 + x_2)x + x_1x_2\bigr)$. By Vieta $x_1 + x_2 = -\frac ba$ and $x_1x_2 = \frac ca$. Substitute and expand: $a\left(x^2 + \frac ba x + \frac ca\right) = ax^2 + bx + c$. The first part is proved. Now let $D < 0$, and suppose the quadratic still equals $(kx + l)(ux + v)$ for all $x$, with $k \ne 0$ and $u \ne 0$ (otherwise a factor isn't of degree one). Substitute $x = -\frac lk$: the first factor becomes zero, and with it the whole product. So $-\frac lk$ is a root of the quadratic. But when $D < 0$ there are no roots. The contradiction shows that no such factorization exists. In sum: when $D \ge 0$ the quadratic factors as $a(x - x_1)(x - x_2)$, and when $D < 0$ it doesn't factor into factors of degree one.
The leading coefficient is taken out as a whole. The first root of the quadratic. The second root. When $D = 0$ it coincides with the first, giving $a(x - x_1)^2$. Example: the roots of $2x^2 - 7x + 3$ are $3$ and $\frac12$, so $2x^2 - 7x + 3 = 2(x - 3)\left(x - \frac12\right) = (x - 3)(2x - 1)$.

Factoring works the other way too: an equation written as a product is solved without the formula. A product is zero if and only if at least one factor is, so the roots of $x(x - 5) = 0$ are $0$ and $5$. But only zero has this property, and people get caught out by that.

How do you solve $(x - 2)(x + 3) = 6$?

Knowing that a product equals $6$ tells you nothing about the individual factors: $6 = 1 \cdot 6 = 2 \cdot 3 = 12 \cdot \frac12 = \dots$ Expand: $x^2 + x - 6 = 6$, that is, $x^2 + x - 12 = 0$, with roots $3$ and $-4$. Check: $(3 - 2)(3 + 3) = 6$ and $(-4 - 2)(-4 + 3) = 6$.

The square root of minus fifteen

In 1545 Gerolamo Cardano's Great Art was published in Nuremberg, the book in which the solution of cubic equations was first printed. Among other things Cardano works through a simple-looking problem: divide $10$ into two parts whose product is $40$.

By Vieta this is the equation $x^2 - 10x + 40 = 0$, and its discriminant $100 - 160 = -60$ is negative. Cardano follows the recipe anyway: half is $5$, its square $25$, subtract $40$, and you get $-15$. The answer comes out as $5 + \sqrt{-15}$ and $5 - \sqrt{-15}$. Cardano even checks it, multiplying "by the rules": $(5 + \sqrt{-15})(5 - \sqrt{-15}) = 25 - (-15) = 40$. It works! And then he calls such calculations subtle but useless.

Why the problem has no ordinary solution can be seen from the same half-sum the scribes worked with.

If $x + y = s$, then $xy \le \left(\frac s2\right)^2$, with equality only when $x = y = \frac s2$.

The idea: measure both numbers from the midpoint. If one is $u$ more than $\frac s2$, the other is $u$ less.

Set $u = x - \frac s2$. Then $x = \frac s2 + u$ and $y = s - x = \frac s2 - u$. The product $xy$ is the area of a rectangle with sides $\frac s2 + u$ and $\frac s2 - u$. In the drawing $0 \le u < \frac s2$, so both numbers are positive. Cut off everything of the rectangle that sticks out beyond the square with side $\frac s2$ (dashed): a strip of width $u$ and height $\frac s2 - u$. Turn the strip through a right angle and lay it on top of the rectangle, at the left edge. Now its length $\frac s2 - u$ lies along the top side, and its width $u$ is exactly what the rectangle's height was short of $\frac s2$. Moving pieces doesn't change area. The pieces fill the whole square $\left(\frac s2\right)^2$ except a $u \times u$ corner. So $xy = \left(\frac s2\right)^2 - \p3{u^2}$. For any numbers, not just positive ones, the difference of squares gives the same equation: $\left(\frac s2 + u\right)\left(\frac s2 - u\right) = \left(\frac s2\right)^2 - u^2$. A square $u^2$ is never negative, so $xy \le \left(\frac s2\right)^2$. Equality holds only when $u^2 = 0$, that is, $u = 0$ and $x = y = \frac s2$.
The point at the bottom sets half the sum, the point on the left the smaller of the two numbers.

For Cardano $s = 10$: the product of two parts of ten is at most $5 \cdot 5 = 25$, and you can't squeeze forty out of ten however you split it. In general, numbers with sum $s$ and product $p$ exist only if $p \le \left(\frac s2\right)^2$. The condition $p > \left(\frac s2\right)^2$ is exactly $s^2 - 4p < 0$, a negative discriminant of $x^2 - sx + p = 0$. The "hold the sum" mode in the game above shows the same thing.

Cardano set the strange roots aside. But a quarter of a century later Rafael Bombelli met them again, in a cubic equation whose three roots are all perfectly ordinary, and realised there was no getting round them. That story awaits us in the chapter on polynomials, together with formulas like ours for equations of degree three and four. For degree five there is no such formula, and why is big question 3, which Galois theory answers. And in the chapter on complex numbers the equation $x^2 - 10x + 40 = 0$ will get two full-fledged roots, points in the plane.

Where the parabola turns

Completing the square can do more than solve equations. If you do it to the function $y = ax^2 + bx + c$, without setting anything equal to zero, you get everything you need to know about its graph.

Let $a \ne 0$, $x_0 = -\frac{b}{2a}$ and $y_0 = -\frac{D}{4a}$. Then $ax^2 + bx + c = a(x - x_0)^2 + y_0$ for every $x$. When $a > 0$ the function $y = ax^2 + bx + c$ takes its smallest value $y_0$ at the point $x_0$ and only there; when $a < 0$, its largest. Its graph is symmetric about the line $x = x_0$.

The idea: complete the square, as in the proof of the quadratic formula, and see how far the graph rises above its lowest point.

Take out $a$ and complete the square, as in the scribe's drawing: $ax^2 + bx + c = a\left(x^2 + \frac ba x\right) + c = a\left(x + \frac{b}{2a}\right)^2 - \frac{b^2}{4a} + c$. Here $-\frac{b^2}{4a} + c = -\frac{b^2 - 4ac}{4a} = -\frac{D}{4a} = y_0$, so $ax^2 + bx + c = a(x - x_0)^2 + y_0$. The drawing shows the horizontal line $y = y_0$. Let $a > 0$. At any point $x$ the graph is raised above the line $y = y_0$ by $a(x - x_0)^2$. That's a square times a positive number, and it's never negative. So $y \ge y_0$ for all $x$: the whole graph lies no lower than the line. Equality $y = y_0$ happens only when $a(x - x_0)^2 = 0$, that is, at $x = x_0$: the square of a non-zero number is positive, and $a \ne 0$. The point $(x_0, y_0)$ is the unique lowest point of the graph. Take two points equally far from $x_0$: $x_0 + h$ and $x_0 - h$. At the first $(x - x_0)^2 = h^2$, at the second $(-h)^2 = h^2$, and the function values coincide. So the graph is symmetric about the line $x = x_0$. When $a < 0$ the term $a(x - x_0)^2$ is never positive, and the same point turns out to be the highest. And by the rule for shifts and stretches, the graph of $y = a(x - x_0)^2 + y_0$ is the parabola $y = x^2$ stretched vertically by a factor of $|a|$ (and flipped as well when $a < 0$) and shifted so that its vertex moves from the origin to the point $(x_0, y_0)$. So the graph of every quadratic is a parabola.
The drawing is for $a = \frac12$; the vertex and the point $x$ on the bottom scale can be dragged.

The point $(x_0, y_0)$ is called the vertex of the parabola $y = ax^2 + bx + c$: its lowest point if the arms point up ($a > 0$), and its highest if they point down ($a < 0$).

The leading coefficient: its sign tells you which way the arms point, and its size how steep the parabola is. The $x$-coordinate of the vertex, $x_0 = -\frac{b}{2a}$, exactly midway between the roots if there are any. The $y$-coordinate of the vertex, $y_0 = -\frac{D}{4a}$: the smallest (when $a > 0$) or largest (when $a < 0$) value of the function. Example: $x^2 - 6x + 5 = (x - 3)^2 - 4$. The vertex is the point $(3, -4)$, the smallest value is $-4$, and the roots are $3 \pm 2$, that is, $1$ and $5$.

The sign of the discriminant can be read from the vertex too. When $a > 0$ the $y$-coordinate $y_0 = -\frac{D}{4a}$ is negative exactly when $D > 0$: the vertex is below the axis, the arms point up, and there are two crossings. If the vertex is above the axis, there are none.

The ball

A ball thrown in the air is the best-known parabola. Ignoring air resistance, the ball's height $t$ seconds after the throw is $h_0 + vt - \frac{gt^2}{2}$, where $h_0$ is the starting height, $v$ the initial vertical speed, and $g \approx 9.8$ m/s² the acceleration due to gravity. For round numbers take $g \approx 10$ m/s². A ball thrown straight up from the ground at $20$ m/s is, after $t$ seconds, at a height of $h = 20t - 5t^2$ metres. The vertex is at $t_0 = -\frac{20}{2 \cdot (-5)} = 2$ s, at a height of $20 \cdot 2 - 5 \cdot 4 = 20$ m.

When will this ball be at a height of $15$ m? Solve $20t - 5t^2 = 15$.

Move everything to the left and divide by $-5$: $t^2 - 4t + 3 = 0$. By Vieta the roots are $1$ and $3$. The ball is at $15$ m twice: after one second on the way up and after three on the way down. The vertex, $t_0 = 2$, is exactly in the middle.

Why is a thrown ball's path a parabola? If the ball flies at an angle, then horizontally it moves uniformly: in $t$ seconds it moves $x = ut$, where $u$ is the horizontal speed. Hence $t = \frac xu$, and the height above the ground, $h_0 + v\frac xu - \frac g2 \cdot \frac{x^2}{u^2}$, is a quadratic in $x$ with leading coefficient $-\frac{g}{2u^2}$. And the graph of a quadratic, as we've just proved, is a parabola with its arms pointing down.

What if the ball is thrown not from the ground but from a tower? Then in the equation "the ball is on the ground", $h_0 + vt - \frac{gt^2}{2} = 0$, the constant term $h_0$ is positive and the leading coefficient $-\frac g2$ negative. The coefficients $a$ and $c$ have opposite signs, so the roots have opposite signs too. The positive root is the moment of landing. And the negative one?

Drag the green tip of the velocity arrow (it shows where the ball would be after a second without gravity) and the square marker on the tower. "Throw" launches the ball; if the "past" is shown, it starts at the moment $t_2$.

The equation knows nothing about the tower. It describes the whole parabola, and the negative root is the moment when a ball flying along the same parabola would have been at ground level, had it been thrown earlier and from below. It's the same "extra" root the Babylonian scribe and al-Khwarizmi didn't write down. Here it has a meaning, a time before the throw, but it isn't needed in the problem about landing. Whether to keep a root or discard it is decided by the problem, not by algebra.

The pen

A farmer has bought $40$ metres of fencing and wants to enclose a rectangular pen along the long wall of a barn, so that the wall serves as the fourth side. If the width of the pen, measured from the wall, is $x$ metres, then $40 - 2x$ metres are left for the side along the wall, and the area is

$$S(x) = x(40 - 2x) = -2x^2 + 40x.$$

This is a parabola with its arms pointing down, and its vertex is at $x_0 = -\frac{40}{2 \cdot (-2)} = 10$. The best pen is $10 \times 20$ metres, with an area of $200$ m². Not a square: the side along the wall is twice as long. Without the wall, the best pen that the same $40$ metres can enclose is a $10 \times 10$ square; that's the theorem on the largest product, since such a pen has length plus width equal to $20$. Its area is half as big.

Drag the corner of the pen or the point on the area graph. Switch to "in an open field" and compare.

For parabolas a ready-made formula gives the vertex. For other functions we'll learn to find largest and smallest values with the derivative, and what a parabola has in common with a satellite dish is explained in the chapter on conic sections.

Fieldwork

The dig is finished and the finds catalogued; all that's left is to build up skill. The trainer has three levels. At the first the roots are whole numbers and easy to find with Vieta. At the second there are fractional roots and special cases: $D = 0$, "no roots", equations without an $x$ term or without a constant term. At the third the roots are mostly irrational, and the equation often has to be brought to the form $ax^2 + bx + c = 0$ first.

If you have an equation of your own, the solver will take it apart step by step. All the course's trainers are collected on the practice page.

Where next

Every equation in this chapter has one unknown. Even the Babylonian rectangle problem, which really has two unknowns, length and width, came down to one: by Vieta the conditions $x + y = 7$ and $xy = 12$ give $x^2 - 7x + 12 = 0$ at once. We're not always that lucky. "Three notebooks and two pens cost 190, and two notebooks and three pens cost 160. How much is a notebook?" Here there are two unknowns and two conditions, and neither condition alone gives the answer. And what if the conditions aren't equalities but "at most" and "at least": how much raw material is in the warehouse, how many hours the machine has? Then the answer isn't a number but a whole region of acceptable solutions. Such problems are the business of systems of equations and inequalities.