While the quadratic formula for solving quadratic equations is familiar to everyone who has taken high school math, it seems that the formula for solving cubic equations is not as familiar, but it is occasionally very handy. This formula was first discovered by Girolamo Cardano, Scipione del Ferro and Niccolo Fontana Tartaglia, and first published in Cardano's Ars Magna in 1545, and is considered a major result in Renaissance mathematics.

The general cubic equation can be expressed as follows:

x3 + bx2 + cx + d = 0

We may then calculate the following two values (somewhat analogous to the discriminant of the quadratic formula):

q = (b2 - 3c)/9

r = (2b3 9bc + 27d)/54

If the coefficients of the cubic are all real, then the sum p = q3 + r2 determines what sort of roots the cubic polynomial might possess. If p is greater than 0, then it possesses one real root and two complex conjugate roots. If p is equal to zero, all roots are real, and we have roots of at least multiplicity 2. If p is less than zero, then all three roots are real.

In the latter case, we can proceed by computing:

θ = cos-1(r/sqrt(q3))

The three real roots may then be readily computed as:

x1 = -2 sqrt(q) cos(θ/3) - b/3

x2 = -2 sqrt(q) cos((θ + 2π)/3) - b/3

x3 = -2 sqrt(q) cos((θ - 2π/3) - b/3

If the coefficients are complex, or if either of the other two cases applies, we then compute these two values:

s1 = (r + sqrt(q3 + r2))1/3

s2 = (r - sqrt(q3 + r2))1/3

The roots of the cubic are then:

x1 = s1 + s2 - b/3

x2 = -(s1 + s2)/2 - b/3 + (i sqrt(3)/2)(s1 - s2)

x3 = -(s1 + s2)/2 - b/3 - (i sqrt(3)/2)(s1 - s2)

In practice, it's usually easier to just use one of these formulas to compute the root (the first one usually), and then remove that root using synthetic division and solve the resultant quadratic equation.

If one is doing these kinds of calculations by hand, a simple check would be to use the symmetric functions generated by the cubic, namely:

x1 + x2 + x3 = -b

x1x2 + x1x3 + x2x3 = c

x1x2x3 = -d

and see if these formulas on the roots match with the coefficients of the original cubic.

In the computer age however, this cubic formula is only seldom used to numerically compute the roots of cubic polynomials, as iterative numerical methods like Laguerre's method or the Jenkins-Traub method can generally do the job much more efficiently for equations of this degree and higher.

Sources:

William H. Press, et. al. Numerical Recipes in FORTRAN

Milton Abramowitz and Irene A. Stegun, Handbook of Mathematical Functions

Log in or registerto write something here or to contact authors.