Definitions
Nearby Words

Algebraic equation of particular importance in optimization. A more descriptive name is second-degree polynomial equation. Its standard form is math.amath.x2 + math.bmath.x + math.c = 0, and its solution is given by the quadratic formula which guarantees two real-number solutions, one real-number solution, or two complex-number solutions, depending on whether the discriminate, math.b2 − 4math.amath.c, is greater than, equal to, or less than 0.

In mathematics, a quadratic equation is a polynomial equation of the second degree. The general form is

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

where a ≠ 0. (For if a = 0, the equation becomes a linear equation.)

The letters a, b, and c are called coefficients: the quadratic coefficient a is the coefficient of x2, the linear coefficient b is the coefficient of x, and c is the constant coefficient, also called the free term or constant term.

A quadratic equation with real or complex coefficients has two, but not necessarily distinct, solutions, called roots, which may or may not be real, given by the quadratic formula:

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

where the symbol "±" indicates that both

$x_+ = frac\left\{-b + sqrt \left\{b^2-4ac\right\}\right\}\left\{2a\right\}text\left\{ and \right\}x_- = frac\left\{-b - sqrt \left\{b^2-4ac\right\}\right\}\left\{2a\right\}.$

are solutions.

## Discriminant

In the above formula, the expression underneath the square root sign:

$Delta = b^2 - 4ac , ,!$
is called the discriminant of the quadratic equation.

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, there are two distinct roots, both of which are real numbers. For quadratic equations with integer coefficients, if the discriminant is a perfect square, then the roots are rational numbers—in other cases they may be quadratic irrationals.
• If the discriminant is zero, there is exactly one distinct root, and that root is a real number. Sometimes called a double root, its value is:
• :$x = -frac\left\{b\right\}\left\{2a\right\} . ,!$
• If the discriminant is negative, there are no real roots. Rather, there are two distinct (non-real) complex roots, which are complex conjugates of each other:
• :begin\left\{align\right\}

x &= frac{-b}{2a} + i frac{sqrt {4ac - b^2}}{2a} , x &= frac{-b}{2a} - i frac{sqrt {4ac - b^2}}{2a}. end{align}

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.

## Geometry

The roots of the quadratic equation

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

are also the zeros of the quadratic function:

$f\left(x\right) = ax^2+bx+c,,$

since they are the values of x for which

$f\left(x\right) = 0.,$

If a, b, and c are real numbers and the domain of f is the set of real numbers, then the zeros of f are exactly the x-coordinates of the points where the graph touches the x-axis.

It follows from the above that, 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.

## Examples

• $7x + 15 - 2x^2 = 0$ has a strictly positive discriminant $Delta = 169$ and therefore has two real solutions:

$x_1=frac\left\{-7-sqrt\left\{169\right\}\right\}\left\{2cdot\left(-2\right)\right\}=frac\left\{-7-13\right\}\left\{-4\right\} =frac\left\{20\right\}\left\{4\right\}= 5$
and
$x_2=frac\left\{-7+sqrt\left\{169\right\}\right\}\left\{2cdot\left(-2\right)\right\} = frac\left\{-7+13\right\}\left\{-4\right\}=frac\left\{6\right\}\left\{-4\right\}=-frac\left\{3\right\}\left\{2\right\}.$

• $x^2 -2x + 1 = 0$ has a discriminant $Delta$ whose value is zero, therefore it has a double solution$x_0=-tfrac\left\{-2\right\}\left\{2\right\}=1$
• $x^2 + 3 x + 3 = 0$ has no real solution because $Delta = - 3 < 0$. But it has two complex solutions $x_1$ and $x_2$:

$x_1 = frac\left\{-3 - sqrt\left\{3\right\} i\right\}\left\{2\right\}text\left\{ and \right\}x_2 = frac\left\{-3 + sqrt\left\{3\right\} i\right\}\left\{2\right\}.$

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\left(x - frac\left\{-b + sqrt \left\{b^2-4ac\right\}\right\}\left\{2a\right\} right\right) left\left(x - frac\left\{-b - sqrt \left\{b^2-4ac\right\}\right\}\left\{2a\right\} right\right).$

In the special case 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\left(x + frac\left\{b\right\}\left\{2a\right\} right\right)^2.,!$

## Application to higher-degree equations

Certain higher-degree equations can be brought into quadratic form and solved that way. For example, the 6th-degree equation in x:
$x^6 - 4x^3 + 8 = 0,$
can be rewritten as:
$\left(x^3\right)^2 - 4\left(x^3\right) + 8 = 0,,$
or, equivalently, as a quadratic equation in a new variable u:
$u^2 - 4u + 8 = 0,,$
where
$u = x^3.,$
Solving the quadratic equation for u results in the two solutions:
$u = 2 pm 2i.$
Thus
$x^3 = 2 pm 2i,.$
Concentrating on finding the three cube roots of – the other three solutions for x will be their complex conjugates – rewriting the right-hand side using Euler's formula:
$x^3 = 2^\left\{tfrac\left\{3\right\}\left\{2\right\}\right\}e^\left\{tfrac\left\{1\right\}\left\{4\right\}pi i\right\} = 2^\left\{tfrac\left\{3\right\}\left\{2\right\}\right\}e^\left\{tfrac\left\{8k+1\right\}\left\{4\right\}pi i\right\},$
(since e2kπi = 1), gives the three solutions:
$x = 2^\left\{tfrac\left\{1\right\}\left\{2\right\}\right\}e^\left\{tfrac\left\{8k+1\right\}\left\{12\right\}pi i\right\},,~k = 0, 1, 2,.$
Using Eulers' formula again together with trigonometric identities such as cos(π/12) = , and adding the complex conjugates, gives the complete collection of solutions as:
$x_\left\{1,2\right\} = -1 pm i,,$
$x_\left\{3,4\right\} = frac\left\{1 + sqrt\left\{3\right\}\right\}\left\{2\right\} pm frac\left\{1 - sqrt\left\{3\right\}\right\}\left\{2\right\}i,$
and
$x_\left\{5,6\right\} = frac\left\{1 - sqrt\left\{3\right\}\right\}\left\{2\right\} pm frac\left\{1 + sqrt\left\{3\right\}\right\}\left\{2\right\}i.,$

## History

The Babylonians, as early as 1800 BC (displayed on Old Babylonian clay tablets) could solve a pair of simultaneous equations of the form:

$x+y=p, xy=q$

which are equivalent to the equation:

$x^2+q=px$

The original pair of equations were solved as follows:

1. Form $frac\left\{x+y\right\}\left\{2\right\}$
2. Form $left\left(frac\left\{x+y\right\}\left\{2\right\}right\right)^2$
3. Form $left\left(frac\left\{x+y\right\}\left\{2\right\}right\right)^2 - xy$
4. Form $sqrt\left\{left\left(frac\left\{x+y\right\}\left\{2\right\}right\right)^2 - xy\right\} = frac\left\{x-y\right\}\left\{2\right\}$
5. Find $x, y$ by inspection of the values in (1) and (4).

In the Sulba Sutras in ancient India circa 8th century BCE quadratic equations of the form ax2 = c and ax2 + bx = c were explored using geometric methods. Babylonian mathematicians from circa 400 BCE and Chinese mathematicians from circa 200 BCE used the method of completing the square to solve quadratic equations with positive roots, but did not have a general formula. Euclid, the Greek mathematician, produced a more abstract geometrical method around 300 BCE.

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

$ax^2+bx=c$

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)

This is equivalent to:

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

The Bakhshali Manuscript dated to have been written in India in the 7th century CE contained an algebraic formula for solving quadratic equations, as well as quadratic indeterminate equations (originally of type ax/c = y). Mohammad bin Musa Al-kwarismi (Persia, 9th century) developed a set of formulae that worked for positive solutions. His work was based on Brahmagupta. Abraham bar Hiyya Ha-Nasi (also known by the Latin name Savasorda) introduced the complete solution to Europe in his book Liber embadorum in the 12th century. Bhāskara II (11141185), an Indian mathematicianastronomer, gave the first general solution to the quadratic equation with two roots.

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.

## Derivation

The quadratic formula can be derived by the method of completing the square, so as to make use of the algebraic identity:

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

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

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

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

or

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

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 find some constant k such that

$x^2 + frac\left\{b\right\}\left\{a\right\}x + k = x^2+2xh+h^2,,!$

for another constant h. In order for these equations to be true,

$frac\left\{b\right\}\left\{a\right\} = 2h!$

or

$h = frac\left\{b\right\}\left\{2a\right\},!$
and
$k = h^2,,!$

thus

$k = frac\left\{b^2\right\}\left\{4a^2\right\}.,!$

Adding this constant to equation (1) produces

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

The left side is now a perfect square because

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

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

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

Taking the square root of both sides yields

$left|x+frac\left\{b\right\}\left\{2a\right\}right| = frac\left\{sqrt\left\{b^2-4ac \right\}\right\}$
>Rightarrow x+frac{b}{2a}=pmfrac{sqrt{b^2-4ac }}{2a}.

Isolating x, gives

$x=-frac\left\{b\right\}\left\{2a\right\}pmfrac\left\{sqrt\left\{b^2-4ac \right\}\right\}\left\{2a\right\}=frac\left\{-bpmsqrt\left\{b^2-4ac \right\}\right\}\left\{2a\right\}.$

## Alternative formula

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

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

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 a division by zero, which is undefined.

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

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

The alternative formula can reduce loss of precision in the numerical evaluation of the roots, which may be a problem if one of the roots is much smaller than the other in absolute magnitude. The problem of c possibly being zero can be avoided by using a mixed approach:

$x_1 = frac\left\{-b - sgn b ,sqrt \left\{b^2-4ac\right\}\right\}\left\{2a\right\},$
$x_2 = frac\left\{c\right\}\left\{ax_1\right\}.$

Here sgn denotes the sign function.

## Floating point implementation

A careful floating point computer implementation differs a little from both forms to produce a robust result. Assuming the discriminant, b2 − 4ac, is positive and b is nonzero, the code will be something like the following.
$t := -tfrac12 big\left(b + sgn\left(b\right) sqrt\left\{b^2-4ac\right\} big\right) ,!$
$r_1 := t/a ,!$
$r_2 := c/t ,!$

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 r2 uses the fact that the product of the roots is c/a.

See Numerical Recipes in C, Section 5.6: "Quadratic and Cubic Equations".

## Viète's formulas

Viète'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_+ + x_- = -frac\left\{b\right\}\left\{a\right\}$
and
$x_+ cdot x_- = frac\left\{c\right\}\left\{a\right\}.$

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 \left\{x_+ + x_-\right\} \left\{2\right\} = -frac\left\{b\right\}\left\{2a\right\}.$

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

$y_V = - frac\left\{b^2\right\}\left\{4a\right\} + c = - frac\left\{ b^2 - 4ac\right\} \left\{4a\right\}.$

## Generalizations

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 \left\{b^2-4ac\right\}$

in the formula should be understood as "either of the two elements whose square is

$b^2-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^\left\{2\right\} + 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\left\{c\right\}$

and note that there is only one root since

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

In summary,

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

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\left\{b\right\}\left\{a\right\}Rleft\left(frac\left\{ac\right\}\left\{b^2\right\}right\right)$
and
$frac\left\{b\right\}\left\{a\right\}left\left(Rleft\left(frac\left\{ac\right\}\left\{b^2\right\}right\right)+1right\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 x + ax + 1 is irreducible over F4, but 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.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 79, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.914080023765564, "perplexity": 470.2762104782126}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-11/segments/1424936461995.64/warc/CC-MAIN-20150226074101-00171-ip-10-28-5-156.ec2.internal.warc.gz"}