What is a cubic equation?
A cubic equation is an equation where the highest power of x is 3, written as ax³ + bx² + cx + d = 0. Its solutions, called roots, are the values of x that make the equation true, and they are the points where the curve y = ax³ + bx² + cx + d crosses the x-axis. A cubic always has three roots if you count complex ones, but it can have one, two or three real roots.
The equation x³ − 6x² + 11x − 6 = 0 has three real roots: 1, 2 and 3, because the left side factors as (x − 1)(x − 2)(x − 3). The equation x³ + x + 1 = 0 has only one real root, about −0.68, and two complex roots that this calculator does not display. Knowing how many real roots there are is often as useful as knowing the roots themselves.
This calculator solves any cubic with real coefficients and shows all of its real roots, the discriminant that decides how many there are, and the sum of the roots, which follows from the coefficients alone. Type the four coefficients and the answer appears instantly.
How a cubic equation is solved
The method starts by removing the x² term, which turns the equation into the depressed cubic t³ + pt + q = 0, where t is x shifted by a fixed amount. For x³ − 6x² + 11x − 6 = 0, the shift is 2, and the depressed form is t³ − t = 0, with p = −1 and q = 0. Depressing the cubic does not change its roots; it only moves them sideways, which makes the formula simpler.
The discriminant of the depressed cubic is (q/2)² + (p/3)³, and its sign decides the case. If it is positive, there is one real root, found by Cardano's formula with cube roots. If it is zero or negative, there are three real roots, found by a trigonometric formula using cosines. For the example the discriminant is (0)² + (−1/3)³, which is about −0.04, so there are three real roots.
The three roots are then shifted back by the same amount they were shifted forward. The trigonometric method gives t values of −1, 0 and 1, and adding the shift of 2 gives the roots 1, 2 and 3. The cube roots in Cardano's formula are the inverse of cubing a number, and an exponent calculator checks a cube root by raising the answer to the third power. A quadratic equation calculator solves the simpler two-degree case with the quadratic formula.
The discriminant: how many real roots?
The discriminant is the single number that tells you what kind of answer to expect before you calculate the roots. A positive discriminant means one real root and two complex roots, which happens when the curve crosses the axis once and only touches it in the complex sense elsewhere. A negative discriminant means three distinct real roots, and the curve crosses the axis three times.
A discriminant of exactly zero means a repeated root: either a double root plus a single root, or a triple root where all three roots are the same. The equation (x − 1)³ = 0 expands to x³ − 3x² + 3x − 1 = 0, and its discriminant is zero with a triple root at x = 1. Repeated roots are where the curve touches the axis without crossing it, or flattens out completely.
The discriminant in this calculator is the discriminant of the depressed cubic, not of the original equation, but the two have the same sign, so the conclusion about the number of real roots is the same. Substituting each root by hand is the quickest check of all: put the value into the equation and confirm that it gives zero, allowing for rounding.
The cubic formula has a dramatic history. It was discovered by Scipione del Ferro around 1515, kept secret, and then solved independently by Niccolò Tartaglia, who told it to Gerolamo Cardano under an oath of secrecy. Cardano published it in 1545 in his book Ars Magna, breaking the oath and starting a bitter public dispute. The formula still bears Cardano's name, while Tartaglia's role is remembered in the history books rather than in the name.
A worked example: x³ − 6x² + 11x − 6 = 0
Type a = 1, b = −6, c = 11 and d = −6. The calculator depresses the cubic to t³ − t = 0, with p = −1 and q = 0, and the discriminant is about −0.04, which is negative, so there are three real roots. The trigonometric method gives t = −1, 0 and 1, and shifting back by 2 gives the roots 1, 2 and 3.
Check the roots by substitution. At x = 1: 1 − 6 + 11 − 6 = 0. At x = 2: 8 − 24 + 22 − 6 = 0. At x = 3: 27 − 54 + 33 − 6 = 0. Each root makes the equation true, which is the definition of a root. The sum of the roots is 6, which matches −b/a = 6, a useful check that comes from Vieta's formulas.
Now try x³ − 2x + 1 = 0, with a = 1, b = 0, c = −2 and d = 1. The roots are about −1.62, 0.62 and 1, and their sum is 0, which matches −b/a = 0. The root at x = 1 is easy to spot by trying small whole numbers, and the other two come from factoring out (x − 1) to leave a quadratic.
Who solves cubic equations
Students meet cubics in algebra and calculus, where finding the roots is the key step in sketching a curve, finding its turning points, or solving an optimisation problem. A cubic that factors neatly is a standard exam question, and a cubic that does not factor is where a calculator earns its keep.
Engineers meet cubics in beam bending, fluid flow and control systems, where the equation often comes from setting a derivative to zero. Physicists meet them in optics and in the equation of state for gases, and computer graphics uses them for smooth curves through points, where the control points lead to cubic equations.
Economists and data analysts meet cubics when they fit a trend to data that rises, falls and rises again. A derivative calculator gives the derivative whose roots are the turning points of the curve, and those roots are often the solutions of a cubic.
Computer graphics relies on cubic equations through splines, which are piecewise cubic curves that pass smoothly through a set of control points. A font, a car body and a film character's motion are all described by cubic splines, and finding where a spline crosses a line or reaches a peak means solving a cubic. The same mathematics that solves an exam question also draws the letters on this page.
Cubic equations vs quadratic equations
A quadratic has at most two roots and is solved by the quadratic formula, which every student learns. A cubic has up to three roots and is solved by Cardano's formula, which is longer and involves cube roots and a choice of method based on the discriminant. The quadratic formula always gives the answer in one step; the cubic formula needs a case split first.
The two equations also differ in their guarantees. A quadratic with real coefficients can have zero real roots, when its discriminant is negative, while a cubic with real coefficients always has at least one real root, because a cubic curve must cross the axis somewhere as it goes from negative infinity to positive infinity. That guarantee is why cubics are friendlier than they look.
For a quadratic, use a quadratic equation calculator, which is faster and gives the complex roots too. For a cubic, this calculator gives every real root, and the complex roots, when there are two, can be found by dividing the cubic by the linear factor of the known root.
Common cubic equation mistakes
The most common mistake is forgetting that a cubic can have one real root, and then stopping after finding it and missing the other two. Always check the discriminant first: if it is negative, there are three real roots, and finding only one means the work is unfinished. Second: sign errors in the coefficients, especially when the equation is written with the terms in a different order or with a term missing.
Third: treating a root of the depressed cubic as a root of the original equation. The depressed roots must be shifted back by −b/(3a) before they are answers to the original equation. Fourth: rounding too early. The trigonometric method involves cosines of angles that are not special values, so rounding the angle to two places can move a root by a hundredth or more.
Fifth: assuming a whole-number root must exist. Many cubics have irrational roots, such as the −1.62 and 0.62 of x³ − 2x + 1 = 0, and no amount of trying whole numbers will find them. When no whole number works, use the calculator instead of guessing, and check the answer by substitution.
How to use this cubic equation calculator
Type the four coefficients a, b, c and d for your cubic equation ax³ + bx² + cx + d = 0. The roots, the number of real roots, the discriminant and the sum of the roots update instantly. If the equation has a missing term, type 0 for its coefficient; for example, x³ − 2x + 1 = 0 has b = 0.
Check your answer by substituting each root back into the equation: the result should be zero, allowing for rounding. Check the sum of the roots against −b/a, which is a quick test that catches most mistakes. If the calculator says there is one real root, remember there are also two complex roots that it does not display.
Everything runs in your browser. No sign-up, no account, no data sent anywhere. Roots are rounded to two decimal places, which is enough for most hand calculations; for exact values, factor the cubic by hand when it has whole-number roots, and use the calculator's answer as the check.