Cubic Equation Calculator

Solve any cubic equation ax³ + bx² + cx + d = 0. Get all three roots — real and complex — with steps, plus a Vieta's formulas check.

Loading calculator…

The cubic equation

A cubic equation has the form ax3+bx2+cx+d=0ax^3 + bx^2 + cx + d = 0, where aa, bb, cc, dd are numbers and a0a \neq 0. Unlike a quadratic, there is no single simple formula most people memorize — instead, this calculator finds a root first, then reduces the problem to a quadratic. Every cubic has exactly three roots (counting multiplicity): three real numbers, or one real number and a complex conjugate pair.

Tip: A cubic always has at least one real root — its graph is a curve that runs from -\infty to ++\infty (or the reverse), so it must cross the x-axis somewhere. The other two roots can be real or complex.

Two solving strategies

This calculator picks its strategy from the constant term dd:

CaseStrategy
d=0d = 0Factor out xx. Every term has an xx, so x=0x = 0 is a root immediately: x(ax2+bx+c)=0x(ax^2 + bx + c) = 0. What remains is a quadratic.
d0d \neq 0Rational Root Theorem + deflation. Test candidate roots ±p/q\pm p/q (divisors of dd over divisors of aa) until one works, then divide it out by synthetic division to leave a quadratic factor.

Either way, the last step is solving a quadratic — the same one behind the Quadratic Formula calculator.

Both strategies rely on finding one rational root first, so this calculator handles cubics that have at least one rational root; a cubic that is irreducible over the rationals (no integer or simple-fraction root) needs Cardano's formula or a numerical method, which is beyond this tool's scope.

Worked example — three rational roots

Solve x36x2+11x6=0x^3 - 6x^2 + 11x - 6 = 0, so a=1a=1, b=6b=-6, c=11c=11, d=6d=-6.

  1. Test rational roots: since d=60d = -6 \neq 0, try divisors of 66 over divisors of 11: x=1x = 1 gives 16+116=01 - 6 + 11 - 6 = 0. Found.
  2. Deflate: dividing x36x2+11x6x^3 - 6x^2 + 11x - 6 by (x1)(x-1) leaves x25x+6x^2 - 5x + 6.
  3. Solve the quadratic: x25x+6=(x2)(x3)x^2 - 5x + 6 = (x-2)(x-3), so the discriminant is Δ=2524=1>0\Delta = 25-24=1 > 0, giving roots x=3x=3 and x=2x=2.
  4. Three roots: x1=1x_1 = 1, x2=3x_2 = 3, x3=2x_3 = 2 — the factorization is (x1)(x2)(x3)(x-1)(x-2)(x-3).
  5. Vieta check: 1+2+3=6=b/a1+2+3=6=-b/a, and 1×2×3=6=d/a1 \times 2 \times 3 = 6 = -d/a. Both match.

Worked example — d = 0 (factor out x)

Solve x34x2+3x=0x^3 - 4x^2 + 3x = 0, so a=1a=1, b=4b=-4, c=3c=3, d=0d=0.

  1. Factor out x: since d=0d=0, x=0x = 0 is a root: x(x24x+3)=0x(x^2 - 4x + 3) = 0.
  2. Solve the quadratic: x24x+3=(x1)(x3)x^2 - 4x + 3 = (x-1)(x-3), discriminant Δ=1612=4>0\Delta = 16-12=4>0, roots x=1x=1 and x=3x=3.
  3. Three roots: x1=0x_1 = 0, x2=3x_2 = 3, x3=1x_3 = 1.
  4. Vieta check: 0+3+1=4=b/a0+3+1=4=-b/a, and 0×3×1=0=d/a0 \times 3 \times 1 = 0 = -d/a. Both match — the product is exactly 00 because x=0x=0 is one of the roots.

Worked example — a real root and a complex pair

Solve x38=0x^3 - 8 = 0, so a=1a=1, b=0b=0, c=0c=0, d=8d=-8.

  1. Test rational roots: try divisors of 88: x=2x=2 gives 88=08 - 8 = 0. Found.
  2. Deflate: dividing x38x^3 - 8 by (x2)(x-2) leaves x2+2x+4x^2 + 2x + 4.
  3. Solve the quadratic: discriminant Δ=416=12<0\Delta = 4 - 16 = -12 < 0, so the remaining two roots are complex conjugates: x=1±3ix = -1 \pm \sqrt{3}\,i.
  4. Three roots: x1=2x_1 = 2 (real), x2=1+3ix_2 = -1+\sqrt{3}i, x3=13ix_3=-1-\sqrt{3}i (a complex conjugate pair).
  5. Vieta check: 2+(1+3i)+(13i)=0=b/a2 + (-1+\sqrt3 i) + (-1-\sqrt3 i) = 0 = -b/a (the imaginary parts cancel), and 2×[(1)2+(3)2]=2×4=8=d/a2 \times \big[(-1)^2+(\sqrt3)^2\big] = 2 \times 4 = 8 = -d/a. Both match, even with complex roots in the mix.

Vieta's formulas as a built-in check

For any cubic ax3+bx2+cx+d=0ax^3+bx^2+cx+d=0 with roots x1,x2,x3x_1, x_2, x_3, Vieta's formulas relate the roots directly to the coefficients — no solving required:

x1+x2+x3=bax1x2x3=dax_1+x_2+x_3=-\frac{b}{a} \qquad x_1x_2x_3=-\frac{d}{a}

This calculator shows both identities computed straight from aa, bb, dd, alongside the three roots it found. Because the identities hold for real and complex roots alike, they double as a correctness check: if the sum and product of the roots you calculated by hand don't match b/a-b/a and d/a-d/a, a root was mis-copied somewhere.

Where cubic equations show up

Cubic equations model volume problems (a box's dimensions related by one variable), cubic growth and decay curves, and the inflection points of higher-degree curves. Once you have one root of a cubic — by inspection, a graph, or the Rational Root Theorem — the quadratic formula or completing the square finishes the job on what's left.

Frequently asked questions

What is a cubic equation?
A cubic equation has the form ax3+bx2+cx+d=0ax^3 + bx^2 + cx + d = 0, where aa, bb, cc, dd are numbers and a0a \neq 0. Every cubic has exactly three roots (counted with multiplicity): either three real roots, or one real root plus a pair of complex conjugate roots.
How does this calculator solve a cubic?
Two ways, depending on dd. If d=0d = 0, then x=0x = 0 is automatically a root — factor out xx, leaving a quadratic to solve. If d0d \neq 0, the calculator searches for a rational root using the Rational Root Theorem, then deflates the cubic by synthetic division into a quadratic factor, which is solved with the quadratic formula.
What is the Rational Root Theorem?
For ax3+bx2+cx+d=0ax^3 + bx^2 + cx + d = 0 with integer-like coefficients, any rational root must equal ±p/q\pm p/q, where pp divides the constant term dd and qq divides the leading coefficient aa. Testing every such candidate finds a root quickly without guessing.
Why do complex roots show up?
Once a real root is found and factored out, the remaining quadratic factor can have a negative discriminant — which means its two roots are complex conjugates. Every cubic still has at least one real root (a cubic curve always crosses the x-axis at least once), but the other two can be complex.
What are Vieta's formulas, and what does the check verify?
For ax3+bx2+cx+d=0ax^3 + bx^2 + cx + d = 0 with roots x1,x2,x3x_1, x_2, x_3: the sum x1+x2+x3=b/ax_1+x_2+x_3 = -b/a, and the product x1x2x3=d/ax_1 x_2 x_3 = -d/a (there is also a sum-of-pairs identity, x1x2+x1x3+x2x3=c/ax_1x_2+x_1x_3+x_2x_3 = c/a). This calculator recomputes b/a-b/a and d/a-d/a straight from the coefficients as a sanity check against the three roots it found — real and complex together.
What happens when a = 0?
If a=0a = 0 the x3x^3 term disappears and the equation is at most quadratic, not cubic. This calculator reports that case as "not cubic"; enter a nonzero aa.

Related calculators