🏆 US-Registered Digital Marketing Agency Trusted by 200+ brands · USA · UK · Canada · AUS
Advertisement
Advertisement
ALGEBRA

Cubic Equation Calculator — all three roots, real and complex

Solve ax3 + bx2 + cx + d = 0 and see every root, with the depressed cubic and the method used shown step by step.

a cannot be zero — with a = 0 the equation is quadratic, not cubic.
Roots of the cubic
 
 
0
Root x1
0
Root x2
0
Root x3
0
Discriminant Δ
Working:  
Advertisement

The cubic equation calculator above solves any equation of the form ax3 + bx2 + cx + d = 0 and returns all three roots — not just the one that happens to be easy to find. A cubic always has exactly three roots when you count multiplicity and allow complex numbers, and this tool reports every one of them, along with the discriminant that tells you which kind of solution set you are looking at before you read a single number.

Arb Digital builds these free maths tools the way we build client reporting: the answer is useless without the working that produced it. So the calculator prints the substitution that reduces your cubic to its depressed form, names the solution branch it took, and shows the intermediate values, so you can reproduce the result by hand and check it.

What This Cubic Equation Calculator Does

Enter the four coefficients a, b, c and d. The calculator first checks that a is non-zero, because with a = 0 the equation collapses to a quadratic and belongs in a different tool. It then removes the x2 term with a substitution, computes the cubic discriminant, and chooses the correct solution method for the case at hand: the trigonometric method when there are three distinct real roots, Cardano's formula when there is one real root and a conjugate pair of complex roots, and a direct closed form when roots repeat.

The result panel shows all three roots, the discriminant, and a plain-English summary of what that discriminant means. Complex roots are printed in standard a + bi form rather than being silently dropped, which is the single most common failure in free cubic solvers.

How to Use It

  1. Write your equation in standard form. Move everything to one side so it reads ax3 + bx2 + cx + d = 0. A missing term simply has a coefficient of zero.
  2. Enter a, b, c and d. Include the sign. In x3 − 6x2 + 11x − 6 = 0 the values are 1, −6, 11 and −6.
  3. Set the decimal places you want. Four is enough to recognise a whole-number root; raise it if you are checking a near-tie.
  4. Press Solve. The three roots, the discriminant and the working line update together.
  5. Read the working line to see the depressed cubic and which branch was used, then verify by substituting a root back into the original equation.

The Formula: How a Cubic Is Actually Solved

The first move is always the same. Substitute x = t − b/(3a). This shifts the graph sideways so the squared term vanishes, leaving a depressed cubic in the much friendlier form t3 + pt + q = 0, where

p = (3ac − b2) / (3a2) and q = (2b3 − 9abc + 27a2d) / (27a3).

Everything after that works on p and q, and at the very end you add b/(3a) back to each t to recover the roots of the original equation. The sign of the quantity D = (q/2)2 + (p/3)3 decides the case. Because the full cubic discriminant is Δ = −4p3 − 27q2 = −108D, the two quantities always disagree in sign — which is exactly why so many worked solutions online contradict each other. This page reports Δ in the standard convention: Δ > 0 means three distinct real roots, Δ < 0 means one real root and two complex conjugates, and Δ = 0 means a repeated root. The formal definitions are set out in the Wolfram MathWorld entry on the cubic formula.

Advertisement

Case 1: Three Distinct Real Roots and the Casus Irreducibilis

When Δ > 0 the cubic crosses the x-axis three times, so all three roots are real. Here is the strange part: Cardano's algebraic formula still works in principle, but it forces you to take the cube root of a complex number to arrive at three answers that are entirely real. Sixteenth-century algebraists called this the casus irreducibilis — the irreducible case — because there is no way to express those real roots in real radicals alone. The trigonometric alternative used below is the one set out in the NIST Digital Library of Mathematical Functions, section 1.11 on zeros of polynomials.

The practical escape route is trigonometry. Every root can be written as

tk = 2√(−p/3) · cos[ (1/3)·arccos( (3q / 2p)·√(−3/p) ) − 2πk/3 ] for k = 0, 1, 2.

The three values of k pick out three different angles on the same circle, which is why one formula produces three distinct roots rather than one. This calculator uses that method whenever the discriminant says all roots are real, which is why it never returns a complex number with a tiny imaginary artefact where a clean real root should be.

Case 2: One Real Root, Two Complex Conjugates

When Δ < 0 the graph crosses the axis only once. Cardano's formula applies directly and cleanly: with D = (q/2)2 + (p/3)3 positive, set u = ∛(−q/2 + √D) and v = ∛(−q/2 − √D). The real root is t1 = u + v, and the other two are

t = −(u + v)/2 ± i·(u − v)·√3 / 2.

Those two roots are conjugates: identical real parts, equal and opposite imaginary parts. That is not a coincidence or an artefact of the method. Any polynomial with real coefficients has complex roots that arrive strictly in conjugate pairs, because the imaginary parts have to cancel when the factors are multiplied back out. If a calculator ever hands you a single complex root of a real cubic without its partner, the calculator is wrong.

Case 3: Repeated Roots, and Why They Hide From Numerical Methods

When Δ = 0 at least two roots coincide. If p and q are both zero, all three roots equal the same value, −b/(3a). Otherwise the closed form is t1 = 2∛(−q/2) and t2 = t3 = −∛(−q/2). Geometrically, the curve touches the x-axis without crossing it at the doubled root.

This is the case where floating-point arithmetic hurts most. A cubic with an exact double root can compute a discriminant of 10−16 instead of 0 simply because of rounding in the coefficient products, and a solver that tests disc === 0 will fall through to the wrong branch and return two roots that differ in the twelfth decimal place. This tool tests the discriminant against a tolerance scaled to the size of your coefficients rather than against exact zero, so a genuine double root reports as a double root. If you enter large coefficients and see roots that agree to eleven digits but not twelve, treat them as equal.

Rational Roots: The Shortcut Worth Trying First

Before reaching for any formula, textbook cubics usually surrender to the rational root theorem. If a cubic with integer coefficients has a rational root p/q in lowest terms, then p divides the constant term d and q divides the leading coefficient a. For x3 − 6x2 + 11x − 6 = 0, that leaves only ±1, ±2, ±3 and ±6 as candidates. Testing x = 1 gives 1 − 6 + 11 − 6 = 0, so x = 1 is a root, and dividing out (x − 1) leaves a quadratic you can finish with the quadratic equation solver in a few seconds. Checking those candidate divisors is quicker if you list the factors first with the LCM and GCF calculator.

Use the calculator above when the coefficients are not friendly, when the roots are irrational, or when you need the complex pair. Use the rational root theorem first when you are working an exam question by hand, because the marker usually wants the factorisation, not a decimal.

A Fully Worked Example You Can Check

Take the default equation, x3 − 6x2 + 11x − 6 = 0, so a = 1, b = −6, c = 11, d = −6.

First, p = (3·1·11 − 36) / 3 = (33 − 36)/3 = −1. Then q = (2·(−216) − 9·1·(−6)·11 + 27·1·(−6)) / 27 = (−432 + 594 − 162)/27 = 0. The depressed cubic is therefore t3 − t = 0, which factors as t(t − 1)(t + 1), giving t = 0, 1, −1.

Now undo the substitution: x = t − b/(3a) = t + 2. That returns x = 2, x = 3 and x = 1. Substituting x = 3 back into the original equation gives 27 − 54 + 33 − 6 = 0, confirming the root. The discriminant is Δ = −4(−1)3 − 27(0)2 = 4, which is positive, correctly signalling three distinct real roots — and the calculator reaches those same three integers through the trigonometric branch.

Where Cubics Turn Up Outside the Classroom

Cubic equations are not a purely academic exercise. Van der Waals' equation of state rearranges into a cubic in volume, and its three roots correspond to the gas, liquid and unstable intermediate states of a real fluid — a case where knowing whether you have one real root or three carries direct physical meaning. Cubic Bézier curves, the backbone of every vector drawing program and CSS easing function, need cubic roots to answer where a curve crosses a given line. Structural engineers hit cubics when solving for the neutral axis of a reinforced concrete section, and finance uses them in bond pricing approximations across three cash-flow periods.

In each case the number of real roots is the useful output, not just their values. That is why the discriminant is shown as a headline figure here rather than buried in the working.

Need a calculator like this one embedded in your own site?

Arb Digital builds fast, dependency-free interactive tools that rank — the same approach behind the free calculators on this site. Browse the library or tell us what you need built.

Browse Free Tools Talk To Us

Common Mistakes to Avoid

  • Forgetting to move everything to one side. x3 + 2x = 5x − 1 is not ready to solve; rewrite it as x3 − 3x + 1 = 0 first.
  • Dropping the substitution at the end. The trigonometric and Cardano formulas give you t, not x. You must add back −b/(3a) to every root.
  • Confusing the two discriminant conventions. Δ = −4p3 − 27q2 and D = (q/2)2 + (p/3)3 always have opposite signs, so a rule copied from one source will invert the cases if you apply it to the other.
  • Reporting only the real root. A cubic has three roots. Stopping at the first one you find loses two-thirds of the answer.
  • Taking a real cube root of a negative number incorrectly. In Cardano's formula ∛(−8) is −2, but many programming languages return NaN for Math.pow(-8, 1/3), which silently breaks the whole calculation.

Related Free Tools From Arb Digital

If your equation has no x3 term, the quadratic equation solver is the right tool. To check whether a candidate integer root divides the constant term, the prime number checker helps, and for the surds that come out of these formulas try the cube root calculator or the square root calculator. The scientific calculator handles the trigonometric step if you want to follow the method manually, and the full free online tools hub lists everything else.

Frequently Asked Questions

How many roots does a cubic equation have?

Exactly three, counting multiplicity and allowing complex values. They may be three distinct real roots, one real root plus a complex conjugate pair, or a repeated real root that counts twice or three times.

Can a cubic equation have no real roots?

No. Because the graph runs from negative infinity to positive infinity, it must cross the x-axis at least once, so every cubic with real coefficients has at least one real root.

What is the discriminant of a cubic?

For the depressed cubic it is the quantity minus four p cubed minus twenty-seven q squared. Positive means three distinct real roots, negative means one real root and two complex conjugates, and zero means at least two roots coincide.

What is Cardano's formula?

It is the sixteenth-century closed-form solution for a depressed cubic, expressing the real root as the sum of two cube roots. It works directly when there is one real root, but needs complex arithmetic when all three roots are real.

Why does this calculator use trigonometry instead of Cardano?

When all three roots are real, Cardano's formula requires cube roots of complex numbers to produce real answers. The trigonometric form avoids complex arithmetic entirely and returns cleaner, more accurate values.

What happens if a is zero?

The equation is no longer cubic. With a equal to zero it reduces to a quadratic, and the calculator says so rather than dividing by zero and returning meaningless output.

Can I solve a cubic by factoring instead?

Often yes. If the coefficients are integers, test the divisors of the constant term over the divisors of the leading coefficient. Any root you find lets you divide out a linear factor and finish with a quadratic.

This calculator is provided for study and reference. Results are computed in double-precision floating point, so verify any root by substituting it back into your original equation before relying on it.

Advertisement
Advertisement

Take it further

Arb Digital assistant

👋 Hey! Want to grow your business? Ask me anything — a free marketing proposal is on the table!