Overview
In mathematics
Mathematics
Mathematics is the study of quantity, space, structure, and change. Mathematicians seek out patterns and formulate new conjectures. Mathematicians resolve the truth or falsity of conjectures by mathematical proofs, which are arguments sufficient to convince other mathematicians of their validity...

, a quadratic equation is a univariate
Univariate
In mathematics, univariate refers to an expression, equation, function or polynomial of only one variable. Objects of any of these types but involving more than one variable may be called multivariate...

polynomial equation of the second degree
Degree of a polynomial
The degree of a polynomial represents the highest degree of a polynominal's terms , should the polynomial be expressed in canonical form . The degree of an individual term is the sum of the exponents acting on the term's variables...

. A general quadratic equation can be written in the form
Discussion

Recent Discussions
Encyclopedia
In mathematics
Mathematics
Mathematics is the study of quantity, space, structure, and change. Mathematicians seek out patterns and formulate new conjectures. Mathematicians resolve the truth or falsity of conjectures by mathematical proofs, which are arguments sufficient to convince other mathematicians of their validity...

, a quadratic equation is a univariate
Univariate
In mathematics, univariate refers to an expression, equation, function or polynomial of only one variable. Objects of any of these types but involving more than one variable may be called multivariate...

polynomial equation of the second degree
Degree of a polynomial
The degree of a polynomial represents the highest degree of a polynominal's terms , should the polynomial be expressed in canonical form . The degree of an individual term is the sum of the exponents acting on the term's variables...

. A general quadratic equation can be written in the form

where x represents a variable
Variable (mathematics)
In mathematics, a variable is a value that may change within the scope of a given problem or set of operations. In contrast, a constant is a value that remains unchanged, though often unknown or undetermined. The concepts of constants and variables are fundamental to many areas of mathematics and...

or an unknown, and a, b, and c are constant
Constant term
In mathematics, a constant term is a term in an algebraic expression has a value that is constant or cannot change, because it does not contain any modifiable variables. For example, in the quadratic polynomialx^2 + 2x + 3,\ the 3 is a constant term....

s with a ≠ 0. (If a = 0, the equation is a linear equation
Linear equation
A linear equation is an algebraic equation in which each term is either a constant or the product of a constant and a single variable....

.)

The constants a, b, and c are called respectively, the quadratic coefficient
Coefficient
In mathematics, a coefficient is a multiplicative factor in some term of an expression ; it is usually a number, but in any case does not involve any variables of the expression...

, the linear coefficient and the constant term
Constant term
In mathematics, a constant term is a term in an algebraic expression has a value that is constant or cannot change, because it does not contain any modifiable variables. For example, in the quadratic polynomialx^2 + 2x + 3,\ the 3 is a constant term....

or free term. The term "quadratic" comes from quadratus, which is the Latin
Latin
Latin is an Italic language originally spoken in Latium and Ancient Rome. It, along with most European languages, is a descendant of the ancient Proto-Indo-European language. Although it is considered a dead language, a number of scholars and members of the Christian clergy speak it fluently, and...

word for "square". Quadratic equations can be solved by factoring
Factorization
In mathematics, factorization or factoring is the decomposition of an object into a product of other objects, or factors, which when multiplied together give the original...

, completing the square
Completing the square
In elementary algebra, completing the square is a technique for converting a quadratic polynomial of the formax^2 + bx + c\,\!to the formIn this context, "constant" means not depending on x. The expression inside the parenthesis is of the form ...

, graphing
Graph of a function
In mathematics, the graph of a function f is the collection of all ordered pairs . In particular, if x is a real number, graph means the graphical representation of this collection, in the form of a curve on a Cartesian plane, together with Cartesian axes, etc. Graphing on a Cartesian plane is...

, Newton's method
Newton's method
In numerical analysis, Newton's method , named after Isaac Newton and Joseph Raphson, is a method for finding successively better approximations to the roots of a real-valued function. The algorithm is first in the class of Householder's methods, succeeded by Halley's method...

, and using the quadratic formula (given below).

Real number
In mathematics, a real number is a value that represents a quantity along a continuum, such as -5 , 4/3 , 8.6 , √2 and π...

or complex
Complex number
A complex number is a number consisting of a real part and an imaginary part. Complex numbers extend the idea of the one-dimensional number line to the two-dimensional complex plane by using the number line for the real part and adding a vertical axis to plot the imaginary part...

coefficients has two solutions, called roots. These two solutions may or may not be distinct, and they may or may not be real
Real number
In mathematics, a real number is a value that represents a quantity along a continuum, such as -5 , 4/3 , 8.6 , √2 and π...

.

The roots are given by the quadratic formula
where the symbol "±"
Plus-minus sign
The plus-minus sign is a mathematical symbol commonly used either*to indicate the precision of an approximation, or*to indicate a value that can be of either sign....

indicates that both

are solutions of the quadratic equation.

### Discriminant

In the above formula, the expression underneath the square root sign is called the discriminant
Discriminant
In algebra, the discriminant of a polynomial is an expression which gives information about the nature of the polynomial's roots. For example, the discriminant of the quadratic polynomialax^2+bx+c\,is\Delta = \,b^2-4ac....

of the quadratic equation, and is often represented using an upper case Greek delta
Delta (letter)
Delta is the fourth letter of the Greek alphabet. In the system of Greek numerals it has a value of 4. It was derived from the Phoenician letter Dalet...

, the initial of the Greek
Greek language
Greek is an independent branch of the Indo-European family of languages. Native to the southern Balkans, it has the longest documented history of any Indo-European language, spanning 34 centuries of written records. Its writing system has been the Greek alphabet for the majority of its history;...

word Διακρίνουσα, Diakrínousa, discriminant:

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, both of which are real numbers:

Integer
The integers are formed by the natural numbers together with the negatives of the non-zero natural numbers .They are known as Positive and Negative Integers respectively...

coefficients, if the discriminant is a perfect square
Square number
In mathematics, a square number, sometimes also called a perfect square, is an integer that is the square of an integer; in other words, it is the product of some integer with itself...

, then the roots are rational number
Rational number
In mathematics, a rational number is any number that can be expressed as the quotient or fraction a/b of two integers, with the denominator b not equal to zero. Since b may be equal to 1, every integer is a rational number...

s—in other cases they may be quadratic irrational
In mathematics, a quadratic irrational is an irrational number that is the solution to some quadratic equation with rational coefficients...

s.

• If the discriminant is zero, then there is exactly one distinct real
Real number
In mathematics, a real number is a value that represents a quantity along a continuum, such as -5 , 4/3 , 8.6 , √2 and π...

root, sometimes called a double root:
• If the discriminant is negative, then there are no real roots. Rather, there are two distinct (non-real) complex
Complex number
A complex number is a number consisting of a real part and an imaginary part. Complex numbers extend the idea of the one-dimensional number line to the two-dimensional complex plane by using the number line for the real part and adding a vertical axis to plot the imaginary part...

roots, which are complex conjugate
Complex conjugate
In mathematics, complex conjugates are a pair of complex numbers, both having the same real part, but with imaginary parts of equal magnitude and opposite signs...

s of each other:

where i is the imaginary unit
Imaginary unit
In mathematics, the imaginary unit allows the real number system ℝ to be extended to the complex number system ℂ, which in turn provides at least one root for every polynomial . The imaginary unit is denoted by , , or the Greek...

.

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.

### Monic form

Dividing the quadratic equation by coefficient a gives the simplified monic form of
where p = and q = . This in turn simplifies the root and discriminant equations somewhat to
and

## History

The Babylonian mathematicians
Babylonian mathematics
Babylonian mathematics refers to any mathematics of the people of Mesopotamia, from the days of the early Sumerians to the fall of Babylon in 539 BC. Babylonian mathematical texts are plentiful and well edited...

, as early as 2000 BC (displayed on Old Babylonian
First Babylonian Dynasty
The chronology of the first dynasty of Babylonia is debated as there is a Babylonian King List A and a Babylonian King List B. In this chronology, the regnal years of List A are used due to their wide usage...

clay tablet
Clay tablet
In the Ancient Near East, clay tablets were used as a writing medium, especially for writing in cuneiform, throughout the Bronze Age and well into the Iron Age....

s) could solve a pair of simultaneous equations of the form:

which are equivalent to the equation:

The original pair of equations were solved as follows:
1. Form
2. Form
3. Form
4. Form (where xy is assumed)
5. Find x and y by inspection of the values in (1) and (4).

There is evidence pushing this back as far as the Ur III dynasty.

In the Sulba Sutras
Sulba Sutras
The Shulba Sutras or Śulbasūtras are sutra texts belonging to the Śrauta ritual and containing geometry related to fire-altar construction.- Purpose and origins :...

in ancient India
Indian subcontinent
The Indian subcontinent, also Indian Subcontinent, Indo-Pak Subcontinent or South Asian Subcontinent is a region of the Asian continent on the Indian tectonic plate from the Hindu Kush or Hindu Koh, Himalayas and including the Kuen Lun and Karakoram ranges, forming a land mass which extends...

circa 8th century BC
8th century BC
The 8th century BC started the first day of 800 BC and ended the last day of 701 BC.-Overview:The 8th century BC was a period of great changes in civilizations. In Egypt, the 23rd and 24th dynasties led to rule from Nubia in the 25th Dynasty...

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
Chinese mathematics
Mathematics in China emerged independently by the 11th century BC. The Chinese independently developed very large and negative numbers, decimals, a place value decimal system, a binary system, algebra, geometry, and trigonometry....

from circa 200 BC used the method of completing the square
Completing the square
In elementary algebra, completing the square is a technique for converting a quadratic polynomial of the formax^2 + bx + c\,\!to the formIn this context, "constant" means not depending on x. The expression inside the parenthesis is of the form ...

to solve quadratic equations with positive roots, but did not have a general formula.

Euclid
Euclid
Euclid , fl. 300 BC, also known as Euclid of Alexandria, was a Greek mathematician, often referred to as the "Father of Geometry". He was active in Alexandria during the reign of Ptolemy I...

, the Greek mathematician
Greek mathematics
Greek mathematics, as that term is used in this article, is the mathematics written in Greek, developed from the 7th century BC to the 4th century AD around the Eastern shores of the Mediterranean. Greek mathematicians lived in cities spread over the entire Eastern Mediterranean, from Italy to...

, produced a more abstract geometrical method around 300 BC. Pythagoras
Pythagoras
Pythagoras of Samos was an Ionian Greek philosopher, mathematician, and founder of the religious movement called Pythagoreanism. Most of the information about Pythagoras was written down centuries after he lived, so very little reliable information is known about him...

and Euclid used a strictly geometric approach, and found a general procedure to solve the quadratic equation. In his work Arithmetica
Arithmetica
Arithmetica is an ancient Greek text on mathematics written by the mathematician Diophantus in the 3rd century AD. It is a collection of 130 algebraic problems giving numerical solutions of determinate equations and indeterminate equations.Equations in the book are called Diophantine equations...

, the Greek mathematician Diophantus
Diophantus
Diophantus of Alexandria , sometimes called "the father of algebra", was an Alexandrian Greek mathematician and the author of a series of books called Arithmetica. These texts deal with solving algebraic equations, many of which are now lost...

solved the quadratic equation, but giving only one root, even when both roots were positive.

Brahmagupta
Brahmagupta was an Indian mathematician and astronomer who wrote many important works on mathematics and astronomy. His best known work is the Brāhmasphuṭasiddhānta , written in 628 in Bhinmal...

, an Indian mathematician
Indian mathematics
Indian mathematics emerged in the Indian subcontinent from 1200 BCE until the end of the 18th century. In the classical period of Indian mathematics , important contributions were made by scholars like Aryabhata, Brahmagupta, and Bhaskara II. The decimal number system in use today was first...

, gave the first explicit (although still not completely general) solution of the quadratic equation

as follows:
This is equivalent to:

The Bakhshali Manuscript
Bakhshali Manuscript
The Bakhshali Manuscript is an Ancient Indian mathematical manuscript written on birch bark which was found near the village of Bakhshali in 1881 in what was then the North-West Frontier Province of British India...

written in India in the 7th century AD contained an algebraic formula for solving quadratic equations, as well as quadratic indeterminate
Indeterminate (variable)
In mathematics, and particularly in formal algebra, an indeterminate is a symbol that does not stand for anything else but itself. In particular it does not designate a constant, or a parameter of the problem, it is not an unknown that could be solved for, it is not a variable designating a...

equations (originally of type ax/c = y).

'There is some confusion in the literature on whether al-Khwārizmī's full name is ' or '. Ibn Khaldun notes in his encyclopedic work: "The first who wrote upon this branch was Abu ʿAbdallah al-Khowarizmi, after whom came Abu Kamil Shojaʿ ibn Aslam." . 'There is some confusion in the literature on...

(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
Mathematical proof
In mathematics, a proof is a convincing demonstration that some mathematical statement is necessarily true. Proofs are obtained from deductive reasoning, rather than from inductive or empirical arguments. That is, a proof must demonstrate that a statement is true in all cases, without a single...

in the process. He also described the method of completing the square and recognized that the discriminant
Discriminant
In algebra, the discriminant of a polynomial is an expression which gives information about the nature of the polynomial's roots. For example, the discriminant of the quadratic polynomialax^2+bx+c\,is\Delta = \,b^2-4ac....

must be positive, which was proven by his contemporary 'Abd al-Hamīd ibn Turk
'Abd al-Hamid ibn Turk
' , known also as ' was a ninth century Turkic Muslim mathematician. Not much is known about his biography. The two records of him, one by Ibn Nadim and the other by al-Qifti are not identical. However al-Qifi mentions his name as ʿAbd al-Hamīd ibn Wase ibn Turk Jili...

(Central Asia, 9th century) who gave geometric figures to prove that if the discriminant is negative, a quadratic equation has no solution. While al-Khwarizmi himself did not accept negative solutions, later Islamic mathematicians that succeeded him accepted negative solutions, as well as irrational number
Irrational number
In mathematics, an irrational number is any real number that cannot be expressed as a ratio a/b, where a and b are integers, with b non-zero, and is therefore not a rational number....

s as solutions. 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
Square root
In mathematics, a square root of a number x is a number r such that r2 = x, or, in other words, a number r whose square is x...

, cube root or fourth root
Nth root
In mathematics, the nth root of a number x is a number r which, when raised to the power of n, equals xr^n = x,where n is the degree of the root...

) as solutions to quadratic equations or as coefficient
Coefficient
In mathematics, a coefficient is a multiplicative factor in some term of an expression ; it is usually a number, but in any case does not involve any variables of the expression...

s in an 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. His solution was largely based on Al-Khwarizmi's work. The writing of the Chinese mathematician Yang Hui
Yang Hui
Yang Hui , courtesy name Qianguang , was a Chinese mathematician from Qiantang , Zhejiang province during the late Song Dynasty . Yang worked on magic squares, magic circles and the binomial theorem, and is best known for his contribution of presenting 'Yang Hui's Triangle'...

(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
Gerolamo Cardano
Gerolamo Cardano was an Italian Renaissance mathematician, physician, astrologer and gambler...

compiled the works related to the quadratic equations. The quadratic formula covering all cases was first obtained by Simon Stevin in 1594. In 1637 René Descartes
René Descartes
René Descartes ; was a French philosopher and writer who spent most of his adult life in the Dutch Republic. He has been dubbed the 'Father of Modern Philosophy', and much subsequent Western philosophy is a response to his writings, which are studied closely to this day...

published La Géométrie
La Géométrie
La Géométrie was published in 1637 as an appendix to Discours de la méthode , written by René Descartes. In the Discourse, he presents his method for obtaining clarity on any subject...

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.

### Geometry

The solutions of the quadratic equation

are also the roots of the quadratic function
A quadratic function, in mathematics, is a polynomial function of the formf=ax^2+bx+c,\quad a \ne 0.The graph of a quadratic function is a parabola whose axis of symmetry is parallel to the y-axis....

:

since they are the values of x for which

If a, b, and c are real numbers and the domain
Domain (mathematics)
In mathematics, the domain of definition or simply the domain of a function is the set of "input" or argument values for which the function is defined...

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.

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.

The term

is a factor of the polynomial

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

It follows from the quadratic formula that

In the special case () where the quadratic has only one distinct root (i.e. the discriminant is zero), the quadratic polynomial can be factored
Factorization
In mathematics, factorization or factoring is the decomposition of an object into a product of other objects, or factors, which when multiplied together give the original...

as

### 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:
can be rewritten as:
or, equivalently, as a quadratic equation in a new variable u:
where
Solving the quadratic equation for u results in the two solutions:
Thus
Concentrating on finding the three cube roots of – the other three solutions for x (the three cube roots of ) will be their complex conjugate
Complex conjugate
In mathematics, complex conjugates are a pair of complex numbers, both having the same real part, but with imaginary parts of equal magnitude and opposite signs...

s – rewriting the right-hand side using Euler's formula
Euler's formula
Euler's formula, named after Leonhard Euler, is a mathematical formula in complex analysis that establishes the deep relationship between the trigonometric functions and the complex exponential function...

:
(since e2kπi = 1), gives the three solutions:
Using Eulers' formula again together with trigonometric identities such as cos(π/12) = , and adding the complex conjugates, gives the complete collection of solutions as:
and

### By completing the square

The quadratic formula can be derived by the method of completing the square
Completing the square
In elementary algebra, completing the square is a technique for converting a quadratic polynomial of the formax^2 + bx + c\,\!to the formIn this context, "constant" means not depending on x. The expression inside the parenthesis is of the form ...

,
so as to make use of the algebraic identity:

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

or

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:

which produces

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

Taking the square root
Square root
In mathematics, a square root of a number x is a number r such that r2 = x, or, in other words, a number r whose square is x...

of both sides yields

Isolating x, gives

### By shifting ax2

The quadratic formula can be derived by starting with equation
which describes the parabola as ax2 with the vertex shifted from the origin to (xV, yV).

Solving this equation for x is straightforward and results in
Using Vieta's formulas for the vertex coordinates
the values of x can be written as

Note. The formulas for xV and yV can be derived by comparing the coefficients in
and
Rewriting the latter equation as
and comparing with the former results in
from which Vieta's expressions for xV and yV can be derived.

### 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
Galois theory
In mathematics, more specifically in abstract algebra, Galois theory, named after Évariste Galois, provides a connection between field theory and group theory...

.
A benefit of this method is that it generalizes to give the solution of cubic polynomials and quartic polynomials, and leads to Galois theory, which allows one to understand the solution of polynomials of any degree in terms of the symmetry group
Symmetry group
The symmetry group of an object is the group of all isometries under which it is invariant with composition as the operation...

of their roots, the Galois group
Galois group
In mathematics, more specifically in the area of modern algebra known as Galois theory, the Galois group of a certain type of field extension is a specific group associated with the field extension...

.

This approach focuses on the roots more than on rearranging the original equation.

assume that it factors as

Expanding yields

where

and

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
Symmetric group
In mathematics, the symmetric group Sn on a finite set of n symbols is the group whose elements are all the permutations of the n symbols, and whose group operation is the composition of such permutations, which are treated as bijective functions from the set of symbols to itself...

on n letters, and denoted 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:
These are called the Lagrange resolvents of the polynomial;
notice that these depend on the order of the roots, which is the key point.
One can recover the roots from the resolvents by inverting the above equations:
Thus, solving for the resolvents gives the original roots.

Formally, the resolvents are called the discrete Fourier transform
Discrete Fourier transform
In mathematics, the discrete Fourier transform is a specific kind of discrete transform, used in Fourier analysis. It transforms one function into another, which is called the frequency domain representation, or simply the DFT, of the original function...

(DFT) of order 2, and the transform can be expressed by the matrix with inverse matrix The transform matrix is also called the DFT matrix
DFT matrix
A DFT matrix is an expression of a discrete Fourier transform as a matrix multiplication.-Definition:An N-point DFT is expressed as an N-by-N matrix multiplication as X = W x, where x is the original input signal, and X is the DFT of the signal.The transformation W of size N\times N can be defined...

or Vandermonde matrix.

Now is a symmetric function in α and β, so it can be expressed in terms of p and q, and in fact as noted above. Contrariwise, is not symmetric, since switching α and β yields (formally, this is termed a group action
Group action
In algebra and geometry, a group action is a way of describing symmetries of objects using groups. The essential elements of the object are described by a set, and the symmetries of the object are described by the symmetry group of this set, which consists of bijective transformations of the set...

of the symmetric group of the roots). Since 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 by a factor of and thus the square is symmetric in the roots, and thus expressible in terms of p and q. Using the equation
yields
and thus.
If one takes the positive root, breaking symmetry, one obtains:
and thus
Thus the roots are
which is the quadratic formula. Substituting yields the usual form for when a quadratic is not monic. The resolvents can be recognized as being the vertex, and 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 and 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.

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

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
Indeterminate form
In calculus and other branches of mathematical analysis, an indeterminate form is an algebraic expression obtained in the context of limits. Limits involving algebraic operations are often performed by replacing subexpressions by their limits; if the expression obtained after this substitution...

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
Division by zero
In mathematics, division by zero is division where the divisor is zero. Such a division can be formally expressed as a / 0 where a is the dividend . Whether this expression can be assigned a well-defined value depends upon the mathematical setting...

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 alternate form is merely an algebraic variation of the common form:

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. In this case, b is very close to , and the subtraction in the numerator causes loss of significance
Loss of significance
Loss of significance is an undesirable effect in calculations using floating-point arithmetic. It occurs when an operation on two numbers increases relative error substantially more than it increases absolute error, for example in subtracting two large and nearly equal numbers. The effect is that...

.

A mixed approach avoids both all cancellation problems (only numbers of the same sign are added), and the problem of c being zero:

Here sgn denotes the sign function
Sign function
In mathematics, the sign function is an odd mathematical function that extracts the sign of a real number. To avoid confusion with the sine function, this function is often called the signum function ....

.

### Floating point implementation

A careful floating point
Floating point
In computing, floating point describes a method of representing real numbers in a way that can support a wide range of values. Numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent. The base for the scaling is normally 2, 10 or 16...

computer implementation differs a little from both forms to produce a robust result. Assuming the discriminant, , is positive and b is nonzero, the code will be something like the following:

Here sgn(b) is the sign function
Sign function
In mathematics, the sign function is an odd mathematical function that extracts the sign of a real number. To avoid confusion with the sine function, this function is often called the signum 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
Loss of significance
Loss of significance is an undesirable effect in calculations using floating-point arithmetic. It occurs when an operation on two numbers increases relative error substantially more than it increases absolute error, for example in subtracting two large and nearly equal numbers. The effect is that...

. The computation of x2 uses the fact that the product of the roots is c/a.

### 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:

and

These results follow immediately from the relation:

which can be compared term by term with:

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:

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

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:
The second Vieta's formula then provides:
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
Round-off error
A round-off error, also called rounding error, is the difference between the calculated approximation of a number and its exact mathematical value. Numerical analysis specifically tries to estimate this error when using approximation equations and/or algorithms, especially when using finitely many...

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 insure a stable operation (see step response
Step response
The step response of a system in a given initial state consists of the time evolution of its outputs when its control inputs are Heaviside step functions. In electronic engineering and control theory, step response is the time behaviour of the outputs of a general system when its inputs change from...

).

### Trigonometric solution for complex roots

In the case of complex roots the roots can also be found trigonometrically
Trigonometry
Trigonometry is a branch of mathematics that studies triangles and the relationships between their sides and the angles between these sides. Trigonometry defines the trigonometric functions, which describe those relationships and have applicability to cyclical phenomena, such as waves...

.

The formula and its derivation remain correct if the coefficients a, b and c are complex number
Complex number
A complex number is a number consisting of a real part and an imaginary part. Complex numbers extend the idea of the one-dimensional number line to the two-dimensional complex plane by using the number line for the real part and adding a vertical axis to plot the imaginary part...

s, or more generally members of any field
Field (mathematics)
In abstract algebra, a field is a commutative ring whose nonzero elements form a group under multiplication. As such it is an algebraic structure with notions of addition, subtraction, multiplication, and division, satisfying certain axioms...

whose characteristic
Characteristic (algebra)
In mathematics, the characteristic of a ring R, often denoted char, is defined to be the smallest number of times one must use the ring's multiplicative identity element in a sum to get the additive identity element ; the ring is said to have characteristic zero if this repeated sum never reaches...

is not 2. (In a field of characteristic 2, the element 2a is zero and it is impossible to divide by it.)

The symbol

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
Unit (ring theory)
In mathematics, an invertible element or a unit in a ring R refers to any element u that has an inverse element in the multiplicative monoid of R, i.e. such element v that...

, does not hold. Consider the monic quadratic polynomial

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

and note that there is only one root since

In summary,

In the case that b ≠ 0, there are two distinct roots, but if the polynomial is irreducible
Irreducible polynomial
In mathematics, the adjective irreducible means that an object cannot be expressed as the product of two or more non-trivial factors in a given set. See also factorization....

, 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
Splitting field
In abstract algebra, a splitting field of a polynomial with coefficients in a field is a smallest field extension of that field over which the polynomial factors into linear factors.-Definition:...

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
and

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
Artin-Schreier theory
In mathematics, Artin–Schreier theory is a branch of Galois theory, and more specifically is a positive characteristic analogue of Kummer theory, for Galois extensions of degree equal to the characteristic p...

.