In mathematics, a quadratic equation is a univariate polynomial equation of the second degree. A general quadratic equation can be written in the form

$ax^2+bx+c=0,\,$

where x represents a variable or an unknown, and a, b, and c are constants with a ≠ 0. (If a = 0, the equation is a linear equation.)

Note: Dividing the quadratic equation by a gives the simplified monic form x2 + px + q = 0, where p = b/a and q = c/a.

The constants a, b, and c are called respectively, the quadratic coefficient, the linear coefficient and the constant term or free term.[1] Quadratic equations can be solved by factoring (or "factorising" in British English), completing the square, using the quadratic formula, and graphing.

Figure 1. Plots of quadratic function y = ax2 + bx + c, varying each coefficient separately while the other coefficients are fixed (at values a = 1, b = 0, c = 0)

Figure 2. For the quadratic function:
f (x) = x2 − x − 2 = (x + 1)(x − 2) of a real variable x, the x-coordinates of the points where the graph intersects the x-axis, x = −1 and x = 2, are the solutions of the quadratic equation: x2 − x − 2 = 0.

A quadratic equation with real or complex coefficients has two solutions, called roots. These two solutions may or may not be distinct, and they may or may not be real.

### Factoring by inspection

A quadratic equation in ax2 + bx + c = 0 form can always be expressed as a product (px + q)(rx + s) = 0. In many cases, it is possible, by simple inspection, to determine values of p, q, r, and s that will allow writing the left side of the quadratic equation in factored form. If the quadratic equation is written in factored form, then the "Zero Factor Property" states that the quadratic equation is satisfied if px + q = 0 or rx + s = 0. Solving these two linear equations provides the roots of the quadratic.

For most students, factoring by inspection is the first method of solving quadratic equations to which they are exposed.[2]:202–207 If one is given a quadratic equation in monic form, x2 + bx + c = 0, one would seek to find two numbers that add up to b and whose product is c ("Viete's Rule"). The more general case where a ≠ 1 can require a considerable effort in trial and error guess-and-check, assuming that it can be factored at all by inspection.

Except for special cases such as where b = 0 or c = 0, factoring by inspection only works for quadratic equations that have rational roots. This means that the great majority of quadratic equations that arise in practical applications cannot be solved by factoring by inspection.[2]:207

### Completing the square

Completing the square makes use of the algebraic identity:

$x^2+2xh+h^2 = (x+h)^2.\,\!$

It represents a well-defined algorithm that can be used to solve any quadratic equation.[2]:207 Starting with a quadratic equation in standard form, ax2 + bx + c = 0:

1. Divide each side by a, the coefficient of x.
2. Rearrange the equation so that the constant term c/a is on the right side.
3. Add the square of one-half of b/a, the coefficient of x, to both sides. This "completes the square", converting the left side into a perfect square.
4. Write the left side as a square, and simplify the right side, if necessary.
5. Produce two linear equations by equating the square root of the left side with the positive and negative square roots of the right side.
6. Solve the two linear equations.

We illustrate use of this algorithm by solving 2x2 + 4x − 4 = 0:

1. x2 + 2x − 2 = 0
2. x2 + 2x = 2
3. x2 + 2x + 1 = 1 + 2
4. (x + 1)2 = 3
5. x + 1 = ±√
6. x = −1 ± √

### Derivation of the quadratic formula

Completing the square can be used to derive a general formula for solving quadratic equations, the quadratic formula.[3]

$ax^2+bx+c=0 \,\!$

by a (which is allowed because a is non-zero), gives:

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

or

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

The quadratic equation is now in a form to which the method of completing the square can be applied. To "complete the square" is to add a constant to both sides of the equation such that the left hand side becomes a complete square:

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

which produces

$\left(x+\frac{b}{2a}\right)^2=-\frac{c}{a}+\frac{b^2}{4a^2}.\,\!$

The right side can be written as a single fraction, with common denominator 4a2. This gives

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

Taking the square root of both sides yields

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

Isolating x, gives

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

The symbol "±" indicates that both

$x=\frac{-b + \sqrt {b^2-4ac}}{2a}\quad\text{and}\quad x=\frac{-b - \sqrt {b^2-4ac}}{2a}$

are solutions of the quadratic equation.[4]

Note: Some sources, particularly older ones, use alternative parameterizations such as ax2 − 2bx + c = 0 [5] or ax2 + 2bx + c = 0, [6] where b has a magnitude one half of the more common one. These result in slightly different forms for the roots and discriminant, but are otherwise equivalent.

### Discriminant

Figure 3. Discriminant signs

In the above formula, the expression underneath the square root sign is called the discriminant of the quadratic equation, and is often represented using an upper case D or an upper case Greek delta:[7]

$\Delta = b^2 - 4ac\,$

A quadratic equation with real coefficients can have either one or two distinct real roots, or two distinct complex roots. In this case the discriminant determines the number and nature of the roots. There are three cases:

• If the discriminant is positive, then there are two distinct roots
$\frac{-b + \sqrt {\Delta}}{2a} \quad\text{and}\quad \frac{-b - \sqrt {\Delta}}{2a},$
both of which are real numbers.
For quadratic equations with rational coefficients, if the discriminant is a square number, then the roots are rational—in other cases they may be quadratic irrationals.
• If the discriminant is zero, then there is exactly one real root
$-\frac{b}{2a} , \,$
sometimes called a double root.
• If the discriminant is negative, then there are no real roots. Rather, there are two distinct (non-real) complex roots[8]
$\frac{-b}{2a} + i \frac{\sqrt {-\Delta}}{2a} \quad\text{and}\quad \frac{-b}{2a} - i \frac{\sqrt {-\Delta}}{2a},$
which are complex conjugates of each other. In these expressions i is the imaginary unit.

Thus the roots are distinct if and only if the discriminant is non-zero, and the roots are real if and only if the discriminant is non-negative.

### Geometric interpretation

The function $f(x) = ax^2+bx+c$ is the quadratic function.[9] The graph of any quadratic function has the same general shape, which is called a parabola. The location and size of the parabola, and how it opens, depends on the values of a, b, and c. As shown in Fig. 1, if a > 0, the parabola has a minimum point and opens upward. If a < 0, the parabola has a maximum point and opens downward. The extreme point of the parabola, whether minimum or maximum, corresponds to its vertex. The x-coordinate of the vertex will be located at $\scriptstyle x=\tfrac{-b}{2a}$, and the y-coordinate of the vertex may be found by substituting this x-value into the function. The y-intercept is located at the point (0,c).

The solutions of the quadratic equation ax2 + bx + c = 0 correspond to the roots of the function f(x) = ax2 + bx + c, since they are the values of x for which

$f(x) = 0.\,$

As shown in Fig. 2, if a, b, and c are real numbers and the domain of f is the set of real numbers, then the roots of f are exactly the x-coordinates of the points where the graph touches the x-axis. As shown in Fig. 3, if the discriminant is positive, the graph touches the x-axis at two points, if zero, the graph touches at one point, and if negative, the graph does not touch the x-axis.

The term

$x - r\,$

is a factor of the polynomial

$ax^2+bx+c, \$

if and only if r is a root of the quadratic equation

$ax^2+bx+c=0. \$

It follows from the quadratic formula that

$ax^2+bx+c = a \left( x - \frac{-b + \sqrt {b^2-4ac}}{2a} \right) \left( x - \frac{-b - \sqrt {b^2-4ac}}{2a} \right).$

In the special case ($b^2 = 4ac$) where the quadratic has only one distinct root (i.e. the discriminant is zero), the quadratic polynomial can be factored as

$ax^2+bx+c = a \left( x + \frac{b}{2a} \right)^2.\,\!$

### Graphing for real roots

Figure 4. Graphing calculator computation of one of the two roots of the quadratic equation 2x2 + 4x − 4 = 0. Although the display shows only five significant figures of accuracy, the retrieved value of xc is 0.732050807569, accurate to twelve significant figures.

For most of the twentieth century, graphing was rarely mentioned as a method for solving quadratic equations in high school or college algebra texts. Students learned to solve quadratic equations by factoring, completing the square, and applying the quadratic formula. Nowadays, with graphing calculators almost ubiquitous in schools, graphical methods of solution do show up in textbooks, but even so are usually not highly emphasized.[10]

Being able to use a graphing calculator to solve a quadratic equation requires the ability to produce a graph of y = f(x), the ability to scale the graph appropriately to the dimensions of the graphing surface, and the recognition that when f(x) = 0, x is a solution to the equation. The skills required to solve a quadratic equation on a calculator are in fact applicable to finding the real roots of any arbitrary function.

Since an arbitrary function may cross the x-axis at multiple points, graphing calculators generally require one to identify the desired root by positioning a cursor at a "guessed" value for the root. (Some graphing calculators require bracketing the root on both sides of the zero.) The calculator then proceeds, by an iterative algorithm, to refine the estimated position of the root to the limit of calculator accuracy.

### Avoiding loss of significance

Although the quadratic formula provides what in principle should be an exact solution, it does not, from a numerical analysis standpoint, provide a completely stable method for evaluating the roots of a quadratic equation. If the two roots of the quadratic equation vary greatly in absolute magnitude, b will be very close in magnitude to $\sqrt{b^2-4ac}$, and the subtraction of two nearly equal numbers will cause loss of significance or catastrophic cancellation.

To avoid cancellation problems, a variant form of the quadratic formula can be employed where only numbers of the same sign are added:

\begin{align} x_1 &= \frac{-b - \sgn (b) \,\sqrt {b^2-4ac}}{2a}, \\ x_2 &= \frac{2c}{-b - \sgn (b) \,\sqrt {b^2-4ac}} = \frac{c}{ax_1}. \end{align}

Here sgn denotes the sign function, where sgn(b) is 1 if b is positive and −1 if b is negative.

To illustrate the instability of the standard quadratic formula versus this variant formula, consider a quadratic equation with roots 1.786737589984535 and 1.149782767465722×10-8. To sixteen significant figures, roughly corresponding to double-precision accuracy on a computer, the monic quadratic equation with these roots may be written as:

x2 − 1.786737601482363x + 2.054360090947453×10−8 = 0

Using the standard quadratic formula and maintaining sixteen significant figures at each step, the standard quadratic formula yields

Δ  = 1.786737578486707
x1 = (1.786737601482363 + 1.786737578486707) / 2 = 1.786737589984535
x2 = (1.786737601482363 − 1.786737578486707) / 2 = 0.000000011497828

Note how cancellation has resulted in x2 being computed to only eight significant digits of accuracy. The variant formula presented here, however, yields the following:

x1 = (1.786737601482363 + 1.786737578486707) / 2 = 1.786737589984535
x2 = 2.054360090947453×10−8 / 1.786737589984535 = 1.149782767465722×10−8

Note the retention of all significant digits for x2.

Although the method described here represents an improvement over the standard quadratic formula, it does not resolve all issues associated with loss of significance.[11] See the Floating-point implementation section for a description of how solution of the quadratic equation would be implemented in a carefully written computer program.

## History

Babylonian mathematicians, as early as 2000 BC (displayed on Old Babylonian clay tablets) could solve problems relating the areas and sides of rectangles. In modern notation, the problems typically involved solving a pair of simultaneous equations of the form:

$x+y=p,\ \ xy=q \$

which are equivalent to the equation:[12]:86

$\ x^2+q=px$

The steps given by Babylonian scribes for solving the above rectangle problem were as follows:

1. Compute half of p.
2. Square the result.
3. Subtract q.
4. Find the square root using a table of squares.
5. Add together the results of steps (1) and (4) to give x.

Note that step (5) is essentially equivalent to calculating

$x = \frac{p}{2} + \sqrt{\left(\frac{p}{2}\right)^2 - q}$

There is evidence dating this algorithm as far back as the Ur III dynasty.[13]

In the Sulba Sutras in ancient India circa 8th century BC quadratic equations of the form ax2 = c and ax2 + bx = c were explored using geometric methods. Babylonian mathematicians from circa 400 BC and Chinese mathematicians from circa 200 BC used geometric methods of dissection to solve quadratic equations with positive roots, but do not appear to have had a general formula.[14][15]

Euclid, the Greek mathematician, produced a more abstract geometrical method around 300 BC. Pythagoras and Euclid used a strictly geometric approach, and found a general procedure to solve the quadratic equation. In his work Arithmetica, the Greek mathematician Diophantus solved the quadratic equation, but giving only one root, even when both roots were positive.[16]

In 628 AD, Brahmagupta, an Indian mathematician, gave the first explicit (although still not completely general) solution of the quadratic equation

$\ ax^2+bx=c \,$

as follows:

To the absolute number multiplied by four times the [coefficient of the] square, add the square of the [coefficient of the] middle term; the square root of the same, less the [coefficient of the] middle term, being divided by twice the [coefficient of the] square is the value. (Brahmasphutasiddhanta, Colebrook translation, 1817, page 346)[12]:87

This is equivalent to:

$x = \frac{\sqrt{4ac+b^2}-b}{2a}.$

The Bakhshali Manuscript written in India in the 7th century AD contained an algebraic formula for solving quadratic equations, as well as quadratic indeterminate equations (originally of type ax/c = y).

Muhammad ibn Musa al-Khwarizmi (Persia, 9th century), inspired by Brahmagupta, developed a set of formulas that worked for positive solutions. Al-Khwarizmi goes further in providing a full solution to the general quadratic equation, accepting one or two numerical answers for every quadratic equation, while providing geometric proofs in the process.[17] He also described the method of completing the square and recognized that the discriminant must be positive,[17][18]:230 which was proven by his contemporary 'Abd al-Hamīd ibn Turk (Central Asia, 9th century) who gave geometric figures to prove that if the discriminant is negative, a quadratic equation has no solution.[18]:234 While al-Khwarizmi himself did not accept negative solutions, later Islamic mathematicians that succeeded him accepted negative solutions,[17]:191 as well as irrational numbers as solutions.[19] Abū Kāmil Shujā ibn Aslam (Egypt, 10th century) in particular was the first to accept irrational numbers (often in the form of a square root, cube root or fourth root) as solutions to quadratic equations or as coefficients in an equation.[20]

The Indian mathematician Sridhara, who flourished in the 9th and 10th centuries AC provided the modern solution of the quadratic equation.

The Jewish mathematician Abraham bar Hiyya Ha-Nasi (12th century, Spain) authored the first European book to include the full solution to the general quadratic equation.[21] His solution was largely based on Al-Khwarizmi's work.[17]} The writing of the Chinese mathematician Yang Hui (1238-1298 AD) represents the first in which quadratic equations with negative coefficients of 'x' appear, although he attributes this to the earlier Liu Yi.

By 1545 Gerolamo Cardano compiled the works related to the quadratic equations. The quadratic formula covering all cases was first obtained by Simon Stevin in 1594.[22] In 1637 René Descartes published La Géométrie containing the quadratic formula in the form we know today. The first appearance of the general solution in the modern mathematical literature appeared in a 1896 paper by Henry Heaton.[23]

### Other derivations of the quadratic formula

A number of alternative derivations of the quadratic formula can be found in the literature which either (a) are simpler than the standard completing the square method, (b) represent interesting applications of other frequently-used techniques in algebra, or (c) offer insight into other areas of mathematics.

#### Using an alternate method of completing the square

The great majority of algebra texts published over the last several decades teach completing the square using the sequence presented earlier: (1) divide each side by a, (2) rearrange, (3) then add the square of one-half of b/a.

However, as pointed out by Hoehn (1975), completing the square can accomplished by a different sequence that leads to a simpler sequence of intermediate terms: (1) multiply each side by 4a, (2) rearrange, (3) then add b2.[24]

In other words, the quadratic formula can be derived as follows:

$ax^2+bx+c=0$
$4 a^2 x^2 + 4abx + 4ac=0$
$4 a^2 x^2 + 4abx = -4ac$
$4 a^2 x^2 + 4abx + b^2 = b^2 - 4ac$
$(2ax + b)^2 = b^2 - 4ac$
$2ax + b = \pm \sqrt{b^2-4ac}$
$2ax = -b \pm \sqrt{b^2-4ac}$
$x=\frac{-b\pm\sqrt{b^2-4ac\ }}{2a}$

This actually represents an ancient derivation of the quadratic formula, and was known to the Hindus at least as far back as 1025 A.D.[25] Compared with the derivation in standard usage, this alternate derivation is shorter, involves fewer computations with literal coefficients, avoids fractions until the last step, has simpler expressions, and uses simpler math. As Hoehn states, "it is easier 'to add the square of b' than it is 'to add the square of half the coeffient of the x term'".[24]

#### By Lagrange resolvents

An alternative way of deriving the quadratic formula is via the method of Lagrange resolvents, which is an early part of Galois theory.[26] This method can be generalized to give the roots of cubic polynomials and quartic polynomials, and leads to Galois theory, which allows one to understand the solution of algebraic equations of any degree in terms of the symmetry group of their roots, the Galois group.

This approach focuses on the roots more than on rearranging the original equation. Given a monic quadratic polynomial

$x^2+px+q,\!$

assume that it factors as

$x^2+px+q=(x-\alpha)(x-\beta).\!$

Expanding yields

$x^2+px+q=x^2-(\alpha+\beta)x+\alpha \beta,\!$

where

$p=-(\alpha+\beta)\!$

and

$q=\alpha \beta.\!$

Since the order of multiplication does not matter, one can switch α and β and the values of p and q will not change: one says that p and q are symmetric polynomials in α and β. In fact, they are the elementary symmetric polynomials – any symmetric polynomial in α and β can be expressed in terms of α + β and αβ. The Galois theory approach to analyzing and solving polynomials is: given the coefficients of a polynomial, which are symmetric functions in the roots, can one "break the symmetry" and recover the roots? Thus solving a polynomial of degree n is related to the ways of rearranging ("permuting") n terms, which is called the symmetric group on n letters, and denoted $S_n.$ For the quadratic polynomial, the only way to rearrange two terms is to swap them ("transpose" them), and thus solving a quadratic polynomial is simple.

To find the roots α and β, consider their sum and difference:

\begin{align} r_1 &= \alpha + \beta\\ r_2 &= \alpha - \beta. \end{align}

These are called the Lagrange resolvents of the polynomial; notice that one of these depends on the order of the roots, which is the key point. One can recover the roots from the resolvents by inverting the above equations:

\begin{align} \alpha &= \textstyle{\frac{1}{2}}\left(r_1+r_2\right)\\ \beta &= \textstyle{\frac{1}{2}}\left(r_1-r_2\right). \end{align}

Thus, solving for the resolvents gives the original roots.

Formally, the resolvents are called the discrete Fourier transform (DFT) of order 2, and the transform can be expressed by the matrix $\left(\begin{smallmatrix}1 & 1\\ 1 & -1\end{smallmatrix}\right),$ with inverse matrix $\left(\begin{smallmatrix}1/2 & 1/2\\ 1/2 & -1/2\end{smallmatrix}\right).$ The transform matrix is also called the DFT matrix or Vandermonde matrix.

Now $r_1=\alpha + \beta$ is a symmetric function in α and β, so it can be expressed in terms of p and q, and in fact $r_1 = -p,$ as noted above. But $r_2=\alpha - \beta$ is not symmetric, since switching α and β yields $-r_2=\beta - \alpha$ (formally, this is termed a group action of the symmetric group of the roots). Since $r_2$ is not symmetric, it cannot be expressed in terms of the polynomials p and q, as these are symmetric in the roots and thus so is any polynomial expression involving them. However, changing the order of the roots only changes $r_2$ by a factor of $-1,$ and thus the square $\scriptstyle r_2^2 = (\alpha - \beta)^2$ is symmetric in the roots, and thus expressible in terms of p and q. Using the equation

$(\alpha - \beta)^2 = (\alpha + \beta)^2 - 4\alpha\beta\!$

yields

$r_2^2 = p^2 - 4q\!$

and thus

$r_2 = \pm \sqrt{p^2 - 4q}.\!$

If one takes the positive root, breaking symmetry, one obtains:

\begin{align} r_1 &= -p\\ r_2 &= \sqrt{p^2 - 4q} \end{align}

and thus

\begin{align} \alpha &= \textstyle{\frac{1}{2}}\left(-p+\sqrt{p^2 - 4q}\right)\\ \beta &= \textstyle{\frac{1}{2}}\left(-p-\sqrt{p^2 - 4q}\right) \end{align}

Thus the roots are

$\textstyle{\frac{1}{2}}\left(-p \pm \sqrt{p^2 - 4q}\right)$

which is the quadratic formula. Substituting $\scriptstyle p=\tfrac{b}{a}, q=\tfrac{c}{a}\!$ yields the usual form for when a quadratic is not monic. The resolvents can be recognized as $\scriptstyle \frac{r_1}{2} = \frac{-p}{2}=\frac{-b}{2a}\!$ being the vertex, and $\scriptstyle r_2^2=p^2-4q\!$ is the discriminant (of a monic polynomial).

A similar but more complicated method works for cubic equations, where one has three resolvents and a quadratic equation (the "resolving polynomial") relating $r_2$ and $r_3,$ which one can solve by the quadratic equation, and similarly for a quartic (degree 4) equation, whose resolving polynomial is a cubic, which can in turn be solved. However, the same method for a quintic equation yields a polynomial of degree 24, which does not simplify the problem, and in fact solutions to quintic equations in general cannot be expressed using only roots.

### Other methods of root calculation

In some situations it is preferable to express the roots in an alternative form.

$x =\frac{2c}{-b \mp \sqrt {b^2-4ac\ }} = \frac{2c}{-b \mp \sqrt \Delta}.$

This alternative requires c to be nonzero; for, if c is zero, the formula correctly gives zero as one root, but fails to give any second, non-zero root. Instead, one of the two choices for ∓ produces the indeterminate form 0/0, which is undefined. However, the alternative form works when a is zero (giving the unique solution as one root and division by zero again for the other), which the normal form does not (instead producing division by zero both times).

The roots are the same regardless of which expression we use; the alternative form is merely an algebraic variation of the common form:

\begin{align} \frac{-b \pm \sqrt {b^2-4ac\ }}{2a} &{}= \frac{-b \pm \sqrt {b^2-4ac\ }}{2a} \cdot \frac{-b \mp \sqrt {b^2-4ac\ }}{-b \mp \sqrt {b^2-4ac\ }} \\ &{}= \frac{b^2 - (b^2 - 4ac)}{2a \left ( -b \mp \sqrt {b^2-4ac} \right ) } \\ &{}= \frac{4ac}{2a \left ( -b \mp \sqrt {b^2-4ac} \right ) } \\ &{}=\frac{2c}{-b \mp \sqrt {b^2-4ac\ }}. \end{align}

#### Floating-point implementation

A careful floating point computer implementation combines several strategies to produce a robust result. Assuming the discriminant, b2 − 4ac, is positive and b is nonzero, the code will be something like the following:[27]

$q = -\tfrac12 \left( b + \sgn(b) \sqrt{b^2-4ac} \right) \,\!$
$x_1 = q/a \,\!$
$x_2 = c/q \,\!$

Here sgn(b) is the sign function, where sgn(b) is 1 if b is positive and −1 if b is negative; its use ensures that the quantities added are of the same sign, avoiding catastrophic cancellation. The computation of x2 uses the fact that the product of the roots is c/a. Note that while the above formulation avoids catastrophic cancellation between b and $\sqrt{b^2-4ac}$, there remains a form of cancellation between the terms b2 and −4ac of the discriminant, which can still lead to loss of up to half of correct significant figures.[5][11] The discriminant b2−4ac needs to be computed in arithmetic of twice the precision of the result to avoid this (e.g. quad precision if the final result is to be accurate to full double precision).[28] This can be in the form of a fused multiply-add operation.[5]

To illustrate this, consider the following quadratic equation, adapted from Kahan (2004):[5]

94906265.625x2 − 189812534x + 94906268.375

This equation has Δ = 7.5625 and has roots

x1 = 1.000000028975958
x2 = 1.000000000000000.

However, when computed using IEEE 754 double-precision arithmetic corresponding to 15 to 17 significant digits of accuracy, Δ is rounded to 0.0, and the computed roots are

x1 = 1.000000014487979
x2 = 1.000000014487979

which are both false after the eighth significant digit. This is despite the fact that superficially, the problem seems to require only eleven significant digits of accuracy for its solution.

#### Vieta's formulas

Vieta's formulas give a simple relation between the roots of a polynomial and its coefficients. In the case of the quadratic polynomial, they take the following form:

$x_1 + x_2 = -\frac{b}{a}$

and

$x_1 \ x_2 = \frac{c}{a}.$

These results follow immediately from the relation:

$\left( x - x_1 \right) \ \left( x-x_2 \right ) = x^2 \ - \left( x_1+x_2 \right)x +x_1 \ x_2 \ = 0 \ ,$

which can be compared term by term with:

$x^2 + (b/a)x +c/a = 0 \ .$

The first formula above yields a convenient expression when graphing a quadratic function. Since the graph is symmetric with respect to a vertical line through the vertex, when there are two real roots the vertex’s x-coordinate is located at the average of the roots (or intercepts). Thus the x-coordinate of the vertex is given by the expression:

$x_V = \frac {x_1 + x_2} {2} = -\frac{b}{2a}.$

The y-coordinate can be obtained by substituting the above result into the given quadratic equation, giving

$y_V = - \frac{b^2}{4a} + c = - \frac{ b^2 - 4ac} {4a}.$
Figure 5. Graph of two evaluations of the smallest root of a quadratic: direct evaluation using the quadratic formula (accurate at smaller b) and an approximation for widely spaced roots (accurate for larger b). The difference reaches a minimum at the large dots, and rounding causes squiggles in the curves beyond this minimum.

As a practical matter, Vieta's formulas provide a useful method for finding the roots of a quadratic in the case where one root is much smaller than the other. If |x2| << |x1|, then x1 + x2x1, and we have the estimate:

$x_1 \approx -\frac{b}{a} \ .$

The second Vieta's formula then provides:

$x_2 = \frac{c}{a \ x_1} \approx -\frac{c}{b} \ .$

These formulas are much easier to evaluate than the quadratic formula under the condition of one large and one small root, because the quadratic formula evaluates the small root as the difference of two very nearly equal numbers (the case of large b), which causes round-off error in a numerical evaluation. The figure shows the difference between (i) a direct evaluation using the quadratic formula (accurate when the roots are near each other in value) and (ii) an evaluation based upon the above approximation of Vieta's formulas (accurate when the roots are widely spaced). As the linear coefficient b increases, initially the quadratic formula is accurate, and the approximate formula improves in accuracy, leading to a smaller difference between the methods as b increases. However, at some point the quadratic formula begins to lose accuracy because of round off error, while the approximate method continues to improve. Consequently the difference between the methods begins to increase as the quadratic formula becomes worse and worse.

This situation arises commonly in amplifier design, where widely separated roots are desired to ensure a stable operation (see step response).

#### Trigonometric solution

In the days before calculators, people would use mathematical tables—lists of numbers showing the results of calculation with varying arguments—to simplify and speed up computation. Tables of logarithms and trigonometric functions were common in math and science textbooks. Specialized tables were published for applications such as astronomy, celestial navigation and statistics. Methods of numerical approximation existed, called prosthaphaeresis, that offered shortcuts around time-consuming operations such as multiplication and taking powers and roots.[10] Astronomers, especially, were concerned with methods that could speed up the long series of computations involved in celestial mechanics calculations.

It is within this context that we may understand the development of means of solving quadratic equations by the aid of trigonometric substitution. Consider the following alternate form of the quadratic equation,

[1]   $ax^2 + bx \pm c = 0 ,$

where the sign of the ± symbol is chosen so that a and c may both be positive. By substituting

[2]   $x = \sqrt{c/a} \tan\theta$

and then multiplying through by cos2θ, we obtain

[3]   $\sin^2\theta + \frac{b}{\sqrt {ac}} \sin\theta \cos\theta \pm \cos^2\theta = 0 .$

Introducing functions of 2θ and rearranging, we obtain

[4]   $\tan 2 \theta_n = + 2 \frac{\sqrt{ac}}{b} ,$

[5]   $\sin 2 \theta_p = - 2 \frac{\sqrt{ac}}{b} ,$

where the subscripts n and p correspond, respectively, to the use of a negative or positive sign in equation [1]. Substituting the two values of θn or θp found from equations [4] or [5] into [2] gives the required roots of [1]. Complex roots occur in the solution based on equation [5] if the absolute value of sin 2θp exceeds unity. The amount of effort involved in solving quadratic equations using this mixed trigonometric and logarithmic table look-up strategy was two-thirds the effort using logarithmic tables alone.[29] Calculating complex roots would require using a different trigonometric form.[30]

To illustrate, let us assume we had available seven-place logarithm and trigonometric tables, and wished to solve the following to six-significant-figure accuracy:
4.16130x2 + 9.15933x − 11.4207 = 0
1. A seven-place lookup table might have only 100,000 entries, and computing intermediate results to seven places would generally require interpolation between adjacent entries.
2. log a = 0.6192290, log b = 0.9618637, log c = 1.0576927
3. 2√ac /b = 2×10((0.6192290 + 1.0576927)/2 − 0.9618637) = 1.505314
4. θ = (tan−11.505314) / 2 = 54.40339° / 2 or (54.40339° − 180°) / 2 = 28.20169° or −61.79831°
5. log | tan θ | = −0.2706462 or 0.2706462
6. log√c/a  = (1.0576927 − 0.6192290) / 2 = 0.2192318
7. x1 = 10(0. 2192318 − 0.2706462) = 0.888353 (rounded to six significant figures)
x2 = −10(0.2192318 + 0.2706462) = −3.08943

#### Geometric solution

Figure 6. Geometric solution of ax2+bx+c using Lill's method. Solutions are −AX1/SA, −AX2/SA

The quadratic equation may be solved geometrically in a number of ways. One way is via Lill's method. The three coefficients a, b, c are drawn with right angles between them as in SA, AB, and BC in the accompanying diagram. A circle is drawn with the start and end point SC as a diameter. If this cuts the middle line AB of the three then the equation has a solution, and the solutions are given by negative of the distance along this line from A divided by the first coefficient a or SA. If a is 1 the coefficients may be read off directly. Thus the solutions in the diagram are −AX1/SA and −AX2/SA.[31]

The formula and its derivation remain correct if the coefficients a, b and c are complex numbers, or more generally members of any field whose characteristic is not 2. (In a field of characteristic 2, the element 2a is zero and it is impossible to divide by it.)

The symbol

$\pm \sqrt {b^2-4ac}$

in the formula should be understood as "either of the two elements whose square is b2 − 4ac, if such elements exist". In some fields, some elements have no square roots and some have two; only zero has just one square root, except in fields of characteristic 2. Note that even if a field does not contain a square root of some number, there is always a quadratic extension field which does, so the quadratic formula will always make sense as a formula in that extension field.

#### Characteristic 2

In a field of characteristic 2, the quadratic formula, which relies on 2 being a unit, does not hold. Consider the monic quadratic polynomial

$\displaystyle x^{2} + bx + c$

over a field of characteristic 2. If b = 0, then the solution reduces to extracting a square root, so the solution is

$\displaystyle x = \sqrt{c}$

and note that there is only one root since

$\displaystyle -\sqrt{c} = -\sqrt{c} + 2\sqrt{c} = \sqrt{c}.$

In summary,

$\displaystyle x^{2} + c = (x + \sqrt{c})^{2}.$

In the case that b ≠ 0, there are two distinct roots, but if the polynomial is irreducible, they cannot be expressed in terms of square roots of numbers in the coefficient field. Instead, define the 2-root R(c) of c to be a root of the polynomial x2 + x + c, an element of the splitting field of that polynomial. One verifies that R(c) + 1 is also a root. In terms of the 2-root operation, the two roots of the (non-monic) quadratic ax2 + bx + c are

$\frac{b}{a}R\left(\frac{ac}{b^2}\right)$

and

$\frac{b}{a}\left(R\left(\frac{ac}{b^2}\right)+1\right).$

For example, let a denote a multiplicative generator of the group of units of F4, the Galois field of order four (thus a and a + 1 are roots of x2 + x + 1 over F4). Because (a + 1)2 = a, a + 1 is the unique solution of the quadratic equation x2 + a = 0. On the other hand, the polynomial x2 + ax + 1 is irreducible over F4, but it splits over F16, where it has the two roots ab and ab + a, where b is a root of x2 + x + a in F16.

This is a special case of Artin-Schreier theory.

## References

1. ^ The term "quadratic" comes from quadratus, which is the Latin word for "square".
2. ^ a b c Washington, Allyn J. (2000). Basic Technical Mathematics with Calculus, Seventh Edition. Addison Wesley Longman, Inc. ISBN 0-201-35666-X.
3. ^ Rich, Barnett; Schmidt, Philip (2004), Schaum's Outline of Theory and Problems of ELEMENTARY ALGEBRA, The McGraw-Hill Companies, ISBN 0-07-141083-X, Chapter 13 §4.4, p. 291
4. ^ Sterling, Mary Jane (2010), Algebra I For Dummies, Wiley Publishing, p. 219, ISBN 978-0-470-55964-2
5. ^ a b c d Kahan, Willian (November 20, 2004), On the Cost of Floating-Point Computation Without Extra-Precise Arithmetic, retrieved 2012-12-25
6. ^ "Quadratic Equation", Proof Wiki, retrieved 2012-12-25
7. ^ Δ is the initial of the Greek word Διακρίνουσα, Diakrínousa, discriminant.
8. ^ Achatz, Thomas; Anderson, John G.; McKenzie, Kathleen (2005). Technical Shop Mathematics. Industrial Press. p. 277. ISBN 0-8311-3086-5.
9. ^ Wharton, P. (2006). Essentials of Edexcel Gcse Math/Higher. Lonsdale. p. 63. ISBN 978-1-905-129-78-2.
10. ^ a b Ballew, Pat. "Solving Quadratic Equations — By analytic and graphic methods; Including several methods you may never have seen". Retrieved 18 April 2013.
11. ^ a b Higham, Nicholas (2002), Accuracy and Stability of Numerical Algorithms (2nd ed.), SIAM, p. 10, ISBN 978-0-89871-521-7
12. ^ a b Stillwell, John (2004). Mathematics and Its History (2nd ed.). Springer. ISBN 0-387-95336-1.
13. ^ Friberg, Jöran (2009). "A Geometric Algorithm with Solutions to Quadratic Equations in a Sumerian Juridical Document from Ur III Umma". Cuneiform Digital Library Journal 3.
14. ^ Aitken, Wayne. "A Chinese Classic: The Nine Chapters". Mathematics Department, California State University. Retrieved 28 April 2013.
15. ^ Henderson, David W. "Geometric Solutions of Quadratic and Cubic Equations". Mathematics Department, Cornell University. Retrieved 28 April 2013.
16. ^ David Eugene Smith (1958). "History of mathematics". Courier Dover Publications. p.134. ISBN 0-486-20429-4
17. ^ a b c d Katz, V. J.; Barton, B. (2006). "Stages in the History of Algebra with Implications for Teaching". Educational Studies in Mathematics 66 (2): 185–201. doi:10.1007/s10649-006-9023-7. edit
18. ^ a b Boyer, Carl B.; Uta C. Merzbach, rev. editor (1991). A History of Mathematics. John Wiley & Sons, Inc. ISBN 0-471-54397-7.
19. ^ . "Algebra was a unifying theory which allowed rational numbers, irrational numbers, geometrical magnitudes, etc., to all be treated as "algebraic objects"."
20. ^ Jacques Sesiano, "Islamic mathematics", p. 148, in Selin, Helaine; D'Ambrosio, Ubiratan, eds. (2000), Mathematics Across Cultures: The History of Non-Western Mathematics, Springer, ISBN 1-4020-0260-2
21. ^ Livio, Mario (2006). The Equation that Couldn't Be Solved. Simon & Schuster. ISBN 0743258215.
22. ^ Struik, D. J.; Stevin, Simon (1958), The Principal Works of Simon Stevin, Mathematics II–B, C. V. Swets & Zeitlinger, p. 470
23. ^ Heaton, H. (1896) A Method of Solving Quadratic Equations, American Mathematical Monthly 3(10), 236–237.
24. ^ a b Hoehn, Larry (1975). "A More Elegant Method of Deriving the Quadratic Formula". The Mathematics Teacher 68 (5): 442–443.
25. ^ Smith, David E. (1958). History of Mathematics, Vol. II. Dover Publications. p. 446. ISBN 0486204308.
26. ^ Prasolov, Viktor; Solovyev, Yuri (1997), Elliptic functions and elliptic integrals, AMS Bookstore, ISBN 978-0-8218-0587-9, §6.2, p. 134
27. ^ Press, William H.; Flannery, Brian P.; Teukolsky, Saul A.; Vetterling, William T. (1992), Numerical Recipes in C (Second ed.), Section 5.6: "Quadratic and Cubic Equations.
28. ^ Hough, David (March 1981), "Applications of the proposed IEEE 754 standard for floating point arithmetic", IEEE Computer 14 (3): 70–74, doi:10.1109/C-M.1981.220381.
29. ^ Seares, F. H. (1945). "Trigonometric Solution of the Quadratic Equation". Publications of the Astronomical Society of the Pacific 57 (339): 307–309. Retrieved 18 April 2013.
30. ^ Aude, H. T. R. (1938). "The Solutions of the Quadratic Equation Obtained by the Aid of the Trigonometry". National Mathematics Magazine 13 (3): 118–121. Retrieved 20 April 2013.
31. ^ Bixby, William Herbert (1879), Graphical Method for finding readily the Real Roots of Numerical Equations of Any Degree, West Point N. Y.