- Source: Quadratic formula
In elementary algebra, the quadratic formula is a closed-form expression describing the solutions of a quadratic equation. Other ways of solving quadratic equations, such as completing the square, yield the same solutions.
Given a general quadratic equation of the form
a
x
2
+
b
x
+
c
=
0
{\displaystyle \textstyle ax^{2}+bx+c=0}
, with
x
{\displaystyle x}
representing an unknown, and coefficients
a
{\displaystyle a}
,
b
{\displaystyle b}
, and
c
{\displaystyle c}
representing known real or complex numbers with
a
≠
0
{\displaystyle a\neq 0}
, the values of
x
{\displaystyle x}
satisfying the equation, called the roots or zeros, can be found using the quadratic formula,
x
=
−
b
±
b
2
−
4
a
c
2
a
,
{\displaystyle x={\frac {-b\pm {\sqrt {b^{2}-4ac}}}{2a}},}
where the plus–minus symbol "
±
{\displaystyle \pm }
" indicates that the equation has two roots. Written separately, these are:
x
1
=
−
b
+
b
2
−
4
a
c
2
a
,
x
2
=
−
b
−
b
2
−
4
a
c
2
a
.
{\displaystyle x_{1}={\frac {-b+{\sqrt {b^{2}-4ac}}}{2a}},\qquad x_{2}={\frac {-b-{\sqrt {b^{2}-4ac}}}{2a}}.}
The quantity
Δ
=
b
2
−
4
a
c
{\displaystyle \textstyle \Delta =b^{2}-4ac}
is known as the discriminant of the quadratic equation. If the coefficients
a
{\displaystyle a}
,
b
{\displaystyle b}
, and
c
{\displaystyle c}
are real numbers then when
Δ
>
0
{\displaystyle \Delta >0}
, the equation has two distinct real roots; when
Δ
=
0
{\displaystyle \Delta =0}
, the equation has one repeated real root; and when
Δ
<
0
{\displaystyle \Delta <0}
, the equation has no real roots but has two distinct complex roots, which are complex conjugates of each other.
Geometrically, the roots represent the
x
{\displaystyle x}
values at which the graph of the quadratic function
y
=
a
x
2
+
b
x
+
c
{\displaystyle \textstyle y=ax^{2}+bx+c}
, a parabola, crosses the
x
{\displaystyle x}
-axis: the graph's
x
{\displaystyle x}
-intercepts. The quadratic formula can also be used to identify the parabola's axis of symmetry.
Derivation by completing the square
The standard way to derive the quadratic formula is to apply the method of completing the square to the generic quadratic equation
a
x
2
+
b
x
+
c
=
0
{\displaystyle \textstyle ax^{2}+bx+c=0}
. The idea is to manipulate the equation into the form
(
x
+
k
)
2
=
s
{\displaystyle \textstyle (x+k)^{2}=s}
for some expressions
k
{\displaystyle k}
and
s
{\displaystyle s}
written in terms of the coefficients; take the square root of both sides; and then isolate
x
{\displaystyle x}
.
We start by dividing the equation by the quadratic coefficient
a
{\displaystyle a}
, which is allowed because
a
{\displaystyle a}
is non-zero. Afterwards, we subtract the constant term
c
/
a
{\displaystyle c/a}
to isolate it on the right-hand side:
a
x
2
|
+
b
x
+
c
=
0
x
2
+
b
a
x
+
c
a
=
0
x
2
+
b
a
x
=
−
c
a
.
{\displaystyle {\begin{aligned}ax^{2{\vphantom {|}}}+bx+c&=0\\[3mu]x^{2}+{\frac {b}{a}}x+{\frac {c}{a}}&=0\\[3mu]x^{2}+{\frac {b}{a}}x&=-{\frac {c}{a}}.\end{aligned}}}
The left-hand side is now of the form
x
2
+
2
k
x
{\displaystyle \textstyle x^{2}+2kx}
, and we can "complete the square" by adding a constant
k
2
{\displaystyle \textstyle k^{2}}
to obtain a squared binomial
x
2
+
2
k
x
+
k
2
=
{\displaystyle \textstyle x^{2}+2kx+k^{2}={}}
(
x
+
k
)
2
{\displaystyle \textstyle (x+k)^{2}}
. In this example we add
(
b
/
2
a
)
2
{\displaystyle \textstyle (b/2a)^{2}}
to both sides so that the left-hand side can be factored (see the figure):
x
2
+
2
(
b
2
a
)
x
+
(
b
2
a
)
2
=
−
c
a
+
(
b
2
a
)
2
(
x
+
b
2
a
)
2
=
b
2
−
4
a
c
4
a
2
.
{\displaystyle {\begin{aligned}x^{2}+2\left({\frac {b}{2a}}\right)x+\left({\frac {b}{2a}}\right)^{2}&=-{\frac {c}{a}}+\left({\frac {b}{2a}}\right)^{2}\\[5mu]\left(x+{\frac {b}{2a}}\right)^{2}&={\frac {b^{2}-4ac}{4a^{2}}}.\end{aligned}}}
Because the left-hand side is now a perfect square, we can easily take the square root of both sides:
x
+
b
2
a
=
±
b
2
−
4
a
c
2
a
.
{\displaystyle x+{\frac {b}{2a}}=\pm {\frac {\sqrt {b^{2}-4ac}}{2a}}.}
Finally, subtracting
b
/
2
a
{\displaystyle b/2a}
from both sides to isolate
x
{\displaystyle x}
produces the quadratic formula:
x
=
−
b
±
b
2
−
4
a
c
2
a
.
{\displaystyle x={\frac {-b\pm {\sqrt {b^{2}-4ac}}}{2a}}.}
Equivalent formulations
The quadratic formula can equivalently be written using various alternative expressions, for instance
x
=
−
b
2
a
±
(
b
2
a
)
2
−
c
a
,
{\displaystyle x=-{\frac {b}{2a}}\pm {\sqrt {\left({\frac {b}{2a}}\right)^{2}-{\frac {c}{a}}}},}
which can be derived by first dividing a quadratic equation by
2
a
{\displaystyle 2a}
, resulting in
1
2
x
2
+
b
2
a
x
+
c
2
a
=
0
{\displaystyle \textstyle {\tfrac {1}{2}}x^{2}+{\tfrac {b}{2a}}x+{\tfrac {c}{2a}}=0}
, then substituting the new coefficients into the standard quadratic formula. Because this variant allows re-use of the intermediately calculated quantity
b
2
a
{\displaystyle {\tfrac {b}{2a}}}
, it can slightly reduce the arithmetic involved.
= Square root in the denominator
=A lesser known quadratic formula, first mentioned by Giulio Fagnano, describes the same roots via an equation with the square root in the denominator (assuming
c
≠
0
{\displaystyle c\neq 0}
):
x
=
2
c
−
b
∓
b
2
−
4
a
c
.
{\displaystyle x={\frac {2c}{-b\mp {\sqrt {b^{2}-4ac}}}}.}
Here the minus–plus symbol "
∓
{\displaystyle \mp }
" indicates that the two roots of the quadratic equation, in the same order as the standard quadratic formula, are
x
1
=
2
c
−
b
−
b
2
−
4
a
c
,
x
2
=
2
c
−
b
+
b
2
−
4
a
c
.
{\displaystyle x_{1}={\frac {2c}{-b-{\sqrt {b^{2}-4ac}}}},\qquad x_{2}={\frac {2c}{-b+{\sqrt {b^{2}-4ac}}}}.}
This variant has been jokingly called the "citardauq" formula ("quadratic" spelled backwards).
When
−
b
{\displaystyle -b}
has the opposite sign as either
+
b
2
−
4
a
c
{\displaystyle \textstyle +{\sqrt {b^{2}-4ac}}}
or
−
b
2
−
4
a
c
{\displaystyle \textstyle -{\sqrt {b^{2}-4ac}}}
, subtraction can cause catastrophic cancellation, resulting in poor accuracy in numerical calculations; choosing between the version of the quadratic formula with the square root in the numerator or denominator depending on the sign of
b
{\displaystyle b}
can avoid this problem. See § Numerical calculation below.
This version of the quadratic formula is used in Muller's method for finding the roots of general functions. It can be derived from the standard formula from the identity
x
1
x
2
=
c
/
a
{\displaystyle x_{1}x_{2}=c/a}
, one of Vieta's formulas. Alternately, it can be derived by dividing each side of the equation
a
x
2
+
b
x
+
c
=
0
{\displaystyle \textstyle ax^{2}+bx+c=0}
by
x
2
{\displaystyle \textstyle x^{2}}
to get
c
x
−
2
+
b
x
−
1
+
a
=
0
{\displaystyle \textstyle cx^{-2}+bx^{-1}+a=0}
, applying the standard formula to find the two roots
x
−
1
{\displaystyle \textstyle x^{-1}\!}
, and then taking the reciprocal to find the roots
x
{\displaystyle x}
of the original equation.
Other derivations
Any generic method or algorithm for solving quadratic equations can be applied to an equation with symbolic coefficients and used to derive some closed-form expression equivalent to the quadratic formula. Alternative methods are sometimes simpler than completing the square, and may offer interesting insight into other areas of mathematics.
= Completing the square by Śrīdhara's method
=Instead of dividing by
a
{\displaystyle a}
to isolate
x
2
{\displaystyle \textstyle x^{2}\!}
, it can be slightly simpler to multiply by
4
a
{\displaystyle 4a}
instead to produce
(
2
a
x
)
2
{\displaystyle \textstyle (2ax)^{2}\!}
, which allows us to complete the square without need for fractions. Then the steps of the derivation are:
Multiply each side by
4
a
{\displaystyle 4a}
.
Add
b
2
−
4
a
c
{\displaystyle \textstyle b^{2}-4ac}
to both sides to complete the square.
Take the square root of both sides.
Isolate
x
{\displaystyle x}
.
Applying this method to a generic quadratic equation with symbolic coefficients yields the quadratic formula:
a
x
2
+
b
x
+
c
=
0
4
a
2
x
2
+
4
a
b
x
+
4
a
c
=
0
4
a
2
x
2
+
4
a
b
x
+
b
2
=
b
2
−
4
a
c
(
2
a
x
+
b
)
2
=
b
2
−
4
a
c
2
a
x
+
b
=
±
b
2
−
4
a
c
x
=
−
b
±
b
2
−
4
a
c
2
a
.
)
{\displaystyle {\begin{aligned}ax^{2}+bx+c&=0\\[3mu]4a^{2}x^{2}+4abx+4ac&=0\\[3mu]4a^{2}x^{2}+4abx+b^{2}&=b^{2}-4ac\\[3mu](2ax+b)^{2}&=b^{2}-4ac\\[3mu]2ax+b&=\pm {\sqrt {b^{2}-4ac}}\\[5mu]x&={\dfrac {-b\pm {\sqrt {b^{2}-4ac}}}{2a}}.{\vphantom {\bigg )}}\end{aligned}}}
This method for completing the square is ancient and was known to the 8th–9th century Indian mathematician Śrīdhara. Compared with the modern standard method for completing the square, this alternate method avoids fractions until the last step and hence does not require a rearrangement after step 3 to obtain a common denominator in the right side.
= By substitution
=Another derivation uses a change of variables to eliminate the linear term. Then the equation takes the form
u
2
=
s
{\displaystyle \textstyle u^{2}=s}
in terms of a new variable
u
{\displaystyle u}
and some constant expression
s
{\displaystyle s}
, whose roots are then
u
=
±
s
{\displaystyle u=\pm {\sqrt {s}}}
.
By substituting
x
=
u
−
b
2
a
{\displaystyle x=u-{\tfrac {b}{2a}}}
into
a
x
2
+
b
x
+
c
=
0
{\displaystyle \textstyle ax^{2}+bx+c=0}
, expanding the products and combining like terms, and then solving for
u
2
{\displaystyle \textstyle u^{2}\!}
, we have:
a
(
u
−
b
2
a
)
2
+
b
(
u
−
b
2
a
)
+
c
=
0
a
(
u
2
−
b
a
u
+
b
2
4
a
2
)
+
b
(
u
−
b
2
a
)
+
c
=
0
a
u
2
−
b
u
+
b
2
4
a
+
b
u
−
b
2
2
a
+
c
=
0
a
u
2
+
4
a
c
−
b
2
4
a
=
0
u
2
=
b
2
−
4
a
c
4
a
2
.
{\displaystyle {\begin{aligned}a\left(u-{\frac {b}{2a}}\right)^{2}+b\left(u-{\frac {b}{2a}}\right)+c&=0\\[5mu]a\left(u^{2}-{\frac {b}{a}}u+{\frac {b^{2}}{4a^{2}}}\right)+b\left(u-{\frac {b}{2a}}\right)+c&=0\\[5mu]au^{2}-bu+{\frac {b^{2}}{4a}}+bu-{\frac {b^{2}}{2a}}+c&=0\\[5mu]au^{2}+{\frac {4ac-b^{2}}{4a}}&=0\\[5mu]u^{2}&={\frac {b^{2}-4ac}{4a^{2}}}.\end{aligned}}}
Finally, after taking a square root of both sides and substituting the resulting expression for
u
{\displaystyle u}
back into
x
=
u
−
b
2
a
,
{\displaystyle x=u-{\tfrac {b}{2a}},}
the familiar quadratic formula emerges:
x
=
−
b
±
b
2
−
4
a
c
2
a
.
{\displaystyle x={\frac {-b\pm {\sqrt {b^{2}-4ac}}}{2a}}.}
= By using algebraic identities
=The following method was used by many historical mathematicians:
Let the roots of the quadratic equation
a
x
2
+
b
x
+
c
=
0
{\displaystyle \textstyle ax^{2}+bx+c=0}
be
α
{\displaystyle \alpha }
and
β
{\displaystyle \beta }
. The derivation starts from an identity for the square of a difference (valid for any two complex numbers), of which we can take the square root on both sides:
(
α
−
β
)
2
=
(
α
+
β
)
2
−
4
α
β
α
−
β
=
±
(
α
+
β
)
2
−
4
α
β
.
{\displaystyle {\begin{aligned}(\alpha -\beta )^{2}&=(\alpha +\beta )^{2}-4\alpha \beta \\[3mu]\alpha -\beta &=\pm {\sqrt {(\alpha +\beta )^{2}-4\alpha \beta }}.\end{aligned}}}
Since the coefficient
a
≠
0
{\displaystyle a\neq 0}
, we can divide the quadratic equation by
a
{\displaystyle a}
to obtain a monic polynomial with the same roots. Namely,
x
2
+
b
a
x
+
c
a
=
(
x
−
α
)
(
x
−
β
)
=
x
2
−
(
α
+
β
)
x
+
α
β
.
{\displaystyle x^{2}+{\frac {b}{a}}x+{\frac {c}{a}}=(x-\alpha )(x-\beta )=x^{2}-(\alpha +\beta )x+\alpha \beta .}
This implies that the sum
α
+
β
=
−
b
a
{\displaystyle \alpha +\beta =-{\tfrac {b}{a}}}
and the product
α
β
=
c
a
{\displaystyle \alpha \beta ={\tfrac {c}{a}}}
. Thus the identity can be rewritten:
α
−
β
=
±
(
−
b
a
)
2
−
4
c
a
=
±
b
2
−
4
a
c
a
.
{\displaystyle \alpha -\beta =\pm {\sqrt {\left(-{\frac {b}{a}}\right)^{2}-4{\frac {c}{a}}}}=\pm {\frac {\sqrt {b^{2}-4ac}}{a}}.}
Therefore,
α
=
1
2
(
α
+
β
)
+
1
2
(
α
−
β
)
=
−
b
2
a
±
b
2
−
4
a
c
2
a
,
β
=
1
2
(
α
+
β
)
−
1
2
(
α
−
β
)
=
−
b
2
a
∓
b
2
−
4
a
c
2
a
.
{\displaystyle {\begin{aligned}\alpha &={\tfrac {1}{2}}(\alpha +\beta )+{\tfrac {1}{2}}(\alpha -\beta )=-{\frac {b}{2a}}\pm {\frac {\sqrt {b^{2}-4ac}}{2a}},\\[10mu]\beta &={\tfrac {1}{2}}(\alpha +\beta )-{\tfrac {1}{2}}(\alpha -\beta )=-{\frac {b}{2a}}\mp {\frac {\sqrt {b^{2}-4ac}}{2a}}.\end{aligned}}}
The two possibilities for each of
α
{\displaystyle \alpha }
and
β
{\displaystyle \beta }
are the same two roots in opposite order, so we can combine them into the standard quadratic equation:
x
=
−
b
±
b
2
−
4
a
c
2
a
.
{\displaystyle x={\frac {-b\pm {\sqrt {b^{2}-4ac}}}{2a}}.}
= 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.
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 themselves rather than algebraically rearranging the original equation. Given a monic quadratic polynomial
x
2
+
p
x
+
q
{\displaystyle \textstyle x^{2}+px+q}
assume that
α
{\displaystyle \alpha }
and
β
{\displaystyle \beta }
are the two roots. So the polynomial factors as
x
2
+
p
x
+
q
=
(
x
−
α
)
(
x
−
β
)
=
x
2
−
(
α
+
β
)
x
+
α
β
{\displaystyle {\begin{aligned}x^{2}+px+q&=(x-\alpha )(x-\beta )\\[3mu]&=x^{2}-(\alpha +\beta )x+\alpha \beta \end{aligned}}}
which implies
p
=
−
(
α
+
β
)
{\displaystyle p=-(\alpha +\beta )}
and
q
=
α
β
{\displaystyle q=\alpha \beta }
.
Since multiplication and addition are both commutative, exchanging the roots
α
{\displaystyle \alpha }
and
β
{\displaystyle \beta }
will not change the coefficients
p
{\displaystyle p}
and
q
{\displaystyle q}
: one can say that
p
{\displaystyle p}
and
q
{\displaystyle q}
are symmetric polynomials in
α
{\displaystyle \alpha }
and
β
{\displaystyle \beta }
. Specifically, they are the elementary symmetric polynomials – any symmetric polynomial in
α
{\displaystyle \alpha }
and
β
{\displaystyle \beta }
can be expressed in terms of
α
+
β
{\displaystyle \alpha +\beta }
and
α
β
{\displaystyle \alpha \beta }
instead.
The Galois theory approach to analyzing and solving polynomials is to ask whether, given coefficients of a polynomial each of which is a symmetric function in the roots, one can "break" the symmetry and thereby recover the roots. Using this approach, solving a polynomial of degree
n
{\displaystyle n}
is related to the ways of rearranging ("permuting")
n
{\displaystyle n}
terms, called the symmetric group on
n
{\displaystyle n}
letters and denoted
S
n
{\displaystyle S_{n}}
. For the quadratic polynomial, the only ways to rearrange two roots are to either leave them be or to transpose them, so solving a quadratic polynomial is simple.
To find the roots
α
{\displaystyle \alpha }
and
β
{\displaystyle \beta }
, consider their sum and difference:
r
1
=
α
+
β
,
r
2
=
α
−
β
.
{\displaystyle r_{1}=\alpha +\beta ,\quad r_{2}=\alpha -\beta .}
These are called the Lagrange resolvents of the polynomial, from which the roots can be recovered as
α
=
1
2
(
r
1
+
r
2
)
,
β
=
1
2
(
r
1
−
r
2
)
.
{\displaystyle \alpha ={\tfrac {1}{2}}(r_{1}+r_{2}),\quad \beta ={\tfrac {1}{2}}(r_{1}-r_{2}).}
Because
r
1
=
α
+
β
{\displaystyle r_{1}=\alpha +\beta }
is a symmetric function in
α
{\displaystyle \alpha }
and
β
{\displaystyle \beta }
, it can be expressed in terms of
p
{\displaystyle p}
and
q
,
{\displaystyle q,}
specifically
r
1
=
−
p
{\displaystyle r_{1}=-p}
as described above. However,
r
2
=
α
−
β
{\displaystyle r_{2}=\alpha -\beta }
is not symmetric, since exchanging
α
{\displaystyle \alpha }
and
β
{\displaystyle \beta }
yields the additive inverse
−
r
2
=
β
−
α
{\displaystyle -r_{2}=\beta -\alpha }
. So
r
2
{\displaystyle r_{2}}
cannot be expressed in terms of the symmetric polynomials. However, its square
r
2
2
=
(
α
−
β
)
2
{\displaystyle \textstyle r_{2}^{2}=(\alpha -\beta )^{2}}
is symmetric in the roots, expressible in terms of
p
{\displaystyle p}
and
q
{\displaystyle q}
. Specifically
r
2
2
=
(
α
−
β
)
2
=
{\displaystyle \textstyle r_{2}^{2}=(\alpha -\beta )^{2}={}}
(
α
+
β
)
2
−
4
α
β
=
{\displaystyle \textstyle (\alpha +\beta )^{2}-4\alpha \beta ={}}
p
2
−
4
q
{\displaystyle \textstyle p^{2}-4q}
, which implies
r
2
=
±
p
2
−
4
q
{\displaystyle \textstyle r_{2}=\pm {\sqrt {p^{2}-4q}}}
. Taking the positive root "breaks" the symmetry, resulting in
r
1
=
−
p
,
r
2
=
p
2
−
4
q
{\displaystyle r_{1}=-p,\qquad r_{2}={\textstyle {\sqrt {p^{2}-4q}}}}
from which the roots
α
{\displaystyle \alpha }
and
β
{\displaystyle \beta }
are recovered as
x
=
1
2
(
r
1
±
r
2
)
=
1
2
(
−
p
±
p
2
−
4
q
)
{\displaystyle x={\tfrac {1}{2}}(r_{1}\pm r_{2})={\tfrac {1}{2}}{\bigl (}{-p}\pm {\textstyle {\sqrt {p^{2}-4q}}}\,{\bigr )}}
which is the quadratic formula for a monic polynomial.
Substituting
p
=
b
/
a
{\displaystyle p=b/a}
,
q
=
c
/
a
{\displaystyle q=c/a}
yields the usual expression for an arbitrary quadratic polynomial. The resolvents can be recognized as
1
2
r
1
=
−
1
2
p
=
−
b
2
a
,
r
2
2
=
p
2
−
4
q
=
b
2
−
4
a
c
a
2
,
{\displaystyle {\tfrac {1}{2}}r_{1}=-{\tfrac {1}{2}}p=-{\frac {b}{2a}},\qquad r_{2}^{2}=p_{2}-4q={\frac {b^{2}-4ac}{a^{2}}},}
respectively the vertex and the discriminant of the monic polynomial.
A similar but more complicated method works for cubic equations, which have three resolvents and a quadratic equation (the "resolving polynomial") relating
r
2
{\displaystyle r_{2}}
and
r
3
{\displaystyle r_{3}}
, which one can solve by the quadratic equation, and similarly for a quartic equation (degree 4), whose resolving polynomial is a cubic, which can in turn be solved. 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.
Numerical calculation
The quadratic formula is exactly correct when performed using the idealized arithmetic of real numbers, but when approximate arithmetic is used instead, for example pen-and-paper arithmetic carried out to a fixed number of decimal places or the floating-point binary arithmetic available on computers, the limitations of the number representation can lead to substantially inaccurate results unless great care is taken in the implementation. Specific difficulties include catastrophic cancellation in computing the sum
−
b
±
Δ
{\displaystyle \textstyle -b\pm {\sqrt {\Delta }}}
if
b
≈
±
Δ
{\displaystyle \textstyle b\approx \pm {\sqrt {\Delta }}}
; catastrophic calculation in computing the discriminant
Δ
=
b
2
−
4
a
c
{\displaystyle \textstyle \Delta =b^{2}-4ac}
itself in cases where
b
2
≈
4
a
c
{\displaystyle \textstyle b^{2}\approx 4ac}
; degeneration of the formula when
a
{\displaystyle a}
,
b
{\displaystyle b}
, or
c
{\displaystyle c}
is represented as zero or infinite; and possible overflow or underflow when multiplying or dividing extremely large or small numbers, even in cases where the roots can be accurately represented.
Catastrophic cancellation occurs when two numbers which are approximately equal are subtracted. While each of the numbers may independently be representable to a certain number of digits of precision, the identical leading digits of each number cancel, resulting in a difference of lower relative precision. When
b
≈
Δ
{\displaystyle \textstyle b\approx {\sqrt {\Delta }}}
, evaluation of
−
b
+
Δ
{\displaystyle \textstyle -b+{\sqrt {\Delta }}}
causes catastrophic cancellation, as does the evaluation of
−
b
−
Δ
{\displaystyle \textstyle -b-{\sqrt {\Delta }}}
when
b
≈
−
Δ
{\displaystyle \textstyle b\approx -{\sqrt {\Delta }}}
. When using the standard quadratic formula, calculating one of the two roots always involves addition, which preserves the working precision of the intermediate calculations, while calculating the other root involves subtraction, which compromises it. Therefore, naïvely following the standard quadratic formula often yields one result with less relative precision than expected. Unfortunately, introductory algebra textbooks typically do not address this problem, even though it causes students to obtain inaccurate results in other school subjects such as introductory chemistry.
For example, if trying to solve the equation
x
2
−
1634
x
+
2
=
0
{\displaystyle \textstyle x^{2}-1634x+2=0}
using a pocket calculator, the result of the quadratic formula
x
=
817
±
667
487
{\displaystyle \textstyle x=817\pm {\sqrt {667\,487}}}
might be approximately calculated as:
x
1
=
817
+
816.998
776
0
=
1.633
998
776
×
10
3
,
x
2
=
817
−
816.998
776
0
=
1.224
×
10
−
3
.
{\displaystyle {\begin{alignedat}{3}x_{1}&=817+816.998\,776\,0&&=1.633\,998\,776\times 10^{3},\\x_{2}&=817-816.998\,776\,0&&=1.224\times 10^{-3}.\end{alignedat}}}
Even though the calculator used ten decimal digits of precision for each step, calculating the difference between two approximately equal numbers has yielded a result for
x
2
{\displaystyle x_{2}}
with only four correct digits.
One way to recover an accurate result is to use the identity
x
1
x
2
=
c
/
a
{\displaystyle x_{1}x_{2}=c/a}
. In this example
x
2
{\displaystyle x_{2}}
can be calculated as
x
2
=
2
/
x
1
=
{\displaystyle x_{2}=2/x_{1}={}}
1.223
991
125
×
10
−
3
{\displaystyle 1.223\,991\,125\times 10^{-3}\!}
, which is correct to the full ten digits. Another more or less equivalent approach is to use the version of the quadratic formula with the square root in the denominator to calculate one of the roots (see § Square root in the denominator above).
Practical computer implementations of the solution of quadratic equations commonly choose which formula to use for each root depending on the sign of
b
{\displaystyle b}
.
These methods do not prevent possible overflow or underflow of the floating-point exponent in computing
b
2
{\displaystyle \textstyle b^{2}}
or
4
a
c
{\displaystyle 4ac}
, which can lead to numerically representable roots not being computed accurately. A more robust but computationally expensive strategy is to start with the substitution
x
=
−
u
sgn
(
b
)
|
c
|
/
|
a
|
{\displaystyle \textstyle x=-u\operatorname {sgn}(b){\sqrt {\vert c\vert }}{\big /}\!{\sqrt {\vert a\vert }}}
, turning the quadratic equation into
u
2
−
2
|
b
|
2
|
a
|
|
c
|
u
+
sgn
(
c
)
=
0
,
{\displaystyle u^{2}-2{\frac {|b|}{2{\sqrt {|a|}}{\sqrt {|c|}}}}u+\operatorname {sgn}(c)=0,}
where
sgn
{\displaystyle \operatorname {sgn} }
is the sign function. Letting
d
=
|
b
|
/
2
|
a
|
|
c
|
{\displaystyle \textstyle d=\vert b\vert {\big /}2{\sqrt {\vert a\vert }}{\sqrt {\vert c\vert }}}
, this equation has the form
u
2
−
2
d
u
±
1
=
0
{\displaystyle \textstyle u^{2}-2du\pm 1=0}
, for which one solution is
u
1
=
d
+
d
2
∓
1
{\displaystyle \textstyle u_{1}=d+{\sqrt {d^{2}\mp 1}}}
and the other solution is
u
2
=
±
1
/
u
1
{\displaystyle \textstyle u_{2}=\pm 1/u_{1}}
. The roots of the original equation are then
x
1
=
−
sgn
(
b
)
(
|
c
|
/
|
a
|
)
u
1
{\displaystyle \textstyle x_{1}=-\operatorname {sgn}(b){\bigl (}{\sqrt {\vert c\vert }}{\big /}\!{\sqrt {\vert a\vert }}~\!{\bigr )}u_{1}}
and
x
2
=
−
sgn
(
b
)
(
|
c
|
/
|
a
|
)
u
2
{\displaystyle \textstyle x_{2}=-\operatorname {sgn}(b){\bigl (}{\sqrt {\vert c\vert }}{\big /}\!{\sqrt {\vert a\vert }}~\!{\bigr )}u_{2}}
.
With additional complication the expense and extra rounding of the square roots can be avoided by approximating them as powers of two, while still avoiding exponent overflow for representable roots.
Historical development
The earliest methods for solving quadratic equations were geometric. Babylonian cuneiform tablets contain problems reducible to solving quadratic equations. The Egyptian Berlin Papyrus, dating back to the Middle Kingdom (2050 BC to 1650 BC), contains the solution to a two-term quadratic equation.
The Greek mathematician Euclid (circa 300 BC) used geometric methods to solve quadratic equations in Book 2 of his Elements, an influential mathematical treatise Rules for quadratic equations appear in the Chinese The Nine Chapters on the Mathematical Art circa 200 BC. In his work Arithmetica, the Greek mathematician Diophantus (circa 250 AD) solved quadratic equations with a method more recognizably algebraic than the geometric algebra of Euclid. His solution gives only one root, even when both roots are positive.
The Indian mathematician Brahmagupta included a generic method for finding one root of a quadratic equation in his treatise Brāhmasphuṭasiddhānta (circa 628 AD), written out in words in the style of the time but more or less equivalent to the modern symbolic formula. His solution of the quadratic equation
a
x
2
+
b
x
=
c
{\displaystyle \textstyle ax^{2}+bx=c}
was 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."
In modern notation, this can be written
x
=
(
c
⋅
4
a
+
b
2
−
b
)
/
2
a
{\displaystyle \textstyle x={\bigl (}{\sqrt {c\cdot 4a+b^{2}}}-b{\bigr )}{\big /}2a}
. The Indian mathematician Śrīdhara (8th–9th century) came up with a similar algorithm for solving quadratic equations in a now-lost work on algebra quoted by Bhāskara II. The modern quadratic formula is sometimes called Sridharacharya's formula in India and Bhaskara's formula in Brazil.
The 9th-century Persian mathematician Muḥammad ibn Mūsā al-Khwārizmī solved quadratic equations algebraically. The quadratic formula covering all cases was first obtained by Simon Stevin in 1594. In 1637 René Descartes published La Géométrie containing special cases of the quadratic formula in the form we know today.
Geometric significance
In terms of coordinate geometry, an axis-aligned parabola is a curve whose
(
x
,
y
)
{\displaystyle (x,y)}
-coordinates are the graph of a second-degree polynomial, of the form
y
=
a
x
2
+
b
x
+
c
{\displaystyle \textstyle y=ax^{2}+bx+c}
, where
a
{\displaystyle a}
,
b
{\displaystyle b}
, and
c
{\displaystyle c}
are real-valued constant coefficients with
a
≠
0
{\displaystyle a\neq 0}
.
Geometrically, the quadratic formula defines the points
(
x
,
0
)
{\displaystyle (x,0)}
on the graph, where the parabola crosses the
x
{\displaystyle x}
-axis. Furthermore, it can be separated into two terms,
x
=
−
b
±
b
2
−
4
a
c
2
a
=
−
b
2
a
±
b
2
−
4
a
c
2
a
.
{\displaystyle x={\frac {-b\pm {\sqrt {b^{2}-4ac}}}{2a}}=-{\frac {b}{2a}}\pm {\frac {\sqrt {b^{2}-4ac}}{2a}}.}
The first term describes the axis of symmetry, the line
x
=
−
b
2
a
{\displaystyle x=-{\tfrac {b}{2a}}}
. The second term,
b
2
−
4
a
c
/
2
a
{\displaystyle \textstyle {\sqrt {b^{2}-4ac}}{\big /}2a}
, gives the distance the roots are away from the axis of symmetry.
If the parabola's vertex is on the
x
{\displaystyle x}
-axis, then the corresponding equation has a single repeated root on the line of symmetry, and this distance term is zero; algebraically, the discriminant
b
2
−
4
a
c
=
0
{\displaystyle \textstyle b^{2}-4ac=0}
.
If the discriminant is positive, then the vertex is not on the
x
{\displaystyle x}
-axis but the parabola opens in the direction of the
x
{\displaystyle x}
-axis, crossing it twice, so the corresponding equation has two real roots. If the discriminant is negative, then the parabola opens in the opposite direction, never crossing the
x
{\displaystyle x}
-axis, and the equation has no real roots; in this case the two complex-valued roots will be complex conjugates whose real part is the
x
{\displaystyle x}
value of the axis of symmetry.
Dimensional analysis
If the constants
a
{\displaystyle a}
,
b
{\displaystyle b}
, and/or
c
{\displaystyle c}
are not unitless then the quantities
x
{\displaystyle x}
and
b
a
{\displaystyle {\tfrac {b}{a}}}
must have the same units, because the terms
a
x
2
{\displaystyle \textstyle ax^{2}}
and
b
x
{\displaystyle bx}
agree on their units. By the same logic, the coefficient
c
{\displaystyle c}
must have the same units as
b
2
a
{\displaystyle {\tfrac {b^{2}}{a}}}
, irrespective of the units of
x
{\displaystyle x}
. This can be a powerful tool for verifying that a quadratic expression of physical quantities has been set up correctly.
See also
Fundamental theorem of algebra
Vieta's formulas
Notes
References
Smith, David Eugene (1923), History of Mathematics, vol. 2, Boston: Ginn
Irving, Ron (2013), Beyond the Quadratic Formula, MAA, ISBN 978-0-88385-783-0
Kata Kunci Pencarian:
- Rumus kuadrat
- TeX
- Turunan kedua
- Rangkap tiga Pythagoras
- Rupa huruf
- Persamaan kubik
- Bilangan riil negatif
- Hipotesis Riemann
- Pemelajaran mesin daring
- Quadratic formula
- Quadratic equation
- Quadratic function
- Glomerular filtration rate
- Quadratic
- Completing the square
- Quadratic form
- Solving quadratic equations with continued fractions
- Fibonacci sequence
- TeX