Math calculator

Cubic Equation Calculator

Three roots, always — and the discriminant says which kind before you find any of them.

Solve a cubic

The discriminant first, then the roots — exact wherever they can be.

Write it as an expression — the “= 0” is assumed. Fractions like 1/2 are fine.

x³ − 6x² + 11x − 6 = 0

1, 2, 3

Three distinct real roots

Discriminant Δ

4

positive — three distinct real roots

Method used

Rational root, then the quadratic formula

exact throughout

Depressed form

t³ − t = 0

x = t − −2

Factored

(x − 1)(x − 2)(x − 3)

exact

The discriminant is positive, so the curve crosses the x-axis three times at three different places. 1 is a root, so (x − 1) divides the cubic exactly. Dividing it out leaves a quadratic, which the quadratic formula finishes in exact form — no numerical root-finding is needed anywhere.

The rational root search

8 candidates from the rational root theorem: −6, −3, −2, −1, 1, 2, 3, 6. The first that works is 1, leaving the quadratic x² − 5x + 6.

Where the curve meets the axis

Three crossings, one per distinct real root. The shape is schematic; the crossings are exact.

Vieta’s relations, computed twice

Each relation computed from the coefficients and again from the roots
RelationFrom the coefficientsFrom the roots
Sum of the roots−b/a = 66
Sum of the three pairwise productsc/a = 1111
Product of the roots−d/a = 66

Depressing the cubic

  1. 1Substitutex = t − −2This is b/3a, and it is the substitution that removes the t² term.
  2. 2What is leftt³ − t = 0p = −1, q = 0
  3. 3Why it helpsno t² termA depressed cubic has one fewer parameter, and it is the form every closed-form method is written for.

All three of Vieta’s relations agree between the coefficients and the roots.

Every root above is exact.

What this tool shows

The discriminant, then the roots — exact whenever the cubic allows it, and honest about the case where no real radical expression exists.

  • The discriminant, and which of the three root patterns it means
  • Exact roots — rational and surd — whenever a rational root exists
  • The trigonometric form for the case where no real radical expression does
  • Vieta’s relations computed from the coefficients and checked against the roots
Exact roots wherever they exist The discriminant before the roots Vieta’s relations as a check Free, no signup

Free, no signup — every answer checked against Vieta’s relations.

Updated 6 September 2026 · Works in any browser, no installation

Every cubic has exactly three roots, and the discriminant says what kind they are before you find them. x³ − 6x² + 11x − 6 = 0 has Δ = 4, which is positive, so all three are real and distinct: 1, 2, 3.

At a glance

Formula shown
Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d². Δ > 0 gives three distinct real roots, Δ = 0 a repeated root, Δ < 0 one real root and a complex pair.
Scenario support
Any cubic with rational coefficients, in standard form or not.
Educational estimate
Planning support from the values you enter — not professional advice.

What the discriminant tells you

Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d² is a mouthful, and it is worth computing anyway, because its sign answers the question you actually have before you have done any solving:

  • Δ > 0 — three distinct real roots. The curve crosses the axis three times. x³ − 6x² + 11x − 6 = 0 has Δ = 4.
  • Δ = 0 — a repeated root. Two of the three have collided, and the curve touches the axis there instead of crossing it. x³ − 3x + 2 = 0 has Δ = 0, with roots −2 and 1 twice.
  • Δ < 0 — one real root and a complex conjugate pair. Exactly one crossing. x³ + x + 1 = 0 has Δ = −31.

Note what is not on that list: a cubic with no real roots. A cubic cannot have none. Its ends run to +∞ and −∞ in opposite directions, so it must cross the axis at least once — which is why the Δ < 0 case is “one real” rather than “none”. That is the sharpest difference from a quadratic, where a negative discriminant means no real roots at all.

The discriminant is also exact here. It is a polynomial in the coefficients, so with rational inputs it is a rational number and its sign is decided rather than estimated — which matters, because a Δ that is very small but not zero is a genuinely different case from Δ = 0 and a floating-point computation cannot always tell them apart.

Depressing the cubic is the whole trick

The substitution x = t − b/3a removes the t² term. That is not a tidying step; it is the reason cubics are solvable at all. A general cubic has four coefficients and a depressed one has two, and every closed-form method — Cardano’s, the trigonometric form, all of them — is written for the depressed shape.

For x³ − 5x + 1 = 0 the shift is 0 and the depressed form is t³ − 5t + 1 = 0, with p = −5 and q = 1. Solve that for t, subtract the shift, and you have x.

Why b/3a specifically: the sum of the three roots is −b/a, so their average is −b/3a. Shifting by that amount moves the roots so they average to zero — and three numbers averaging zero sum to zero, which is exactly the condition for the t² coefficient to vanish. The substitution is a recentring, not a manipulation.

Look for a rational root before reaching for a formula

Cardano’s formula always works, and it is almost never what you want. If the cubic has a rational root, the rational root theorem finds it from a short finite list, and dividing it out leaves a quadratic that the quadratic formula finishes exactly — in surds, not decimals.

x³ − 15x − 4 = 0 is the case worth seeing. Its discriminant is positive so all three roots are real, and one of them is rational: 4. Dividing out leaves x² + 4x + 1, whose roots are −2 − √3 and −2 + √3 — exact surds. A numerical solver would have given six decimals for those, and a page that reached for Cardano first would have gone through complex cube roots to arrive at the same three real numbers.

The candidate list is short because it is constrained on both ends: the numerator divides the constant term and the denominator divides the leading coefficient. For x³ − 6x² + 11x − 6 = 0 that is 8 candidates in total, and the first one tested works. The Rational Zeros Calculator shows that search in full, including the bound rules that strike most of the list off without testing it.

Casus irreducibilis: why there are two methods

Here is the fact that most cubic pages leave out. When a cubic has three real roots and no rational root, Cardano’s formula still gives the right answers — but only by passing through square roots of negative numbers on the way. The three real answers come out of an expression that is complex in the middle.

That is not a defect in the formula or a limitation of this implementation. It is a theorem: for such a cubic there is no expression in real radicals over the rationals that gives the roots. None exists to be found. The case has a name — casus irreducibilis — and it is why the trigonometric form exists:

t = 2√(−p/3) · cos(⅓·arccos(3q/(2p)·√(−3/p)) − 2πk/3) for k = 0, 1, 2.

x³ − 5x + 1 = 0 is exactly this case: Δ = 473 is positive, so all three roots are real — −2.33005874, 0.2016396757, 2.128419064 — and none of them is rational. This calculator uses the trigonometric form there and says so, rather than printing cube roots of complex numbers and calling the result a closed form.

When Δ < 0 the situation reverses: there is one real root, the quantity under Cardano’s inner square root is positive, and the formula works directly in the reals. x³ + x + 1 = 0 solves that way, giving −0.6823278038 for the real root and 0.3411639019 + 1.1615414i and 0.3411639019 − 1.1615414i for the pair.

Vieta’s relations, as a check you can actually do

Three quantities are readable straight off the coefficients, without solving anything:

  • the roots sum to −b/a,
  • their three pairwise products sum to c/a,
  • and they multiply to −d/a.

For x³ − 6x² + 11x − 6 = 0 that is −b/a = 6, c/a = 11 and −d/a = 6 — and the roots 1, 2, 3 give 6, 11, 6. Two multiplications and two additions, and a wrong root is caught immediately.

The tool computes both columns independently and shows them side by side for that reason. It is not decoration: while this page was being built, that comparison is what caught a repeated root being counted once instead of twice. The sum was short by exactly the missing copy, and no amount of staring at the root list would have shown it.

Repeated roots, and how to spot one

Δ = 0 means the cubic and its derivative share a root, which is the same as saying the curve touches the axis rather than crossing it there. Two shapes are possible:

  • A double root and a simple one. x³ − 3x + 2 = 0 = (x + 2)(x − 1)². The curve crosses at −2 and touches at 1.
  • A triple root. 8x³ − 12x² + 6x − 1 = 0 = (2x − 1)³, which is a perfect cube. The curve flattens out and passes through the axis at 1/2 without changing side in the usual way.

For a cubic with rational coefficients, a repeated root is always rational. That is a small but useful fact: it means the Δ = 0 case never needs a numerical method, because gcd(f, f′) is a rational polynomial of degree 1 or 2 and the rational root theorem finds the repeat directly. Every repeated-root cubic on this page therefore comes out exact.

Sources and methodology

The discriminant formula, Cardano’s solution and the trigonometric form are standard results rather than proprietary ones; the references below are where their canonical statements live.

Method. Every figure on this page comes from src/lib/cubic-equation.ts, which works over the exact-rational arithmetic in src/lib/algebra/poly.ts. The discriminant, the depressed form, the rational root search and the deflated quadratic are all exact; only the roots of a cubic with no rational root are numerical, and the page marks those. That engine is verified on every change against 52 hand-written assertions, including that Vieta’s three relations agree between the coefficients and the roots in every case, and that the printed factorisation multiplies back to the original cubic. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Quadratic FormulaSolve any quadratic with exact roots — surds stay surds and a negative discriminant gives the complex pair — plus the vertex, the factored form and every step of the working.
Rational ZerosList every rational root candidate from the rational root theorem, test each one, divide out the hits by synthetic division, and use the bound rules to strike the rest off without testing them.
Descartes' Rule of SignsCount the sign variations in f(x) and f(-x), list every combination of positive, negative and complex roots the rule permits, and see which one is actually true.
DiscriminantEvaluate b² − 4ac, the cubic and quartic discriminants, or D = f_xx·f_yy − (f_xy)² for the second-derivative test, in exact arithmetic so the sign is never a rounding artefact.
Polynomial DivisionDivide polynomials by long division or synthetic division, with the quotient, the remainder, the remainder theorem check and every stage of the working.
Factoring TrinomialsFactor a trinomial by the AC method with every factor pair of ac listed, the common factor taken out first, and the answer multiplied back out to check it.

More in Math, or browse all calculators.

Read the guide

A cubic is one degree past the case everyone knows, and the methods diverge there for reasons worth understanding. Which Method Should You Use to Solve a Quadratic? covers the degree-2 decision that the deflation step here depends on — factoring, completing the square, or the formula — and when each one is genuinely faster.

Educational use disclaimer

This calculator solves cubic equations with rational coefficients. Where a rational root exists the answer is exact — the roots are surds, not decimals — and where none does, the roots are given numerically with the method that produced them named. The discriminant, the depressed form and the factorisation are exact in every case, and Vieta’s relations are computed independently from the coefficients and compared against the roots before anything is shown.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 6 September 2026

  1. Published the cubic equation page: exact roots whenever a rational one exists — found by the rational root theorem, divided out, and finished with the quadratic formula in surds.
  2. Uses the trigonometric form in casus irreducibilis rather than printing cube roots of complex numbers, and Cardano's formula only where it stays real.
  3. Vieta's relations are computed independently from the coefficients and shown beside the roots, so the answer carries its own check.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.