Algebra & Equations

Cubic Equation Solver

This cubic equation solver finds all three roots of ax3+bx2+cx+d=0ax^3 + bx^2 + cx + d = 0, real or complex, exact whenever possible.

Try

Any non-zero number, decimal or fraction.

Enter 0 if there is no x² term.

Enter 0 if there is no x term.

Enter 0 if there is no constant.

Result

Solutions: x = 1 − √3, x = 1/2, x = 1 + √3

Solutions

x=1−3,x=12,x=1+3x = 1 - \sqrt{3}, \quad x = \frac{1}{2}, \quad x = 1 + \sqrt{3}

Discriminant ΔThree distinct real roots
Δ=1452\Delta = 1452
Nature of the roots
Three distinct real roots
Decimal roots
x ≈ −0.7320508076, x = 0.5, x ≈ 2.732050808
Factored formOver the rational numbers
(2x−1)(x2−2x−2)=0\left(2x - 1\right)\left(x^{2} - 2x - 2\right) = 0
Sum of roots (−b/a)
52\frac{5}{2}
Sum of pairwise products (c/a)
−1-1
Product of roots (−d/a)
−1-1
Turning pointsLocal maximum and minimum, where f′(x) = 3ax² + 2bx + c = 0
(−0.1804604217, 2.186337289) and (1.847127088, −6.149300252)
Inflection pointThe curve is symmetric about this point
(56,−10754)\left(\frac{5}{6}, -\frac{107}{54}\right)

The curve crosses the x-axis three times, at x ≈ −0.7320508076, x = 0.5 and x ≈ 2.732050808. These are the three values that make 2x³ − 5x² − 2x + 2 equal to zero.

Graph of y = 2x³ − 5x² − 2x + 2
−10−505−10123xyCubicReal roots
Roots of the cubic
RootExact formDecimal valueMultiplicityType
x₁1 − √3−0.73205080761Real, irrational
x₂1/20.51Real, rational
x₃1 + √32.7320508081Real, irrational
Step-by-step working (9 steps)
  1. Identify the coefficients

    Compare with ax3+bx2+cx+d=0ax^3 + bx^2 + cx + d = 0: a = 2, b = −5, c = −2, d = 2.

    2x3−5x2−2x+2=02x^{3} - 5x^{2} - 2x + 2 = 0
  2. Compute the discriminant

    Δ is positive, so the cubic has three distinct real roots.

    Δ=18abcd−4b3d+b2c2−4ac3−27a2d2=18(2)(−5)(−2)(2)−4(−5)3(2)+(−5)2(−2)2−4(2)(−2)3−27(2)2(2)2=720+1000+100+64−432=1452\Delta = 18abcd - 4b^3d + b^2c^2 - 4ac^3 - 27a^2d^2 = 18\left(2\right)\left(-5\right)\left(-2\right)\left(2\right) - 4\left(-5\right)^3\left(2\right) + \left(-5\right)^2\left(-2\right)^2 - 4\left(2\right)\left(-2\right)^3 - 27\left(2\right)^2\left(2\right)^2 = 720 + 1000 + 100 + 64 - 432 = 1452
  3. List the rational root candidates

    By the rational root theorem, a rational root p/q (in lowest terms, after clearing fractions) has p dividing the constant term and q dividing the leading coefficient. That gives 6 candidates: ±1/2, ±1, ±2.

  4. Test the candidates

    Substitute candidates into f(x) until one gives 0: f(1/2) = 0. So x = 1/2 is a root and (x − 1/2) is a factor.

    f(12)=2(12)3−5(12)2−2(12)+2=0f\left(\frac{1}{2}\right) = 2\left(\frac{1}{2}\right)^3 - 5\left(\frac{1}{2}\right)^2 - 2\left(\frac{1}{2}\right) + 2 = 0
  5. Divide by (x − 1/2) with synthetic division

    Write the coefficients 2, −5, −2, 2. Bring down 2, then repeatedly multiply by 1/2 and add to the next coefficient: −5 + 1 = −4; −2 + (−2) = −4; 2 + (−2) = 0. The last number is the remainder (0); the others are the coefficients of the quadratic quotient.

    [2−5−221−2−22−4−40]\begin{bmatrix} 2 & -5 & -2 & 2 \\ & 1 & -2 & -2 \\ 2 & -4 & -4 & 0 \end{bmatrix}
  6. Write the cubic as a product

    2x3−5x2−2x+2=(x−12)(2x2−4x−4)2x^{3} - 5x^{2} - 2x + 2 = \left(x - \frac{1}{2}\right)\left(2x^{2} - 4x - 4\right)
  7. Solve the remaining quadratic

    Its discriminant is 48 > 0, so it gives two real roots.

    x=4±484⇒x=1−3,x=1+3x = \frac{4 \pm \sqrt{48}}{4} \;\Rightarrow\; x = 1 - \sqrt{3},\; x = 1 + \sqrt{3}
  8. Check each root by substitution

    Put each root back into f(x) = 2x³ − 5x² − 2x + 2: f(1 − √3) = 0 exactly; f(1/2) = 0 exactly; f(1 + √3) = 0 exactly. Exact arithmetic confirms every root.

  9. Check with Vieta’s formulas

    The three roots (counted with multiplicity) add up to −b/a = 5/2 and multiply to −d/a = −1, as they should.

You get the discriminant, a graph and every step, from the rational root test to Cardano’s cubic formula.

By Hira Noor, mathematicianLast reviewed Free, no sign-up, runs in your browserReport a problem

How to use this calculator

  1. Rearrange the equation so one side is zero, for example x3=2x+5x^3 = 2x + 5 becomes x3−2x−5=0x^3 - 2x - 5 = 0.
  2. Enter the coefficient of x3x^3 as a (it cannot be 0), of x2x^2 as b, of xx as c and the constant as d. Use 0 for missing terms and keep the signs.
  3. Decimals and fractions such as 0.5 or 3/4 are converted to exact fractions, so exact roots stay exact.
  4. Read the solutions at the top, then follow the step-by-step working: the discriminant, the rational root test, the synthetic division and the quadratic formula, or Cardano’s formula when no rational root exists.
  5. Check the last steps: each root is substituted back into the equation, and Vieta’s formulas confirm the sum and product of the roots. Use Copy to save the inputs and result as text.
  6. Already have the equation typed out, such as x^3 - 6x^2 + 11x - 6 = 0? Paste it into the math solver, which reads it as written.

Formulas

Cubic discriminant

Δ=18abcd−4b3d+b2c2−4ac3−27a2d2\Delta = 18abcd - 4b^3d + b^2c^2 - 4ac^3 - 27a^2d^2

Plain-text formula: Δ = 18abcd − 4b^3 d + b^2 c^2 − 4ac^3 − 27a^2 d^2

Δ > 0 means three distinct real roots, Δ = 0 means a repeated root (all roots real), and Δ < 0 means one real root and a pair of complex conjugate roots.

Rational root theorem

x=pq,p∣d,q∣ax = \frac{p}{q}, \quad p \mid d, \quad q \mid a

Plain-text formula: x = p/q, p∣d, q∣a

With integer coefficients, any rational root in lowest terms has a numerator dividing the constant term and a denominator dividing the leading coefficient. Once a root r is found, synthetic division by (x − r) leaves a quadratic, solved with the quadratic formula.

The cubic formula (Cardano’s method)

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}}}

Plain-text formula: t = ∛(−q/2 + √(q^2/4 + p^3/27)) + ∛(−q/2 − √(q^2/4 + p^3/27))

pp
3ac−b23a2\frac{3ac - b^2}{3a^2}
qq
2b3−9abc+27a2d27a3\frac{2b^3 - 9abc + 27a^2d}{27a^3}

Substituting x=t−b3ax = t - \frac{b}{3a} gives t3+pt+q=0t^3 + pt + q = 0. When Δ < 0 this formula gives the real root. When Δ > 0 the trigonometric form tk=2−p/3cos(13arccos(3q2p−3/p)−2πk3)t_k = 2\sqrt{-p/3}\,\cos\left(\frac{1}{3}\arccos\left(\frac{3q}{2p}\sqrt{-3/p}\right) - \frac{2\pi k}{3}\right) gives all three real roots.

Reading the result

Every cubic has at least one real root, because its graph runs from −∞-\infty to +∞+\infty (or the reverse) and must cross the x-axis. The solutions are the x-values where the curve meets the axis; complex roots, when present, come as a conjugate pair and do not show on the graph.

Exact roots such as 12\frac{1}{2} or 1+31 + \sqrt{3} appear when the cubic has a rational root. If the rational root test finds nothing, the roots are irrational or complex and are given as decimals; the steps then use the depressed cubic and Cardano’s or the trigonometric formula.

Check an answer with Vieta’s formulas: the roots add up to −b/a-b/a, the sum of their pairwise products is c/ac/a and their product is −d/a-d/a.

How to solve a cubic equation by hand

Start with the rational root theorem. List every ±p/q where p divides the constant term d and q divides the leading coefficient a, and substitute them until one gives zero. For x3−6x2+11x−6=0x^3 - 6x^2 + 11x - 6 = 0 the candidates are ±1, ±2, ±3 and ±6, and x=1x = 1 works.

Divide by (x−r)(x - r) with synthetic division to get a quadratic, then solve that with the quadratic formula. Here x3−6x2+11x−6=(x−1)(x2−5x+6)=(x−1)(x−2)(x−3)x^3 - 6x^2 + 11x - 6 = (x - 1)(x^2 - 5x + 6) = (x - 1)(x - 2)(x - 3), so the roots are 1, 2 and 3.

If no candidate works, the cubic has no rational root and factoring by hand stops there. Reduce it to a depressed cubic and use the cubic formula below, or let this cubic equation calculator do it. The how to solve a cubic equation guide walks through both routes with more examples.

What the sign of the discriminant tells you

For a quadratic, the discriminant decides between two real roots, one repeated root or a complex pair. The cubic discriminant plays the same role. A positive Δ gives three different real roots and a graph with a local maximum above the axis and a local minimum below it. Δ = 0 means the graph touches the axis at a turning point (a double root) or flattens through it (a triple root).

A negative Δ leaves only one real crossing. Oddly, the case with three real roots is the one where Cardano’s formula forces you through complex numbers, which is why the trigonometric method is used there.

Worked example

Solve 2x³ − 5x² − 2x + 2 = 0

Find the exact roots and the discriminant.

  1. Coefficients: a = 2, b = −5, c = −2, d = 2.
  2. Discriminant: Δ=720+1000+100+64−432=1452>0\Delta = 720 + 1000 + 100 + 64 - 432 = 1452 > 0, so there are three distinct real roots.
  3. Rational candidates are ±1, ±2 and ±1/2. Testing gives f(12)=14−54−1+2=0f\left(\frac{1}{2}\right) = \frac{1}{4} - \frac{5}{4} - 1 + 2 = 0.
  4. Synthetic division by x−12x - \frac{1}{2} gives the quotient 2x2−4x−42x^2 - 4x - 4.
  5. Quadratic formula: x=4±484=1±3x = \frac{4 \pm \sqrt{48}}{4} = 1 \pm \sqrt{3}.
  6. Check: the factored form is (2x−1)(x2−2x−2)(2x - 1)(x^2 - 2x - 2), which expands back to 2x3−5x2−2x+22x^3 - 5x^2 - 2x + 2.

Answer: The roots are x=12x = \frac{1}{2}, x=1−3≈−0.7320508076x = 1 - \sqrt{3} \approx -0.7320508076 and x=1+3≈2.732050808x = 1 + \sqrt{3} \approx 2.732050808. Their sum is 2.5 = −b/a and their product is −1 = −d/a.

Frequently asked questions

What is the cubic formula?

It is Cardano’s formula. First substitute x=t−b3ax = t - \frac{b}{3a} to get the depressed cubic t3+pt+q=0t^3 + pt + q = 0, then 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}}}. It always works, but when there are three real irrational roots it passes through complex numbers, so the trigonometric form is easier.

How do you solve a cubic equation with a calculator?

Rearrange it to ax3+bx2+cx+d=0ax^3 + bx^2 + cx + d = 0, then enter a, b, c and d. This cubic equation calculator returns all three roots with the working. On a Casio fx-991ES PLUS, open EQN mode and choose the aX³ + bX² + cX + d = 0 type; on an fx-991EX ClassWiz, choose Equation/Func, then Polynomial, then degree 3. Enter a, b, c and d and step through the roots. Handheld calculators show decimals only, with no exact forms or steps, and if only one root appears the other two are a complex pair.

Is there a cubic equation solver app?

You do not need to install one. This page works on any phone browser, and you can add it to your home screen so it opens with one tap, like an app. It needs an internet connection to load.

How do I factor a cubic equation?

Find one rational root r, divide the cubic by (x−r)(x - r) with synthetic division, then factor the quadratic that remains. For example, 2x3−5x2−2x+2=(2x−1)(x2−2x−2)2x^3 - 5x^2 - 2x + 2 = (2x - 1)(x^2 - 2x - 2). The solver shows the factored form whenever the cubic has a rational root, and the factoring calculator shows each factoring step, including grouping and sums or differences of cubes.

Does every cubic equation have a real solution?

Yes. A cubic with real coefficients always has at least one real root, because the graph goes to +∞+\infty on one side and −∞-\infty on the other. It has either one real root and two complex roots, or three real roots (some possibly repeated).

What is the discriminant of a cubic?

It is Δ=18abcd−4b3d+b2c2−4ac3−27a2d2\Delta = 18abcd - 4b^3d + b^2c^2 - 4ac^3 - 27a^2d^2. Positive means three distinct real roots, zero means a repeated root, and negative means one real root plus a complex conjugate pair.

Why are some roots shown only as decimals?

When a cubic has no rational root, its roots are irrational or complex. They can be written with nested cube roots using Cardano’s formula, but those expressions are long and often involve complex numbers, so the calculator gives accurate decimals instead.

How do I find a rational root by hand?

List the fractions ±p/q where p divides the constant term and q divides the leading coefficient, then substitute them one at a time. For 2x3−5x2−2x+22x^3 - 5x^2 - 2x + 2 the candidates are ±1, ±2 and ±1/2, and x=12x = \frac{1}{2} works.

What if a = 0?

Then there is no x3x^3 term and the equation is a quadratic. Use the quadratic equation calculator. For polynomials of degree 4 to 10, use the polynomial root finder.

What is synthetic division?

A shortcut for dividing a polynomial by (x − r). Bring down the first coefficient, multiply by r, add to the next coefficient and repeat. The last number is the remainder, which is 0 exactly when r is a root.

Quadratic Formula Calculator

Solve ax² + bx + c = 0 with the quadratic formula: exact roots, discriminant, vertex, graph and steps.

Algebra & Equations

Polynomial Root Finder

All real and complex roots of a polynomial up to degree 10, with multiplicities, exact forms and steps.

Algebra & Equations

Factoring Calculator

Factor a polynomial completely, with each step labeled by method and a check by expanding.

Algebra & Equations

Equation Solver

Solve any equation in x: exact steps for linear and quadratic equations, numerical roots for the rest.

Algebra & Equations

Complex Number Calculator

Complex arithmetic, powers and roots with steps, in rectangular, polar and exponential form.

Algebra & Equations

Step-by-Step Math Solver

Free worked solutions for equations, systems, inequalities, factoring, derivatives, integrals, limits and matrices.

Tools

Sources and further reading

  1. Zeros of Polynomial Functions (Section 5.5, Algebra and Trigonometry 2e) (opens in a new tab), OpenStax, Rice University
  2. NIST Digital Library of Mathematical Functions, §1.11(iii) Cubic Equations (opens in a new tab), National Institute of Standards and Technology
  3. Cubic Formula (opens in a new tab), Wolfram MathWorld

Results are calculated in your browser with methods checked by automated tests, and are intended for learning and general use. For engineering, medical, financial, legal or safety-critical decisions, verify important values independently and follow the rounding rules your work requires. How accurate are these results?