# Cubic equation

Graph of a cubic function with 3 real roots (where the curve crosses the horizontal axis—where y = 0) (and hence no complex roots). The case shown has two critical points. Here the function is ƒ(x) = (x3 + 3x2 − 6x − 8) / 4. There would be only one real root, and two complex roots, if the local minimum were above the x axis, or if the local maximum were below the x axis, or if there were no local minimum or maximum and the inflection point were off the x axis.

In algebra, a cubic function is a function of the form

where a is nonzero. In other words, a cubic function is defined by a polynomial of degree three.

Setting ƒ(x) = 0 produces a cubic equation of the form:

Usually, the coefficients a, b, c, d are real numbers. However much of the theory of cubic equations for real coefficients applies to other types of coefficients (such as complex ones).

Solving the cubic equation is equivalent to finding the particular value (or values) of x for which ƒ(x) = 0. There are various methods to solve cubic equations. The solutions of a cubic equation, also called roots of the cubic function, can always be found algebraically. (This is also true of a quadratic or quartic (fourth degree) equation, but no higher-degree equation, by the Abel–Ruffini theorem). The roots can also be found trigonometrically. Alternatively, one can find a numerical approximation of the roots in the field of the real or complex numbers such as by using root-finding algorithms like Newton's method.

## History

Cubic equations were known to the ancient Babylonians, Greeks, Chinese, Indians, and Egyptians.Babylonian (20th to 16th centuries BC) cuneiform tablets have been found with tables for calculating cubes and cube roots. The Babylonians could have used the tables to solve cubic equations, but no evidence exists to confirm that they did. The problem of doubling the cube involves the simplest and oldest studied cubic equation, and one for which the ancient Egyptians did not believe a solution existed. In the 5th century BC, Hippocrates reduced this problem to that of finding two mean proportionals between one line and another of twice its length, but could not solve this with a compass and straightedge construction, a task which is now known to be impossible. Methods for solving cubic equations appear in The Nine Chapters on the Mathematical Art, a Chinese mathematical text compiled around the 2nd century BC and commented on by Liu Hui in the 3rd century. In the 3rd century, the ancient Greek mathematician Diophantus found integer or rational solutions for some bivariate cubic equations (Diophantine equations).Hippocrates, Menaechmus and Archimedes are believed to have come close to solving the problem of doubling the cube using intersecting conic sections, though historians such as Reviel Netz dispute whether the Greeks were thinking about cubic equations or just problems that can lead to cubic equations. Some others like T. L. Heath, who translated all Archimedes' works, disagree, putting forward evidence that Archimedes really solved cubic equations using intersections of two cones, but also discussed the conditions where the roots are 0, 1 or 2.

Two-dimensional graph of a cubic, the polynomial ƒ(x) = 2x3 − 3x2 − 3x + 2.

In the 7th century, the Tang dynasty astronomer mathematician Wang Xiaotong in his mathematical treatise titled Jigu Suanjing systematically established and solved 25 cubic equations of the form , 23 of them with , and two of them with .

In the 11th century, the Persian poet-mathematician, Omar Khayyám (1048–1131), made significant progress in the theory of cubic equations. In an early paper, he discovered that a cubic equation can have more than one solution and stated that it cannot be solved using compass and straightedge constructions. He also found a geometric solution. In his later work, the Treatise on Demonstration of Problems of Algebra, he wrote a complete classification of cubic equations with general geometric solutions found by means of intersecting conic sections.

In the 12th century, the Indian mathematician Bhaskara II attempted the solution of cubic equations without general success. However, he gave one example of a cubic equation:

In the 12th century, another Persian mathematician, Sharaf al-Dīn al-Tūsī (1135–1213), wrote the Al-Mu'adalat (Treatise on Equations), which dealt with eight types of cubic equations with positive solutions and five types of cubic equations which may not have positive solutions. He used what would later be known as the "Ruffini-Horner method" to numerically approximate the root of a cubic equation. He also developed the concepts of a derivative function and the maxima and minima of curves in order to solve cubic equations which may not have positive solutions. He understood the importance of the discriminant of the cubic equation to find algebraic solutions to certain types of cubic equations.

Leonardo de Pisa, also known as Fibonacci (1170–1250), was able to closely approximate the positive solution to the cubic equation x3 + 2x2 + 10x = 20, using the Babylonian numerals. He gave the result as 1,22,7,42,33,4,40 (equivalent to 1 + 22/60 + 7/602 + 42/603 + 33/604 + 4/605 + 40/606), which differs from the correct value by only about three trillionths.

In the early 16th century, the Italian mathematician Scipione del Ferro (1465–1526) found a method for solving a class of cubic equations, namely those of the form x3 + mx = n. In fact, all cubic equations can be reduced to this form if we allow m and n to be negative, but negative numbers were not known to him at that time. Del Ferro kept his achievement secret until just before his death, when he told his student about it.

Niccolò Fontana Tartaglia

In 1530, Niccolò Tartaglia (1500–1557) received two problems in cubic equations from and announced that he could solve them. He was soon challenged by Fiore, which led to a famous contest between the two. Each contestant had to put up a certain amount of money and to propose a number of problems for his rival to solve. Whoever solved more problems within 30 days would get all the money. Tartaglia received questions in the form x3 + mx = n, for which he had worked out a general method. Fiore received questions in the form x3 + mx2 = n, which proved to be too difficult for him to solve, and Tartaglia won the contest.

Later, Tartaglia was persuaded by Gerolamo Cardano (1501–1576) to reveal his secret for solving cubic equations. In 1539, Tartaglia did so only on the condition that Cardano would never reveal it and that if he did write a book about cubics, he would give Tartaglia time to publish. Some years later, Cardano learned about Ferro's prior work and published Ferro's method in his book Ars Magna in 1545, meaning Cardano gave Tartaglia 6 years to publish his results (with credit given to Tartaglia for an independent solution). Cardano's promise with Tartaglia stated that he not publish Tartaglia's work, and Cardano felt he was publishing del Ferro's, so as to get around the promise. Nevertheless, this led to a challenge to Cardano by Tartaglia, which Cardano denied. The challenge was eventually accepted by Cardano's student Lodovico Ferrari (1522–1565). Ferrari did better than Tartaglia in the competition, and Tartaglia lost both his prestige and income.

Cardano noticed that Tartaglia's method sometimes required him to extract the square root of a negative number. He even included a calculation with these complex numbers in Ars Magna, but he did not really understand it. Rafael Bombelli studied this issue in detail and is therefore often considered as the discoverer of complex numbers.

François Viète (1540–1603) independently derived the trigonometric solution for the cubic with three real roots, and René Descartes (1596–1650) extended the work of Viète.

## Critical points of a cubic function

The roots, turning points, stationary points, inflection point and concavity of a cubic polynomial x³ - 3x² - 144x + 432 (black line) and its first and second derivatives (red and blue).

The critical points of a cubic equation are those values of x where the slope of the cubic function is zero. They are found by setting derivative of the cubic equation equal to zero obtaining: f ′(x) = 3ax2 + 2bx + c = 0. The solutions of that equation are the critical points of the cubic equation and are given by: (using the quadratic formula)

If b2 − 3ac > 0, then the cubic function has a local maximum and a local minimum. If b2 − 3ac = 0, then the cubic's inflection point is the only critical point. If b2 − 3ac < 0, then there are no critical points. In the cases where b2 − 3ac ≤ 0, the cubic function is strictly monotonic.

## Roots of a cubic function

The general cubic equation has the form

with

This section describes how the roots of such an equation may be computed. The coefficients a, b, c, d are generally assumed to be real numbers, but most of the results apply when they belong to any field of characteristic not 2 or 3.

### The nature of the roots

Every cubic equation (1) with real coefficients has at least one solution x among the real numbers; this is a consequence of the intermediate value theorem. We can distinguish several possible cases using the discriminant,

The following cases need to be considered:

• If Δ > 0, then the equation has three distinct real roots.
• If Δ = 0, then the equation has a multiple root and all its roots are real.
• If Δ < 0, then the equation has one real root and two nonreal complex conjugate roots.

For information about the location in the complex plane of the roots of a polynomial of any degree, including degree three, see Properties of polynomial roots and Routh–Hurwitz stability criterion

### General formula for roots

For the general cubic equation

the general formula for the roots, in terms of the coefficients, is as follows:

where

are the three cube roots of unity, and where

(see below for special cases)

with

and

where is the discriminant discussed above.

In these formulae, and denote any choice for the square or cube roots. Changing of choice for the square root amounts to exchanging and . Changing of choice for the cube root amounts to circularly permuting the roots. Thus the freeness of choosing a determination of the square or cube roots corresponds exactly to the freeness for numbering the roots of the equation.

Four centuries ago, Gerolamo Cardano proposed a similar formula (see below), which still appears in many textbooks:

where

and is the complex conjugate of (note that ).

However, this formula is applicable without further explanation only when a, b, c, d are real numbers and the operand of the square root, i.e., , is non-negative. When this operand is real and non-negative, the square root refers to the principal (positive) square root and the cube roots in the formula are to be interpreted as the real ones. Otherwise, there is no real square root and one can arbitrarily choose one of the imaginary square roots (the same one everywhere in the solution). For extracting the complex cube roots of the resulting complex expression, we have also to choose among three cube roots in each part of each solution, giving nine possible combinations of one of three cube roots for the first part of the expression and one of three for the second. The correct combination is such that the two cube roots chosen for the two terms in a given solution expression are complex conjugates of each other (whereby the two imaginary terms in each solution cancel out).

The next sections describe how these formulas may be obtained.

#### Special cases

If and the sign of has to be chosen to have that is one should define whichever is the sign of

If and the three roots are equal:

If and the above expression for the roots is correct but misleading, hiding the fact that no radical is needed to represent the roots. In fact, in this case, there is a double root,

and a simple root

### Reduction to a depressed cubic

Dividing Equation (1) by and substituting for (the Tschirnhaus transformation) we get the equation

where

The left hand side of equation (2) is a monic trinomial called a depressed cubic.

Any formula for the roots of a depressed cubic may be transformed into a formula for the roots of Equation (1) by substituting the above values for and and using the relation .

Therefore, only Equation (2) is considered in the following.

### Cardano's method

The solutions can be found with the following method due to Scipione del Ferro and Tartaglia, published by Gerolamo Cardano in 1545.

This method applies to the depressed cubic

We introduce two variables u and v linked by the condition

and substitute this in the depressed cubic (2), giving

.

At this point Cardano imposed a second condition for the variables u and v:

.

As the first parenthesis vanishes in (3), we get and . The combination of these two equations leads to a quadratic equation (since they are the sum and the product of and ). Thus and are the two roots of the following quadratic equation:

At this point, Cardano, who did not know complex numbers, supposed that the roots of this equation were real, that is that

Solving this equation and using the fact that and may be exchanged, we find

and .

As these expressions are real, their cube roots are well-defined and, like Cardano, we get

Given the assumption that Equation (2) also has two complex roots. These are obtained by considering the complex cube roots appearing in the above formula; the fact is real implies that one is obtained by multiplying the first of the above cube roots by and the second by , and vice versa for the other one.

If is not necessarily positive, we have to choose a cube root of . As there is no direct way to choose the corresponding cube root of , one has to use the relation , which gives

and

Note that the sign of the square root does not affect the resulting , because changing it amounts to exchanging and . We have chosen the minus sign to have when and , in order to avoid a division by zero. With this choice, the above expression for always works, except when , where the second term becomes 0/0. In this case there is a triple root .

Note also that in several cases the solutions are expressed with fewer square or cube roots

If then we have the triple real root
If and then
and the three roots are the three cube roots of .
If and then
in which case the three roots are
where
Finally if , there are a double root and an isolated root which may be expressed rationally in terms of , but these expressions may not be immediately deduced from the general expression of the roots:

To pass from these roots of in Equation (2) to the general formulas for roots of in Equation (1), subtract and replace and by their expressions in terms of .

### Vieta's substitution

Starting from the depressed cubic

we make the following substitution, known as Vieta's substitution:

This results in the equation

Multiplying by w3, it becomes a sextic equation in w, which is in fact a quadratic equation in w3:

The quadratic formula allows this to be solved for w3. If w1, w2 and w3 are the three cube roots of one of the solutions in w3, then the roots of the original depressed cubic are

### Lagrange's method

In his paper Réflexions sur la résolution algébrique des équations ("Thoughts on the algebraic solving of equations"), Joseph Louis Lagrange introduced a new method to solve equations of low degree.

This method works well for cubic and quartic equations, but Lagrange did not succeed in applying it to a quintic equation, because it requires solving a resolvent polynomial of degree at least six. This is explained by the Abel–Ruffini theorem, which proves that such polynomials cannot be solved by radicals. Nevertheless, the modern methods for solving solvable quintic equations are mainly based on Lagrange's method.

In the case of cubic equations, Lagrange's method gives the same solution as Cardano's. By drawing attention to a geometrical problem that involves two cubes of different size Cardano explains in his book Ars Magna how he arrived at the idea of considering the unknown of the cubic equation as a sum of two other quantities. Lagrange's method may also be applied directly to the general cubic equation (1) without using the reduction to the depressed cubic equation (2). Nevertheless, the computation is much easier with this reduced equation.

Suppose that x0, x1 and x2 are the roots of equation (1) or (2), and define (a complex cube root of 1, i.e. a primitive third root of unity) which satisfies the relation . We now set

This is the discrete Fourier transform of the roots: observe that while the coefficients of the polynomial are symmetric in the roots, in this formula an order has been chosen on the roots, so these are not symmetric in the roots. The roots may then be recovered from the three si by inverting the above linear transformation via the inverse discrete Fourier transform, giving

The polynomial is an elementary symmetric polynomial and is thus equal to in case of Equation (1) and to zero in case of Equation (2), so we only need to seek values for the other two.

The polynomials and are not symmetric functions of the roots: is invariant, while the two non-trivial cyclic permutations of the roots send to and to , or to and to (depending on which permutation), while transposing and switches and ; other transpositions switch these roots and multiply them by a power of

Thus, , and are left invariant by the cyclic permutations of the roots, which multiply them by . Also and are left invariant by the transposition of and which exchanges and . As the permutation group of the roots is generated by these permutations, it follows that and are symmetric functions of the roots and may thus be written as polynomials in the elementary symmetric polynomials and thus as rational functions of the coefficients of the equation. Let and in these expressions, which will be explicitly computed below.

We have that and are the two roots of the quadratic equation

Thus the resolution of the equation may be finished exactly as described for Cardano's method, with and in place of and .

#### Computation of A and B

Setting , and , the elementary symmetric polynomials, we have, using that :

The expression for is the same with and exchanged. Thus, using we get

and a straightforward computation gives

Similarly we have

When solving Equation (1) we have

, and

With Equation (2), we have , and and thus:

and .

Note that with Equation (2), we have and , while in Cardano's method we have set and Thus we have, up to the exchange of and :

and .

In other words, in this case, Cardano's and Lagrange's method compute exactly the same things, up to a factor of three in the auxiliary variables, the main difference being that Lagrange's method explains why these auxiliary variables appear in the problem.

### Trigonometric (and hyperbolic) method

#### Trigonometric method for three real roots

When a cubic equation has three real roots, the formulas expressing these roots in terms of radicals involve complex numbers. It has been proved that when none of the three real roots is rational—the casus irreducibilis— one cannot express the roots in terms of real radicals. Nevertheless, purely real expressions of the solutions may be obtained using hypergeometric functions, or more elementarily in terms of trigonometric functions, specifically in terms of the cosine and arccosine functions.

The formulas which follow, due to François Viète, are true in general (except when p = 0), are purely real when the equation has three real roots, but involve complex cosines and arccosines when there is only one real root.

Starting from Equation (2), , let us set The idea is to choose to make Equation (2) coincide with the identity

In fact, choosing and dividing Equation (2) by we get

Combining with the above identity, we get

and thus the roots are

This formula involves only real terms if and the argument of the arccosine is between −1 and 1. The last condition is equivalent to which implies also . Thus the above formula for the roots involves only real terms if and only if the three roots are real.

Denoting by the above value of t0, and using the inequalities for a real number u such that the three roots may also be expressed as

If the three roots are real, we have

All these formulas may be straightforwardly transformed into formulas for the roots of the general cubic equation (1), using the back substitution described in Section Reduction to a depressed cubic.

#### Hyperbolic method for one real root

When there is only one real root (and p ≠ 0), it may be similarly represented using hyperbolic functions, as

If p ≠ 0 and the inequalities on the right are not satisfied (the case of three real roots), the formulas remain valid but involve complex quantities.

When , the above values of are sometimes called the Chebyshev cube root. More precisely, the values involving cosines and hyperbolic cosines define, when , the same analytic function denoted , which is the proper Chebyshev cube root. The value involving hyperbolic sines is similarly denoted when .

### Factorization

If the cubic equation with integer coefficients has a rational real root, it can be found using the rational root test: If the root is r = m / n fully reduced, then m is a factor of d and n is a factor of a, so all possible combinations of values for m and n can be checked for whether they satisfy the cubic equation.

The rational root test may also be used for a cubic equation with rational coefficients: by multiplication by the lowest common denominator of the coefficients, one gets an equation with integer coefficients which has exactly the same roots.

The rational root test is particularly useful when there are three real roots because the algebraic solution unhelpfully expresses the real roots in terms of complex entities; if the test yields a rational root, it can be factored out and the remaining roots can be found by solving a quadratic. The rational root test is also helpful in the presence of one real and two complex roots because again, if it yields a rational root, it allows all of the roots to be written without the use of cube roots: If r is any root of the cubic, then we may factor out (xr ) using polynomial long division to obtain

Hence if we know one root, perhaps from the rational root test, we can find the other two by using the quadratic formula to solve the quadratic , giving

for the other two roots.

### Fast numerical solution

The possibly fastest way to numerically find the real roots of a cubic polynomial proceeds in 6 steps:

1. normalization, i.e., division of the polynomial coefficients by the cubic coefficient, which leads to
2. determination of the inflection point,
3. determination of an initial value for the subsequent iteration depending on the value of If , the bounds of the roots are established with the Laguerre–Nair–Samuelson inequality: The initial value is then chosen as If , is already a root of the polynomial. If , the (only) root lies at . In these two cases, no iteration is needed.
4. iteration of the first root, , by Halley's method
5. deflation, i.e., division of the polynomial by , which leads to

If the roots differ by several orders of magnitude, round-off errors may affect the precision of the results (but this is true for cubic solvers based on Cardano's rule, too); it is possible, however, to minimize their effect by careful encoding. A C++ subroutine has been published (see the electronic supplement). If there is only 1 real root, the algorithm outlined above was found to be 1.3–1.7 times faster than a Cardano solver (Cardano's method + 1 post-iteration Newton step); if there are 3 real roots, the speedup is in the range 8–10.

### Geometric interpretation of the roots

#### Three real roots

For the cubic with three real roots, the roots are the projection on the x-axis of the vertices A, B, and C of an equilateral triangle. The center of the triangle has the same abscissa as the inflection point.

Viète's trigonometric expression of the roots in the three-real-roots case lends itself to a geometric interpretation in terms of a circle. When the cubic is written in depressed form , as shown above, the solution can be expressed as

Here is an angle in the unit circle; taking of that angle corresponds to taking a cube root of a complex number; adding for k = 1, 2 finds the other cube roots; and multiplying the cosines of these resulting angles by corrects for scale.

For the non-depressed case (shown in the accompanying graph), the depressed case as indicated previously is obtained by defining t such that so . Graphically this corresponds to simply shifting the graph horizontally when changing between the variables t and x, without changing the angle relationships. This shift moves the point of inflection and the centre of the circle onto the y-axis. Consequently, the roots of the equation in sum to zero.

#### One real and two complex roots

##### In the Cartesian plane
The slope of line RA is twice that of RH. Denoting the complex roots of the cubic as g±hi, g = (negative here) and h = = = =

If a cubic is plotted in the Cartesian plane, the real root can be seen graphically as the horizontal intercept of the curve. But further, if the complex conjugate roots are written as then g is the abscissa (the positive or negative horizontal distance from the origin) of the tangency point of a line that is tangent to the cubic curve and intersects the horizontal axis at the same place as does the cubic curve; and |h| is the square root of the tangent of the angle between this line and the horizontal axis.

##### In the complex plane

With one real and two complex roots, the three roots can be represented as points in the complex plane, as can the two roots of the cubic's derivative. There is an interesting geometrical relationship among all these roots.

The points in the complex plane representing the three roots serve as the vertices of an isosceles triangle. (The triangle is isosceles because one root is on the horizontal (real) axis and the other two roots, being complex conjugates, appear symmetrically above and below the real axis.) Marden's Theorem says that the points representing the roots of the derivative of the cubic are the foci of the Steiner inellipse of the triangle—the unique ellipse that is tangent to the triangle at the midpoints of its sides. If the angle at the vertex on the real axis is less than then the major axis of the ellipse lies on the real axis, as do its foci and hence the roots of the derivative. If that angle is greater than , the major axis is vertical and its foci, the roots of the derivative, are complex conjugates. And if that angle is , the triangle is equilateral, the Steiner inellipse is simply the triangle's incircle, its foci coincide with each other at the incenter, which lies on the real axis, and hence the derivative has duplicate real roots.

#### Omar Khayyám's solution

Omar Khayyám's geometric solution of a cubic equation, for the case a=2, b=16, giving the root 2. The fact that the vertical line intersects the x-axis at the center of the circle is specific to this particular example

As shown in this graph, to solve the third-degree equation where Omar Khayyám constructed the parabola the circle which has as a diameter the line segment of the positive x-axis, and a vertical line through the point above the x-axis, where the circle and parabola intersect. The solution is given by the length of the horizontal line segment from the origin to the intersection of the vertical line and the x-axis.

A simple modern proof of the method is the following: multiplying by x the equation, and regrouping the terms gives

The left-hand side is the value of y2 on the parabola. The equation of the circle being the right hand side is the value of y2 on the circle.

## Collinearities

The tangent lines to a cubic at three collinear points intercept the cubic again at collinear points.:p. 425,#290

## Applications

Cubic equations arise in various other contexts.

Marden's theorem states that the foci of the Steiner inellipse of any triangle can be found by using the cubic function whose roots are the coordinates in the complex plane of the triangle's three vertices. The roots of the first derivative of this cubic are the complex coordinates of those foci.

Given the cosine (or other trigonometric function) of an arbitrary angle, the cosine of one-third of that angle is one of the roots of a cubic.

The solution of the general quartic equation relies on the solution of its resolvent cubic.

In analytical chemistry, the Charlot equation, which can be used to find the pH of buffer solutions, can be solved using a cubic equation.

The plastic number, 1.3247... , is the sole real solution of the cubic equation

The eigenvalues of a 3×3 matrix are the roots of a cubic polynomial which is the characteristic polynomial of the matrix.

The characteristic equation of a third-order linear difference equation or differential equation is a cubic equation.

In chemical engineering and thermodynamics, cubic equations of state are used to model the PVT (pressure, volume, temperature) behavior of substances.

## References

• Anglin, W. S.; Lambek, Joachim (1995), "Mathematics in the Renaissance", The Heritage of Thales, Springers, pp. 125–131, ISBN 978-0-387-94544-6  Ch. 24.
• Dence, T. (November 1997), "Cubics, chaos and Newton's method", Mathematical Gazette (Mathematical Association) 81: 403–408, doi:10.2307/3619617, ISSN 0025-5572
• Dunnett, R. (November 1994), "Newton–Raphson and the cubic", Mathematical Gazette (Mathematical Association) 78: 347–348, doi:10.2307/3620218, ISSN 0025-5572
• Guilbeau, Lucye (1930), "The History of the Solution of the Cubic Equation", Mathematics News Letter 5 (4): 8–12, doi:10.2307/3027812, JSTOR 3027812
• Jacobson, Nathan (2009), Basic algebra 1 (2nd ed.), Dover, ISBN 978-0-486-47189-1
• Mitchell, D. W. (November 2007), "Solving cubics by solving triangles", Mathematical Gazette (Mathematical Association) 91: 514–516, ISSN 0025-5572
• Mitchell, D. W. (November 2009), "Powers of φ as roots of cubics", Mathematical Gazette (Mathematical Association) 93: ???, ISSN 0025-5572
• Press, WH; Teukolsky, SA; Vetterling, WT; Flannery, BP (2007), "Section 5.6 Quadratic and Cubic Equations", Numerical Recipes: The Art of Scientific Computing (3rd ed.), New York: Cambridge University Press, ISBN 978-0-521-88068-8
• Rechtschaffen, Edgar (July 2008), "Real roots of cubics: Explicit formula for quasi-solutions", Mathematical Gazette (Mathematical Association) 92: 268–276, ISSN 0025-5572
• Zucker, I. J. (July 2008), "The cubic equation – a new look at the irreducible case", Mathematical Gazette (Mathematical Association) 92: 264–268, ISSN 0025-5572
0.037144