Home
Must not be zero.
May be zero.
May be zero.
May be zero.
Try:

What Is a Cubic Equation?

A cubic equation is a polynomial equation of degree 3:

ax³ + bx² + cx + d = 0, a ≠ 0

The coefficients a, b, c, d are real numbers, and the leading coefficient a must be non-zero (otherwise the equation is not cubic). Every cubic equation has exactly three roots in the complex plane, counting multiplicity — although some may be repeated or complex conjugates.

How Many Real Roots Does a Cubic Have?

A cubic always has at least one real root, because the function f(x) = ax³ + bx² + cx + d goes to +∞ in one direction and −∞ in the other. Beyond that, the number of real roots depends on the discriminant:

  • Δ > 0 — one real root and two complex conjugate roots.
  • Δ = 0 — all roots real; at least two of them are equal (a double or triple root).
  • Δ < 0 — three distinct real roots (the "casus irreducibilis" — this is the case that historically forced mathematicians to invent complex numbers).

The discriminant used here is defined after depressing the cubic (see below) as Δ = (q/2)² + (p/3)³, where p and q are the coefficients of the depressed cubic.

The Depressed Cubic

The first step in any classical solution is to eliminate the x² term by substituting x = t − b/(3a). This gives the depressed cubic:

t³ + pt + q = 0

where

p = (3ac − b²) / (3a²)
q = (2b³ − 9abc + 27a²d) / (27a³)

Solving for t is equivalent to solving the original cubic; at the end, we shift back with x = t − b/(3a).

Cardano's formula (for Δ ≥ 0):

u = ∛(−q/2 + √Δ),   v = ∛(−q/2 − √Δ)

t₁ = u + v

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

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

Trigonometric method (for Δ < 0): let m = 2√(−p/3) and θ = (1/3)·arccos[(3q)/(2p)·√(−3/p)], then tₖ = m·cos(θ − 2πk/3) for k = 0, 1, 2.

Vieta's Formulas

Even before solving, you can read useful information from the coefficients:

  • Sum of roots: x₁ + x₂ + x₃ = −b/a
  • Pairwise sum: x₁x₂ + x₁x₃ + x₂x₃ = c/a
  • Product of roots: x₁·x₂·x₃ = −d/a

These identities hold for complex roots too, and they are an excellent sanity check on any numerical solution.

Special Cases

  • No constant term (d = 0): x = 0 is automatically a root; the other two come from the quadratic x(ax² + bx + c) = 0.
  • No quadratic term (b = 0): the cubic is already depressed; solving t³ + pt + q = 0 directly gives the roots.
  • No linear term (c = 0): the cubic is x(ax² + b) = 0, giving x = 0 and two roots of a quadratic.
  • Perfect cube (Δ = 0 with p = q = 0): a triple root at x = −b/(3a).

Assumptions and Limitations

  • The leading coefficient a must be non-zero; otherwise the equation reduces to a quadratic. Use a quadratic solver in that case.
  • Coefficients are limited to −10⁹ ≤ value ≤ 10⁹ to keep floating-point arithmetic reliable.
  • For Δ extremely close to 0, the classical Cardano formula becomes numerically delicate. The solver detects this and falls back to the trigonometric method when needed.
  • Roots are reported as exact fractions when they are rational and the denominator is small, otherwise as decimals to the chosen precision.
  • Complex roots are reported in the form a ± bi with the imaginary part shown to the same precision.
  • This is an educational and cross-checking tool. For symbolic factoring of special cubics (sums of cubes, differences of squares hidden inside, etc.), combine it with our Factoring Calculator.

❓ Cubic Equation Solver FAQ

What is a cubic equation?

A cubic equation is a polynomial equation of degree 3 — that is, the highest power of the unknown is 3. The standard form is ax³ + bx² + cx + d = 0, where a, b, c, d are real numbers and a ≠ 0. Every cubic equation has exactly three roots in the complex numbers, counting multiplicity.

How many real roots does a cubic have?

A cubic always has at least one real root. Depending on the discriminant, it may have one real root (plus two complex conjugate roots) or three real roots. When two real roots coincide, that counts as a double root.

What is the discriminant of a cubic?

After depressing the cubic to t³ + pt + q = 0, the discriminant is Δ = (q/2)² + (p/3)³. Its sign tells you the nature of the roots: Δ > 0 gives one real root and two complex conjugates; Δ = 0 gives repeated real roots; Δ < 0 gives three distinct real roots.

What is the depressed cubic?

The depressed cubic is the cubic obtained by substituting x = t − b/(3a) to eliminate the t² term. It has the form t³ + pt + q = 0, where p and q are computed from a, b, c, d. Classical formulas such as Cardano's are much simpler when stated for the depressed cubic.

Who was Cardano, and why is the formula named after him?

Gerolamo Cardano (1501–1576) published the first general solution of the cubic in his 1545 book "Ars Magna". The formula itself was discovered by Scipione del Ferro and independently by Niccolò Tartaglia; Cardano was the one who published it (over Tartaglia's objections). The name has stuck ever since.

What is the "casus irreducibilis"?

The "irreducible case" is the situation Δ < 0, where the cubic has three distinct real roots. Historically, applying Cardano's formula naively forces you to take square roots of negative numbers — i.e. to work with complex numbers — even though all three roots are real. The trigonometric method avoids this by using cosines and arccosines instead.

What does the trigonometric method do?

When Δ < 0, the depressed cubic has p < 0, and one can write the solution with cosines: tₖ = 2√(−p/3)·cos(θ − 2πk/3), where θ = (1/3)·arccos[(3q)/(2p)·√(−3/p)]. This produces the three real roots directly, with no complex intermediate steps.

What if my cubic has a repeated root?

If two or three roots coincide, the discriminant Δ is zero. The solver detects this and reports the double or triple root explicitly, together with the remaining single root (if any). For example, x³ − 3x² + 3x − 1 = 0 has a triple root at x = 1.

How are complex roots displayed?

Complex roots come in conjugate pairs a + bi and a − bi (when the coefficients are real). The solver shows them in the form "a + bi" and "a − bi", rounded to the selected precision. If the imaginary part is numerically negligible, the root is reported as real.

Why do I get decimals instead of exact fractions?

Cardano's formula involves cube roots, so most roots are irrational — they cannot be written as simple fractions. The solver still checks whether each root is a rational number with a small denominator; if it is, the fraction is shown alongside the decimal. For irrational roots, only decimals are shown, rounded to the precision you choose.

Can I solve a cubic with a = 0?

No — if a = 0, the equation is quadratic (or lower), not cubic. Use a quadratic solver for that. This tool explicitly rejects a = 0 to keep the cubic methods valid.

How can I verify the roots?

Substitute each root back into ax³ + bx² + cx + d. If the root is real, you should get zero. For complex roots, the result should be a complex number very close to zero (any non-zero part is rounding error). The solver includes a verification step in the step-by-step working.

Why does Vieta's formula give "sum of roots = −b/a"?

If you factor ax³ + bx² + cx + d = a(x − x₁)(x − x₂)(x − x₃) and expand, the coefficient of x² is −a(x₁ + x₂ + x₃). Matching coefficients gives x₁ + x₂ + x₃ = −b/a. The other two identities follow the same way.