Cubic and Quartic Formulas: B B Ac A
Cubic and Quartic Formulas: B B Ac A
James T. Smith
San Francisco State University
Quadratic formula
You’ve met the quadratic formula in algebra courses: the solution of the quadratic
equation
ax 2 + bx + c = 0
b b2 4 ac
x= .
2a
You can derive the formula as follows. First, divide the quadratic by a to get the
equivalent equation
b c
x2 + x+ =0.
a a
Now substitute x = y + d. You’ll choose d later so that the resulting equation is easy
to solve. Making the substitution, you get
b c
( y + d)2 + ( y + d) + =0.
a a
Work this out, ignoring some details that won’t be necessary:
b
y2 + 2 d y + d2 y + constants = 0
a
b
y 2 + 2d y + constants = 0.
a
If the y coefficient were zero, you could move the constants to the other side and solve
for y by taking the square root. Thus you can find y easily if you let d = – b/(2a). Do
that and work out the details: the last equation displayed above becomes
2 b2 c
y – 2
+ =0
4a a
2013-08-25 14:45
Page 2 CUBIC & QUARTIC FORMULAS
b2 4 ac
y2 = .
4 a2
The quantity D = b2 – 4ac is called the discriminant of the quadratic: you can write
y = ± D /(2a). Finally, the desired solution is
b D
x=d+y=– ±
2a 2a
—the Quadratic Formula. If D < 0 then you can write x in complex form:
b D
x=d+y=– ± i.
2a 2a
Cubic formula
It’s possible to imitate this process to derive a formula for solving a cubic equation
ax 3 + bx 2 + cx + d = 0
with specified real coefficients a =
/ 0, b, c, and d. First, divide the cubic by a to get
the equivalent equation
b 2 c d
x3 + x + x+ =0.
a a a
Next, make a substitution x = y + e, and choose e so that the resulting equation is
easier to solve. Experience with the quadratic equation suggests that you might be able
to make one term of the cubic disappear, so that the resulting equation is like one of
these:
y3 + f y2 + g = 0 y 3 + py + q = 0.
Experimentation would show that you can reach the form on the left, but it doesn’t lead
anywhere. However, you can also get the one on the right, and it does help. In fact, if
you let e = – b/(3a) —that is, substitute x = y – b/(3a) —then you get, after consider-
able algebraic labor, the equation
y 3 + py + q = 0,
where
b2 c 2 b3 bc d
p= 2
+ q= 3
– 2
+ .
3a a 27 a 3a a
CUBIC & QUARTIC FORMULAS Page 3
You’ve now reduced the problem of solving the original cubic to one of solving y3 + py +
q = 0 and setting x = y – b/(3a).
6 p3 3
z + qz – = 0.
27
This equation is quadratic in z 3. You can find z 3 by using the quadratic formula:
q
z3 = – ± D,
2
where
q2 p3
D= + .
4 27
This D is called the discriminant of the cubic equation. Taking the cube root, you get
q
3 D .
2
Together with the equations
p b
y=z– x=y–
3z 3a
this is called the cubic formula: it shows you how to compute the solution x of the
original cubic equation. Actually, the equation for z gives three complex cube roots for
each of the + and – signs, hence six different formulas for z. But when you substitute
these in the equation for y, at most three different y values will result, and the last
equation will thus give at most three distince roots x.
Look at the cubic formula in more detail. When D $ 0, you can select one of the
two real square roots ± D , then find three cube roots z = z 0 , z1 , and z 2 of
– q/2 ± D as follows. Let z 0 be the real cube root, then z1 = z 0 and z 2 = 2 z 0 ,
where and 2 are the two complex cube roots of 1:
1 3 1 3
=– + i 2 = – – i.
2 2 2 2
You can use simple algebra of complex numbers to find the corresponding values y
and x.
Page 4 CUBIC & QUARTIC FORMULAS
The situation is more interesting when D < 0, for then D is imaginary, and
you have to find the cube roots z of the complex number
q
A=– + D i .
2
In this case,
q2 p3
0>D= + ,
4 27
so p < 0. Next,
2
q2 p3
q
2
*A* = +
2
D = –D=–
2 4 27
3
p 2
*A* = .
3
Now you can write A = *A* cis , where
q
Re A 2 3 3q
cos = = 3 = .
A 2p p
p 2
3
Given coefficients a to d, you can compute p and q from the previous equations,
calculate cos 2, then determine 2. Now let
p
r= 3 A = ,
3
so that De Moivre’s formula yields the three values
z= 3
A = r cis ,
where
= , + 120E, + 240E.
3 3 3
CUBIC & QUARTIC FORMULAS Page 5
The details of the final calculation of y and x are interesting, too. You’ll get
p p
y=z– = r cis –
3z 3r cis
p p
= r cis – (cis )–1 = r cis – cis(– )
3r 3r
p
= r [cos + i sin ] – [cos(– ) + i sin(– )]
3r
p p
= r cos + r i sin .
3r 3r
But
p p p
r+ = + = 0,
3r 3 p
3
3
hence all three y values are real! You have
p
y = r cos
3r
for the three values of R given earlier. In this case, where D < 0, you’ve found the real
roots of a real cubic equation through use of complex numbers and trigonometry. It’s
now known that some such ‘detour’ through the complex numbers is necessary to find
a formula for these roots!
Example cubics
b2 c 5
p= 2
+ =
3a a 16
Page 6 CUBIC & QUARTIC FORMULAS
2 b3 bc d 5
q= 3
– 2
+ =
27 a 3a a 32
p 5
y=z– =z–
3z 48z
b 1
x=y– =y–
3a 4
q2 p3 25
D= + = .
4 27 3456
Since D > 0, there are one real and two conjugate complex roots. Compute the real root
as follows:
q 45 20 6 0.1906230
z= 3 D = 3 . .
2 576 0.5464530
Both z values give the same value of
5
y=z– . – 0.35583
48 z
1
x=y– . – 0.60583.
4
Substituting this x value in the left-hand side of the original equation yields a value of
about –1×10–6 —acceptable accuracy. The complex roots are computed from the other
two cube roots:
1 3
z . 0.1906280 i . – 0.0953115 ± 0.1650844i
2 2
5
y=z– . 0.17792 ± 0.63827i
48z
1
x=y– . – 0.07208 ± 0.63827i.
4
Substituting these x values in the left-hand side of the original equation yields values
with norms of about 2×10–4 i —acceptable accuracy.
q2 p3 5
D= + =– .
4 27 108
Since D < 0, there are three real roots, determined as follows:
3 3q
cos = . – 0.91856
2p p
. 156.716E
= , + 120E, + 240E . 52.239E, 172.239E, 292.239E
3 3 3
p 2
r= =
3 3
p
y = r cos . 1.00000, –1.61803, 0.61803
3r
The first value of y suggests that y = 1 is an exact root of the cubic. That’s easy to
verify: in fact,
y 3 – 2 y + 1 = ( y – 1)( y 2 + y – 1) .
The roots of the right-hand factor are (–1 ± 5 )/2, which agree with the other two
computed y values.
Quartic formula
Why stop with cubics? Why not apply the same method to a quartic equation
ax 4 + bx 3 + cx 2 + dx + e = 0
with real coefficients a =
/ 0, b, c, d, and e? First divide the quartic by a to obtain the
equivalent equation
b 3 c d e
x4 + x + x2 + x+ =0.
a a a a
Page 8 CUBIC & QUARTIC FORMULAS
The substitutions x = y – b/(2a) and x = y – b/(3a) worked for the quadratic and cubic;
try x = y – b/(4a) for the quartic. After a lot of algebra, you’ll get an equation of the
form
y 4 + py 2 + q y + r = 0
for certain values p, q, and r that you can compute from the original coefficients. Not
long after the trick was discovered that led to the solution of the cubic, mathematicians
discovered one that leads to the solution of this quartic. Write it as
y 4 = – py 2 – q y – r.
Now manipulate this equation, using a value z that will be determined later:
y 4 + 2 y 2 z 2 + z 4 = – py 2 – q y – r + 2 y 2 z 2 + z 4
( y 2 + z 2 )2 = (2z 2 – p) y 2 – q y + (z 4 – r).
Later, you’ll determine z so that the right-hand side of this last equation is ( f y + g)2
for some particular values f and g. Then you’ll have
( y 2 + z 2 )2 = ( f y + g)2
y2 + z2 = ±( f y + g)
y 2 fy ( z 2 g) 0, or
2
y fy ( z g) 0.
2
Once z then f and g are found, you can solve for y by using the quadratic formula
on the last pair of equations.
q 2 – 4(2z 2 – p)(z 4 – r) = 0
– 8z 6 + 4 pz 4 + 8rz 2 + (q 2 – 4 pr) = 0
w z2
8w 4 pw 8 rw (4 pr q ) 0.
3 2 2
CUBIC & QUARTIC FORMULAS Page 9
With sufficient labor, you can solve the last equation by using the cubic formula, getting
at most three solutions w = w0 , w1 , and w2 . For each j, the equation
(2wj – p) y 2 – q y + (wj2 – r) = 0
has a single root
q
y= .
2(2w j p)
Therefore, 2
q
(2wj – p) y 2 – q y + (wj2 – r) = (2wj – p) y
2(2w p)
j
2
q
= y 2w j p = ( f y + g)2 ,
2 2w j p
where
q
f= 2w j p g=– .
2f
With these three values of f and g, solve the two quadratic equations
y 2 fy ( z 2 g) 0
2
y fy ( z g) 0
2
for y. This yields as many as twelve possible y formulas, but at most four can have
distinct values. Finally, calculate the roots x = y – b/(4a).
Example quartic
To solve ax4 + bx3 + cx2 + dx + e = 0 with a, b, c, d, e = 2, 2, –3, –3, –4, follow the
quartic formula, dividing by a and setting
b 1
x=y– =y– ,
3a 4
to get the equation y 4 + py 2+ q y + r = 0, where p = –15/8, q = – 5/8, and r =
–443/256. Next, solve the equation 8w 3 – 4pw 2 – 8rw + (4 pr – q 2 ) = 0 by the cubic
formula, obtaining three solutions
w 0 . – 0.918531
w1 . – 0.00948425 + 1.30880i
w2 = w—.
1
Page 10 CUBIC & QUARTIC FORMULAS
With j = 0 compute
q
f= 2w j p , g=– ,
2f
solve y 2 – f y + (wj – g) = 0 for two values y = y 0 and y1 , and set x k = yk – b/(4a) for
k = 0, 1 to get
x 0 . –1.74398, x1 . 1.43875.
Next, solve y 2 + f y + (wj + g) = 0 for two values y = y2 and y3, and set xk =
yk – b/(4a) for k = 2, 3 to get
x . – 0.347387 + 0.822439i,
2 x =— x .
3 2
With j = 1, 2 this process yields the same four roots x. Substituting these x values
back in the original quartic equation yields values with norm less than 2×10–10
—acceptable accuracy. Like the cubic examples considered earlier, these roots can be
expressed exactly with radicals and trigonometric functions. However, their expressions
would be so complicated that checking and using them would be impractical.
History
The Italians were handicapped by their lack of notation for variables. This was
provided by François Viète (1540–1603), a politician and lawyer from Brittany involved
with the Huguenot cause. He pursued mathematics as a hobby, especially while out of
office, and published privately a number of treatises in which he used an algebraic
symbolism similar to ours. The treatment of cubic and quartic equations given here is
essentially his.
The modern theory of roots of polynomials in general was not developed until the
middle 1600s by Descartes and others. The first complete treatment of cubic and quartic
equations was given by Euler in 1732. During the 1600s and 1700s, mathematicians
regarded extension of these methods to quintic and higher equations as a major open
problem, but met with no success. Not until 1800 did Gauss prove that every polynomial
has at least one complex root, and not until about 1830 did Galois, Abel, and others show
that roots of quintic and higher degree equations could not, in general, be found by the
familiar methods involving algebraic operations and extraction of roots.
Exercises
Find all roots of each of the following cubics. Verify each real root by substituting
it for x and calculating the left hand side of the equation.
1. x 3 – 6x – 6 = 0
2. 3x 3 – 6x 2 – 2 = 0
3. x 3 – 6x + 2 = 0
4. x 3 + x 2 – 2x – 1 = 0
Acknowledgement
Thanks to Singapore student Jessica Ng for finding two serious typographical errors in
the previous version of this note.
Page 12 CUBIC & QUARTIC FORMULAS
Solutions
z0 = 3
4 z1 = z 1 –,
z2 = z0
and x = x 0 , x1 , or x 2 , where
2
x0 = z0 + = 3
4 + 6
4 . 2.84732
z0
2 2 – 1 3 2 1 3
x1 = z1 + = z0 + = z0 i + i
z1 z0 2 2 z0 2 2
1 2 3 2
= z0
2 z0 2
z0 i =
z0
x0
2
+
2
3 3
464 i
. –1.42366 – 0.28361i
x2 = —
x1 . –1.42366 + 0.28361i.
4 – 1 3 13
y1 = z 0 +
9z0
= – y0 +
2 6
5
2 2 3 i
y2 = —
y1 .
Thus
x 0 . 2.14490
x1 . – 0.072452 – 0.55278 i
x 2 . – 0.072452 + 0.55278 i.
z 3 = –1 ± 7 i = r cis
r= 17 = 2 2
1 2
cos = – =–
r 4
= 0 , 0 + 2, or 0 + 4
2
0 = cos–1 . 1.93216
4
z= 3
r cis = 2 cis
3 3
2 2
x=z+ = 2 cis +
z 3
2 cis
3
= 2 cis + 2 cis = 2 2 cos
3 3 3
. 2.2618052, – 2.6016777, or 0.33987722.
343 7
z3 + 3
– =0
729z 27
7 3 343
z6 – z + =0
27 729
7 21 3
z3 = i = r cis
54 54
3
72
r= 3
3
7
3
r =
3
7
cos =
14
= 0 , 0 + 2, or 0 + 4
7
0 = cos–1 . 1.38067
14
7
z = 3 r cis = cis
3 3 3
7 7 7
y=z+ = cis +
9z 3 3
3 7 cis
3
7 7 2 7
= cis + cis = cos
3 3 3 3 3 3
1
x=y– . 1.2469792, –1.8019369, or – 0.4450425.
3