Calculator AI Hub
Menu

Cubic Equation Solver

This cubic equation solver finds every root of ax³ + bx² + cx + d = 0, including repeated and complex roots. Where possible the answers are exact, such as 1/2 or −1 + i√3. The working shows the cubic discriminant, the rational root test, and Cardano's cubic formula when it is needed.

Mathematics · AlgebraUpdated Sources cited

Enter the coefficients

Decimals and fractions are accepted (0.5, -3/4) and treated as exact values. Use 0 for a missing term.

Result

Three distinct real roots

Roots of the equation
RootExactDecimalMultiplicity
x₁Real1111
x₂Real2221
x₃Real3331
Factored form (over the rationals)
(x−1)(x−2)(x−3)(x - 1)(x - 2)(x - 3)
Discriminant Δ
44
Assumptions behind this result
  • Coefficients are real numbers; decimals are treated as exact values (0.1 means exactly 1/10).
  • Roots are found over the complex numbers. Irrational roots that have no simpler exact form are given as decimals.

Step-by-step solution

Every step is computed from your input
  1. Step 1: Write the equation in standard form

    The leading coefficient a = 1 is not zero, so this is a cubic equation with exactly 3 roots, counted with multiplicity.

    x3−6x2+11x−6=0x^{3} - 6x^{2} + 11x - 6 = 0
  2. Step 2: Compute the discriminant

    The discriminant of a cubic tells you what kind of roots to expect. Substituting a = 1, b = -6, c = 11, d = -6: Δ > 0, so the cubic has three distinct real roots.

    Δ=18abcd−4b3d+b2c2−4ac3−27a2d2=4Δ = 18abcd - 4b^3d + b^2c^2 - 4ac^3 - 27a^2d^2 = 4
  3. Step 3: Test for rational roots

    By the rational root theorem, any rational root p/q of x^3 - 6x^2 + 11x - 6 has p dividing 6 and q dividing 1. Testing each candidate shows that x = 1 and x = 2 and x = 3 are roots.

    ±pq: −6, −3, −2, −1, 1, 2, 3, 6\pm\frac{p}{q}:\ -6,\ -3,\ -2,\ -1,\ 1,\ 2,\ 3,\ 6
  4. Step 4: Divide out the factor (x - 1)

    Since x = 1 is a root, (x - 1) is a factor. Polynomial division gives the remaining factor.

    x3−6x2+11x−6=(x−1)(x2−5x+6)x^{3} - 6x^{2} + 11x - 6 = (x - 1)\left(x^{2} - 5x + 6\right)
  5. Step 5: Divide out the factor (x - 2)

    Since x = 2 is a root, (x - 2) is a factor. Polynomial division gives the remaining factor.

    x2−5x+6=(x−2)(x−3)x^{2} - 5x + 6 = (x - 2)\left(x - 3\right)
  6. Step 6: Divide out the factor (x - 3)

    Since x = 3 is a root, (x - 3) is a factor. Polynomial division gives the remaining factor.

    x−3=(x−3)(1)x - 3 = (x - 3)\left(1\right)
  7. Step 7: Check the roots

    By Vieta's formulas, the roots (counted with multiplicity) must add up to −b/a. They add up to 6, which matches −b/a = 6.

    x1+⋯+x3=−ba=6x_1 + \dots + x_3 = -\frac{b}{a} = 6

What the calculator does

Enter the four coefficients of a cubic equation and the solver returns:

  • all three roots, counted with multiplicity, whether real or complex;
  • exact values for rational roots and for roots of quadratic factors;
  • the discriminant, which classifies the roots before you solve anything;
  • the factored form of the polynomial over the rational numbers;
  • the working that leads to each root.

How to solve a cubic equation with this calculator

Write your equation in the standard form ax³ + bx² + cx + d = 0, collecting every term on one side. Then enter a, b, c and d. If a term is missing, its coefficient is 0. For x³ − 8 = 0, enter a = 1, b = 0, c = 0, d = −8. Fractions such as 3/4 and decimals such as −0.25 are accepted and treated as exact values.

The cubic formula and the discriminant

The discriminant

Δ=18abcd−4b3d+b2c2−4ac3−27a2d2\Delta = 18abcd - 4b^3d + b^2c^2 - 4ac^3 - 27a^2d^2
Value of Δ Roots
Δ > 0 three distinct real roots
Δ = 0 a repeated root; all roots are real
Δ < 0 one real root and a pair of complex conjugates

Rational roots

If a cubic has integer coefficients, any rational root p/q in lowest terms has p dividing the constant term d and q dividing the leading coefficient a. Testing this short list of candidates finds every rational root. Each one gives a factor, and dividing it out leaves a quadratic that the quadratic formula solves.

Cardano’s method

When there is no rational root, the substitution x = t − b/(3a) removes the x² term and gives the depressed cubic

t3+pt+q=0,p=3ac−b23a2,q=2b3−9abc+27a2d27a3t^3 + pt + q = 0,\quad p = \frac{3ac - b^2}{3a^2},\quad q = \frac{2b^3 - 9abc + 27a^2d}{27a^3}

With one real root, Cardano’s formula gives it directly:

t=−q2+q24+p3273+−q2−q24+p3273t = \sqrt[3]{-\frac{q}{2} + \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}} + \sqrt[3]{-\frac{q}{2} - \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}}

With three real roots, the square root in Cardano’s formula is of a negative number, even though every root is real. This is the casus irreducibilis. The trigonometric form avoids complex arithmetic:

tk=2−p3 cos⁡ ⁣(13arccos⁡ ⁣(3q2p−3p)−2πk3),k=0,1,2t_k = 2\sqrt{-\frac{p}{3}}\,\cos\!\left(\frac{1}{3}\arccos\!\left(\frac{3q}{2p}\sqrt{-\frac{3}{p}}\right) - \frac{2\pi k}{3}\right),\quad k = 0, 1, 2

Worked example

Solve 2x³ − 3x² − 11x + 6 = 0.

  1. Discriminant. Substituting a = 2, b = −3, c = −11, d = 6 gives Δ = 15625. It is positive, so there are three distinct real roots.
  2. Rational root candidates. p divides 6 and q divides 2, so the candidates are ±1, ±2, ±3, ±6, ±1/2 and ±3/2.
  3. Test them. Substituting x = 3 gives 54 − 27 − 33 + 6 = 0, so x = 3 is a root and (x − 3) is a factor.
  4. Divide. 2x³ − 3x² − 11x + 6 = (x − 3)(2x² + 3x − 2).
  5. Solve the quadratic. 2x² + 3x − 2 = (2x − 1)(x + 2), so x = 1/2 or x = −2.

The roots are −2, 1/2 and 3. As a check, they add up to 3/2, which equals −b/a = 3/2.

Common mistakes

  • Leaving terms on both sides. Move everything to one side before reading off a, b, c and d, and keep track of signs.
  • Skipping a missing term. In x³ − 7x + 6, the x² coefficient is 0, not −7.
  • Treating a repeated root as two different roots. If (x − 1)² divides the cubic, x = 1 is one root of multiplicity 2.
  • Assuming the roots are real. When Δ < 0, two of the roots are complex.
  • Rounding too early. Rounding intermediate values in Cardano’s formula can noticeably shift the final roots. The solver keeps full precision and only rounds for display.

Practical applications

  • Equations of state. The van der Waals equation is cubic in the molar volume of a gas.
  • Linear algebra. The eigenvalues of a 3×3 matrix are the roots of its characteristic polynomial, which is a cubic.
  • Optimisation. Setting the derivative of a quartic function to zero gives a cubic.
  • Engineering. Beam deflection, open-channel flow depth and some control-system designs lead to cubic equations.

Assumptions and limitations

Coefficients must be real numbers. Exact forms are given for rational roots and for roots of quadratic factors. Other irrational roots are computed numerically to about 15 significant digits and then rounded to the decimal places you choose. When two distinct roots are extremely close together, the solver warns that their decimal values may be less accurate.

Frequently asked questions

What is a cubic equation?

A cubic equation is a polynomial equation where the highest power of x is 3. Its general form is ax³ + bx² + cx + d = 0, where a is not zero.

How many roots does a cubic equation have?

A cubic equation has exactly three roots when you count repeated and complex roots. At least one root is always a real number.

How do you solve a cubic equation?

Find one root using the rational root theorem or trial values. Divide the cubic by (x − root) to get a quadratic. Then solve the quadratic with the quadratic formula.

Is there a formula for cubic equations?

Yes. Cardano's formula, published in 1545, solves any cubic equation. It is long, so in practice people often find one root first and factor.

What is the discriminant of a cubic equation?

For ax³ + bx² + cx + d = 0, Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d². If Δ > 0 there are three distinct real roots; Δ = 0 means a repeated root; Δ < 0 means one real root and two complex roots.

Can a cubic equation have complex roots?

Yes. When the discriminant is negative, a cubic has one real root and two complex roots that are conjugates of each other, such as 1 + 2i and 1 − 2i.

What are the roots of x³ − 6x² + 11x − 6 = 0?

The roots are x = 1, x = 2 and x = 3, because the cubic factors as (x − 1)(x − 2)(x − 3).

What is a repeated root?

A repeated root appears more than once. In (x − 2)²(x + 1) = 0, x = 2 is a double root (multiplicity 2), and the graph touches the x-axis there without crossing.

References

  1. Cardano, G. (1545). Ars Magna. The first published general solution of the cubic.
  2. Weisstein, E. W. Cubic Formula. MathWorld, Wolfram Research.
  3. Press, W. H., Teukolsky, S. A., Vetterling, W. T. & Flannery, B. P. (2007). Numerical Recipes (3rd ed.), §5.6 Quadratic and Cubic Equations. Cambridge University Press.
  4. Aberth, O. (1973). Iteration methods for finding all zeros of a polynomial simultaneously. Mathematics of Computation, 27(122), 339–344.