Skip to content

Cubic Equation Solver

Updated:

Enter the coefficients a, b, c and d to solve any cubic equation of the form ax³ + bx² + cx + d = 0. The calculator finds all real roots using Cardano's method and indicates when the remaining roots are complex.

Cubic Equation

Input Fields
a
b
c
d
If enabled, the result will update automatically when you change any value.

Cubic Equation Formula

Formula
\[ ax^3 + bx^2 + cx + d = 0 \quad (a \neq 0) \] \[ \text{Substitute } x = t - \frac{b}{3a} \text{ to get the depressed cubic } t^3 + pt + q = 0 \] \[ p = \frac{3ac - b^2}{3a^2}, \qquad q = \frac{2b^3 - 9abc + 27a^2d}{27a^3} \] \[ t = \sqrt[3]{-\frac{q}{2} + \sqrt{\Delta}} + \sqrt[3]{-\frac{q}{2} - \sqrt{\Delta}}, \qquad \Delta = \left(\frac{q}{2}\right)^2 + \left(\frac{p}{3}\right)^3 \]

Where:

  • \(a, b, c, d\) — coefficients of the cubic equation
  • \(x\) — the unknown; each root \(x_i\) is recovered from \(x_i = t_i - \frac{b}{3a}\)
  • \(\Delta\) — the discriminant of the depressed cubic: if \(\Delta > 0\) there is one real root and two complex roots; if \(\Delta = 0\) all roots are real with at least two equal; if \(\Delta < 0\) there are three distinct real roots, found with a trigonometric form of Cardano's formula.

The substitution \(x = t - \frac{b}{3a}\) removes the quadratic term, and Cardano's formula then gives the roots of the simpler depressed cubic.

Cubic Equation – Calculation Example

Example: solve \(x^3 + 8x^2 + 16x = 0\), i.e. \(a = 1\), \(b = 8\), \(c = 16\), \(d = 0\) (the default values of the calculator).

\[ p = \frac{3 \cdot 1 \cdot 16 - 8^2}{3 \cdot 1^2} = \frac{48 - 64}{3} = -\frac{16}{9} \]

\[ q = \frac{2 \cdot 8^3 - 9 \cdot 1 \cdot 8 \cdot 16 + 27 \cdot 1^2 \cdot 0}{27 \cdot 1^3} = \frac{1024 - 1152}{27} = \frac{64}{27} \]

\[ \Delta = \left(\frac{64}{54}\right)^2 + \left(-\frac{16}{27}\right)^3 = \frac{4096}{729} - \frac{4096}{729} = 0 \]

Since \(\Delta = 0\), all roots are real and at least two coincide. With \(\sqrt[3]{q/2 + 0}\;=\;\sqrt[3]{64/27} = \frac{4}{3}\) and \(\frac{b}{3a} = \frac{8}{3}\):

\[ x_1 = -\frac{8}{3} + 2 \cdot \frac{4}{3} = 0, \qquad x_2 = x_3 = -\left(\frac{4}{3} + \frac{8}{3}\right) = -4 \]

Result: \(x_1 = 0\), \(x_2 = x_3 = -4\). Indeed, \(x^3 + 8x^2 + 16x = x(x + 4)^2 = 0\).

How to Use the Cubic Equation Calculator

  1. Enter the coefficient a of the \(x^3\) term. It must not be zero — otherwise the equation is not cubic (a helpful error message appears if you enter 0).
  2. Enter the coefficient b of the \(x^2\) term, the coefficient c of the \(x\) term, and the constant term d. Use 0 for any missing term.
  3. The three roots \(x_1\), \(x_2\) and \(x_3\) are calculated instantly as you type.
  4. Check the results: if two roots are equal, the equation has a double (repeated) root; if a result shows “Complex root”, that pair of roots is complex and only the real root is displayed numerically.

What Is a Cubic Equation?

A cubic equation is any equation that can be written as \(ax^3 + bx^2 + cx + d = 0\) with \(a \neq 0\). It is the next step up from the quadratic equation, and unlike quadratics it is guaranteed to have at least one real root — a consequence of the fact that a third-degree polynomial always crosses the x-axis somewhere.

By the fundamental theorem of algebra, a cubic has exactly three roots when complex roots are counted. The three possibilities are: three distinct real roots; one real root plus a pair of complex conjugate roots; or real roots with one of them repeated (a double root), as in the worked example above. Which case applies is decided by the sign of the discriminant \(\Delta\) of the depressed cubic.

The solution method used here goes back to Gerolamo Cardano's Ars Magna (1545). The key trick is the substitution \(x = t - \frac{b}{3a}\), which eliminates the \(x^2\) term and reduces the problem to the depressed cubic \(t^3 + pt + q = 0\). When \(\Delta < 0\), the square roots in Cardano's formula become imaginary even though the final roots are real — historically called the casus irreducibilis — so the calculator switches to a trigonometric variant using \(\cos\) and \(\arccos\) to produce the three real roots directly.

Cubic equations appear wherever a quantity depends on volume or on a third power: finding dimensions of a box with a given volume, computing intersections of a line and a cubic curve, eigenvalue problems in engineering, and thermodynamic property calculations.

Interpreting the Results

Each root \(x_i\) is a value of \(x\) at which the polynomial equals zero — geometrically, an x-intercept of the curve \(y = ax^3 + bx^2 + cx + d\). A double root (two equal values in the results) means the curve touches the axis at that point without crossing it. When the output shows “Complex root”, the two non-real roots form a complex conjugate pair, so only the single real root is given numerically. Results are rounded to 5 decimal places, which is enough for most practical purposes.

Tips, Assumptions and Limitations

  • Coefficient a must be non-zero. If \(a = 0\), the equation is actually quadratic (or linear), and you should use the quadratic equation calculator instead.
  • Complex roots are not listed numerically. If your equation has one real and two complex roots, only the real root is shown; the complex pair can be found from \(x_2 + x_3 = -\frac{b}{a} - x_1\) and \(x_2 x_3 = \frac{d/a}{x_1}\). The complex root calculator covers complex solutions in more detail.
  • Rounding. Roots are rounded to 5 decimal places. Values shown as, e.g., 3.99999 or −0.00001 for a “nice” equation are simply rounding artifacts.
  • Check by factoring when possible. If one root \(r\) is found, \((x - r)\) divides the polynomial, and the remaining roots come from a quadratic. Tools like Descartes' rule of signs can help you predict how many positive or negative roots to expect before solving.
  • Higher degrees. For fourth-degree equations, use the quartic equation solver; general polynomials of degree five and higher have no formula in radicals at all.

Frequently Asked Questions

How can I solve a cubic equation by hand without Cardano's formula?

The fastest manual method is the rational root theorem: test divisors of the constant term d (divided by divisors of a) as candidate roots. If a candidate r makes the polynomial zero, factor out (x − r) and solve the remaining quadratic with the standard formula. This works for most textbook cubics with integer or rational roots, and is far less error-prone than applying Cardano's formula directly.

How do I know how many real roots a cubic has before solving it?

Every cubic has either one, two (with a repeated root), or three real roots. The discriminant of the original polynomial, \(D = 18abcd - 4b^3d + b^2c^2 - 4ac^3 - 27a^2d^2\), tells you: D > 0 means three distinct real roots, D = 0 means repeated real roots, and D < 0 means exactly one real root plus two complex ones. A quick sketch of the graph also shows how many times the curve crosses the x-axis.

Why does the calculator show 'Complex root' instead of numbers?

When the discriminant is positive, the cubic has one real root and a pair of complex conjugate roots, and the calculator displays only the real one numerically. You can find the complex pair yourself using Vieta's formulas: with the real root \(x_1\), the pair satisfies \(x_2 + x_3 = -b/a - x_1\) and \(x_2 x_3 = (d/a)/x_1\), which gives a quadratic you can solve in the complex plane.

Can I solve a cubic equation with fractions or decimal coefficients?

Yes. Enter fractions as decimals (e.g. 0.5 for 1/2) — the calculator works with any real coefficients. To avoid rounding surprises, it is often cleaner to multiply the whole equation by the common denominator first, since multiplying by a non-zero constant does not change the roots. For example, \(0.5x^3 + 1.5x = 0\) has the same roots as \(x^3 + 3x = 0\).

What is a double root and how do I recognize it in the results?

A double root is a root that appears twice — the curve touches the x-axis there without crossing it. You will see two identical values among the results, such as \(x_2 = x_3 = -4\). Note that values like 3.99998 and 4.00001 appearing together are usually just rounding of a true double root, since results are rounded to 5 decimal places. Verify by checking whether the derivative also vanishes at that point.

What common mistakes should I avoid when entering a cubic equation?

The most frequent error is forgetting missing terms: if your equation is \(2x^3 - 5 = 0\), you must enter a = 2, b = 0, c = 0, d = −5, not skip fields. Also watch signs — the equation must equal zero on the right, so move everything to the left side first. Entering a = 0 means the equation is not cubic at all; use the quadratic calculator in that case.

Why did Cardano's formula historically fail for three real roots?

When a cubic has three distinct real roots, the intermediate square root \(\sqrt{\Delta}\) in Cardano's formula becomes imaginary, even though the final answers are real — a paradox called the casus irreducibilis. Renaissance mathematicians could not avoid these imaginary intermediate steps with radicals alone. That is why this calculator switches to a trigonometric form using \(\cos\) and \(\arccos\) in that case, producing the three real roots directly and accurately.

Leave a Reply

Your email address will not be published. Required fields are marked *