Skip to content

Cubic Equation Calculator: Real and Complex Roots

Solve ax³ + bx² + cx + d = 0: real and complex roots, discriminant, exact rational roots and steps.

Your details

Must not be 0.

Results update as you type

Roots

x₁ = 1, x₂ = 2, x₃ = 3

Nature of the roots
3 distinct real roots
Discriminant Δ
4
Depressed cubic
t³ − t = 0 (x = t + 2)
Factored form
(x − 1)(x − 2)(x − 3)
Rational roots
1, 2, 3

Step-by-step solution
  1. Equation: x³ − 6x² + 11x − 6 = 0
  2. Substitute x = t + 2: t³ + pt + q = 0 with p = (3ac − b²)/(3a²) = −1 and q = (2b³ − 9abc + 27a²d)/(27a³) = 0, i.e. t³ − t = 0
  3. Discriminant: Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d² = 4
  4. Δ > 0: three distinct real roots. Cardano’s formula would need cube roots of complex numbers (casus irreducibilis), so the trigonometric method is used.
  5. t_k = 2√(−p/3)·cos(⅓·arccos((3q/(2p))·√(−3/p)) − 2πk/3), k = 0, 1, 2 → t = 1, 0, −1
  6. Back to x = t − b/(3a): x₁ = 1, x₂ = 2, x₃ = 3
  7. Rational root test (candidates p/q with p dividing d and q dividing a): x = 1, 2, 3.
  8. Check (Vieta): x₁ + x₂ + x₃ = −b/a = 6 and x₁x₂x₃ = −d/a = 6.

A cubic (third degree) equation has the form ax3+bx2+cx+d=0ax^3 + bx^2 + cx + d = 0 with a≠0a \neq 0. Every cubic has exactly three roots counted with multiplicity, and at least one of them is real, because the graph of a cubic always crosses the x-axis somewhere. This cubic equation calculator finds all three: the real ones, and the complex conjugate pair when there is one.

Besides the roots, it gives the discriminant (which tells you how many real roots to expect), the depressed cubic used by Cardano's method, the rational roots found with the rational root test, the factored form, and an exact form with fractions and square roots whenever one rational root lets the cubic split into a line times a quadratic.

As a cubic equation solver with steps it shows which method applies: Cardano's formula when there is one real root, the trigonometric (Viète) method when there are three distinct real roots, and the closed forms for repeated roots. The coefficients are converted to exact fractions first, so a discriminant that should be zero is exactly zero and repeated roots are never split by rounding.

How to use this calculator

  1. Rearrange your equation so that one side is 0 and the powers are in order: ax3+bx2+cx+d=0ax^3 + bx^2 + cx + d = 0.
  2. Enter a, b, c and d. A missing term has coefficient 0: for x3−15x−4=0x^3 - 15x - 4 = 0, enter b=0b = 0.
  3. Read the roots at the top. Complex roots are written as p±qip \pm qi.
  4. Check the exact form and the factored form, useful when a teacher expects surds rather than decimals.
  5. Open the steps to see the depressed cubic, the discriminant, the method and Vieta's check.

The formula

Depressed cubic. Substituting x=t−b3ax = t - \frac{b}{3a} removes the x2x^2 term and leaves

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

Discriminant. Δ=18abcd−4b3d+b2c2−4ac3−27a2d2\Delta = 18abcd - 4b^3 d + b^2 c^2 - 4ac^3 - 27a^2 d^2. If Δ>0\Delta > 0 there are three distinct real roots; if Δ=0\Delta = 0 at least two roots coincide; if Δ<0\Delta < 0 there is one real root and two complex conjugate roots.

Cardano's formula (used when Δ<0\Delta < 0):

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

Trigonometric method (used when Δ>0\Delta > 0, where Cardano would need cube roots of complex numbers):

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

Rational root test. With integer coefficients, any rational root p/qp/q has pp dividing dd and qq dividing aa. Each root found is then confirmed with Vieta's formulas: x1+x2+x3=−bax_1 + x_2 + x_3 = -\frac{b}{a} and x1x2x3=−dax_1 x_2 x_3 = -\frac{d}{a}.

Worked example

Three rational roots. For x3−6x2+11x−6=0x^3 - 6x^2 + 11x - 6 = 0 the discriminant is 44 and the roots are 1, 2, 31,\ 2,\ 3, so the cubic factors as (x−1)(x−2)(x−3)(x - 1)(x - 2)(x - 3).

Casus irreducibilis. For x3−15x−4=0x^3 - 15x - 4 = 0, Δ=−4(−15)3−27(−4)2=13068>0\Delta = -4(-15)^3 - 27(-4)^2 = 13068 > 0: three real roots, yet Cardano's formula gives 2+11i3+2−11i3\sqrt[3]{2 + 11i} + \sqrt[3]{2 - 11i}, a famous puzzle studied by Bombelli. The rational root test is quicker: x=4x = 4 works, and dividing by x−4x - 4 leaves x2+4x+1x^2 + 4x + 1, whose roots are −2±3-2 \pm \sqrt{3}, about −3.732050808-3.732050808 and −0.2679491924-0.2679491924.

One real root. For x3+x+1=0x^3 + x + 1 = 0, Δ=−4−27=−31<0\Delta = -4 - 27 = -31 < 0. Cardano gives u≈0.329452338u \approx 0.329452338, v≈−1.011780142v \approx -1.011780142, so x1=u+v≈−0.6823278038x_1 = u + v \approx -0.6823278038. The other two roots are x≈0.3411639019±1.1615414 ix \approx 0.3411639019 \pm 1.1615414\,i.

How to solve a cubic equation by hand

The quickest route is usually to look for a rational root first. List the fractions ±p/q\pm p/q with pp dividing the constant term and qq dividing the leading coefficient, and test them. Once a root rr is found, divide by x−rx - r with synthetic division (see the polynomial calculator); what is left is a quadratic you can finish with the quadratic formula calculator.

When no rational root exists, you need the general method: depress the cubic, compute the discriminant, then apply Cardano's formula or the trigonometric form. That is where a calculator saves real time, because the cube roots and cosines rarely come out as nice numbers.

What the discriminant tells you

Discriminant Roots Graph of y=ax3+bx2+cx+dy = ax^3 + bx^2 + cx + d
Δ>0\Delta > 0 Three distinct real roots Crosses the x-axis three times
Δ=0\Delta = 0 A double or triple real root Touches the x-axis at a turning point
Δ<0\Delta < 0 One real root, two complex roots Crosses the x-axis once

You can confirm the picture with the graphing calculator.

Frequently asked questions

How many roots does a cubic equation have?

Always three, counted with multiplicity, by the fundamental theorem of algebra. At least one is real. The other two are either both real or a pair of complex conjugates.

What is the casus irreducibilis?

It is the case of three distinct real roots with no rational one, where Cardano’s formula unavoidably passes through cube roots of complex numbers. The trigonometric method avoids this and gives the three real roots directly with cosines.

Can I solve a third degree equation with the quadratic formula?

Not directly. You first need one root, for example from the rational root test; dividing by (x − root) leaves a quadratic that the quadratic formula solves.

Why are some roots shown with √ and others as decimals?

When a rational root exists, the remaining quadratic gives exact roots with square roots, shown in the exact form. Otherwise the roots are generally not expressible with simple square roots, so they are given to 10 significant digits.

Does the calculator accept decimal coefficients?

Yes. Decimals up to 10 places are converted to exact fractions, so the discriminant sign and repeated roots are detected exactly.

Sources

Last updated:

More Math calculators

People also use