Consider the equation
which we wish to solve for . In certain contexts, the solutions are given by one or more versions of the quadratic formula.
The coefficients are commonly taken from an algebraically closed field of characteristic , such as the field of complex numbers, although any quadratically closed field whose characteristic is not would work just as well. Alternatively, the coefficients can be taken from a real closed field , such as the field of real numbers; then the solutions belong to . (Of course, is simply again.) More generally, starting from any integral domain whose characteristic is not , the solutions belong to some splitting field of . (Of course, there are solutions in some splitting field, regardless of the characteristic, but they are not given by the quadratic formula if the characteristic is .)
Explicitly, the solutions of (1) may be given by the usual quadratic formula
which works as long as . There is also an alternate quadratic formula
which may be obtained from (2) by rationalising the numerator; this works as long as . (Note that and appear here simply to indicate the two square roots of the determinant and how they correspond to the two solutions ; we do not need to have a function which always chooses a ‘principal’ square root.)
These two formulas are reconciled in the projective line of . As long as , there are two solutions (which might happen to be equal) in the projective line. If , then one of these solutions is , and (2) correctly gives us that solution (as long as ) for one choice of square root, although it gives for the other choice. Similarly, (3) correctly gives us when and , but it does not give us the other root when . Note that if but , then (2) gives us one root () while (3) gives us the other ().
So in general, we should be given , , or for a nondegenerate equation (1). If , then we use (2); if , then we use (3). Finally, if , then we use both; each root will be successfully given by at least one formula for some choice of square root of .
When the coefficients come from an ordered field (which we assume real closed), then we can write down a formula specially for the case when . This is the numerical analysts' quadratic formula
In this formula, is the sign of , that is ; also, we must choose a nonnegative principal square root, so that in is avoided (and thus the common denominator of and numerator of is nonzero even if not imaginary). Despite the name, this formula is not sufficient for all purposes in numerical analysis?; one still needs all three formulas and chooses between them based on whether , , or is best established.
There is also an interesting issue about whether . Everything above is valid in weak forms of constructive mathematics, except for the statement that is algebraically closed. That claim follows from weak countable choice (WCC), which in turn will follow from either excluded middle or countable choice, which is accepted by most constructive mathematicians. Nevertheless, the statement
is false in (for example) the internal language of the sheaf topos over the real line. (Essentially, this is because there is no continuous map on any neighbourhood of in .) If we are given that are real, or if we are given that , then there is no problem. But in general, we cannot define this square root, which appears in every version of the quadratic formula.
However, there is a more subtle sense in which is algebraically closed even without WCC; essentially, this allows us to approximate the subset of whose elements are the two solutions of (1) (using two-element subsets of the field of, say, Gaussian numbers) even if we can't approximate any one solution (using individual, say, Gaussian numbers). See Richman (1998) for details.
Sometimes one considers the equation