Cubic Equation Calculator
Enter a, b, c and d from ax³ + bx² + cx + d = 0. The calculator substitutes x = t - b/(3a) to remove the x² term, then solves t³ + pt + q = 0: with Cardano's formula when there is one real root, or with cosines when there are three.
Last updated by Ultra Calculator
Cubic Equation Calculator
How to calculate it
ax³ + bx² + cx + d = 0 Δ = 18abcd - 4b³d + b²c² - 4ac³ - 27a²d² x = t - b ÷ (3a), which gives t³ + pt + q = 0 p = (3ac - b²) ÷ (3a²) q = (2b³ - 9abc + 27a²d) ÷ (27a³)
- a, b, c, d
- the coefficients of x³, x², x and the constant term; a can't be 0
- x
- a root of the equation
- Δ
- the discriminant, worked out from the original coefficients
- t
- the shifted variable of the depressed cubic
- p, q
- the coefficients of the depressed cubic t³ + pt + q = 0
If Δ > 0 there are three different real roots, if Δ = 0 at least two roots are equal, and if Δ < 0 there is one real root and a pair of complex conjugate roots.
Worked example
Three whole-number roots
x³ - 6x² + 11x - 6 = (x - 1)(x - 2)(x - 3), so the roots are 3, 2 and 1. The discriminant is 4, which is positive, as expected for three different real roots.
| Coefficient a | 1 |
|---|---|
| Coefficient b | -6 |
| Coefficient c | 11 |
| Coefficient d | -6 |
| Root 1 (x₁) | 3 |
|---|---|
| Root 2 (x₂) | 2 |
| Root 3 (x₃) | 1 |
| Discriminant (Δ) | 4 |
| Type of roots | Three distinct real roots |
| Depressed cubic p | -1 |
| Depressed cubic q | 0 |
How to use this calculator
- Rearrange your equation so one side is 0 and the terms run from x³ down to the constant.
- Enter Coefficient a, the number in front of x³. Remember the sign: for -2x³ enter -2.
- Enter Coefficient b, Coefficient c and Coefficient d. Leave a box blank or enter 0 for a missing term.
- Read Root 1 to Root 3. Real roots are numbers; complex roots appear as a pair such as 0.3412 + 1.1615i and 0.3412 - 1.1615i.
- Check the Type of roots and the Discriminant (Δ) to see whether the roots are different, repeated or complex.
Frequently asked questions
How do you solve a cubic equation?
By hand, the quickest route (for whole-number coefficients) is to find one root by trying factors of d divided by factors of a, factorise out (x - root), and solve the quadratic that is left. When no root is easy to spot, use the cubic formula, which is what this calculator does.
What does the discriminant of a cubic tell you?
It tells you what kind of roots to expect before you find them. A positive discriminant means three different real roots, zero means a repeated root, and a negative value means one real root and two complex roots.
Can a cubic equation have no real roots?
Not if its coefficients are real. A cubic graph goes to minus infinity on one side and plus infinity on the other, so it must cross the x-axis at least once. Complex roots of a real cubic always come as a conjugate pair.
What is a depressed cubic?
A cubic with no x² term, written t³ + pt + q = 0. Any cubic can be turned into one by substituting x = t - b/(3a), and the depressed form is the one Cardano's formula solves.
Who discovered the cubic formula?
Girolamo Cardano published the solution in his book Ars Magna in 1545. He had learned the method from Niccolò Tartaglia, and Scipione del Ferro had found it earlier still.
How does the calculator spot a repeated root?
It works out the discriminant exactly from the coefficients you typed, using whole-number arithmetic instead of rounded decimals, so a discriminant of exactly 0 is never missed. For x³ - 0.5x² + 0.07x - 0.003 = 0, which is (x - 0.1)²(x - 0.3), it reports a double root of 0.1 and a single root of 0.3.
Learn more
Three roots, counted properly
A cubic always has exactly three roots if you count repeats and complex numbers. They can be three different real numbers, a real root plus a repeated one, one root repeated three times, or one real root and a complex pair.
Removing the x² term
Substituting x = t - b/(3a) shifts the graph sideways so its point of symmetry sits on the vertical axis. The x² term disappears and leaves t³ + pt + q = 0, which is easier to solve. Each answer for t is turned back into x by subtracting b/(3a).
Cardano's formula and the cosine method
When there is one real root, Cardano's formula adds two cube roots: t = ∛(-q/2 + √(q²/4 + p³/27)) + ∛(-q/2 - √(q²/4 + p³/27)). When there are three different real roots, the square root in that formula is of a negative number, so the calculator uses an equivalent form with cosines instead.
- Checking A-level or university algebra answers
- Finding where a cubic graph crosses the x-axis before sketching it
- Finding the eigenvalues of a 3×3 matrix from its characteristic equation
- Solving volume problems, such as the size of square to cut from each corner of a sheet to fold a box of a given volume
- Checking a root you found with the factor theorem
Not rearranging to = 0 first
For x³ = 4x + 1, move everything to one side: x³ - 4x - 1 = 0, so a = 1, b = 0, c = -4 and d = -1.
Dropping a sign
Each coefficient carries the sign in front of it. In 2x³ - 5x + 3 = 0, c is -5, not 5.
Putting a missing term's coefficient in the wrong box
If there is no x² term, b is 0 and the x coefficient still goes in c. Shifting the numbers along a box solves a different equation.
Using this for an equation with no x³ term
If a is 0 the equation is a quadratic, and this calculator won't accept it. Use the quadratic formula calculator instead.
Methodology and sources
The calculator reads a, b, c and d as decimals; an empty b, c or d box counts as 0, and a must not be 0. It works out Δ exactly, treating each coefficient as the exact decimal you typed and using whole-number arithmetic, so the type of roots is never thrown off by rounding. Repeated roots come from exact formulas. Otherwise it converts to the depressed cubic and uses cosines for three real roots or Cardano's cube roots for one, then sharpens each root with Newton's method. Roots are shown to 4 decimal places, with more when two different roots would otherwise look the same, and very small or very large values appear in scientific notation, so a complex pair never shows an imaginary part of 0.