Cubic Equation Solver

Solve any cubic equation for all its roots

How it is calculated

For ax³ + bx² + cx + d = 0 the tool shifts x = t + offset with offset = −b / 3a, giving t³ + pt + q = 0, where p = (3ac − b²) / 3a² and q = (2b³ − 9abc + 27a²d) / 27a³. It then checks D = q²/4 + p³/27. If D is positive, it uses Cardano's cube roots and prints one real root plus a complex pair. If D is zero (within 1e−12), it prints the repeated real roots, or a single value for a triple root. If D is negative, it uses a trigonometric formula for three distinct real roots. All numbers are rounded to two decimals, and the general discriminant Δ is also shown. The coefficient a cannot be 0, since the equation is then not cubic.

Worked example

Take x³ − 6x² + 11x − 6 = 0, so a = 1, b = −6, c = 11, d = −6. Offset = 2, p = −1, q = 0, so D = −1/27, which is negative: three distinct real roots. With m = 2·√(1/3) ≈ 1.155 and θ = π/6, the three cosine terms plus the offset give 1, 2 and 3. The tool prints 1.00, 2.00, 3.00 (real), and the discriminant is 4.00. Check: (x−1)(x−2)(x−3) expands to the same polynomial.

Try this example →

Common mistakes

  • Leaving a coefficient blank or entering a = 0 for an equation that is really quadratic; the tool gives no result when a is zero.
  • Dropping the minus sign of a coefficient, for example entering 6 instead of −6 for the x² term.
  • Reading a rounded root such as 1.00 as exact; the roots are shown to two decimals only, so substitute them back before relying on them.
  • Expecting every repeated root to be listed three times: a triple root is printed once, and the sign of Δ tells how many roots are real (positive: three distinct real; negative: one real and two complex).

About this calculator

This solver finds all roots of ax³ + bx² + cx + d = 0 using Cardano's method, the 16th-century algebraic technique that depresses the cubic (removing the x² term via substitution) and then solves the resulting form with a combination of cube roots. It reports the discriminant, whose sign tells you the nature of the roots before you even look at the numbers: positive means three distinct real roots, zero means all roots are real and at least two are equal (a double root, or a triple root when all three coincide), and negative means one real root plus a pair of complex conjugate roots.

Engineers and physicists hit cubics when solving for volumes, equilibrium points, or characteristic equations of certain systems, and math students use this to verify hand-worked Cardano's-method solutions, which are notoriously easy to make an arithmetic slip in given how many nested radicals are involved.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators