Cubic Equation Solver
Solves any cubic equation ax³ + bx² + cx + d = 0 using Cardano's method. Enter the four coefficients and the calculator returns the real roots, flags complex ones, and detects repeated roots.
Cubic Equation
Cubic Equation Formula
Where:
- \(a, b, c, d\) — the coefficients of the cubic equation
- \(p, q\) — the coefficients of the depressed cubic after removing the quadratic term
From here, Cardano's method applies. The key quantity is the discriminant \(\Delta = \left(\frac{q}{2}\right)^2 + \left(\frac{p}{3}\right)^3\):
- If \(\Delta > 0\), there is one real root, given by
\( t = \sqrt[3]{-\frac{q}{2} + \sqrt{\Delta}} + \sqrt[3]{-\frac{q}{2} - \sqrt{\Delta}} \) - If \(\Delta = 0\), all roots are real and at least two coincide: \( t_1 = 2\sqrt[3]{-\frac{q}{2}} \), \( t_2 = t_3 = -\sqrt[3]{-\frac{q}{2}} \)
- If \(\Delta < 0\), there are three distinct real roots, found with the trigonometric form \( t_k = 2\sqrt{-\frac{p}{3}} \cos\left(\frac{\theta + 2\pi k}{3}\right) \), where \( \cos\theta = \frac{3q}{2p}\sqrt{-\frac{3}{p}} \), \( k = 0, 1, 2 \)
Each root of the original equation is recovered by back-substitution: \( x = t - \frac{b}{3a} \).
Cubic Equation – Calculation Example
Example: solve \( x^3 + 8x^2 + 16x = 0 \) (coefficients \( a = 1 \), \( b = 8 \), \( c = 16 \), \( d = 0 \) — the calculator's default values).
\[ p = \frac{3 \cdot 1 \cdot 16 - 8^2}{3 \cdot 1^2} = \frac{48 - 64}{3} = -\frac{16}{3}, \qquad q = \frac{2 \cdot 8^3 - 9 \cdot 1 \cdot 8 \cdot 16 + 27 \cdot 1^2 \cdot 0}{27 \cdot 1^3} = \frac{64}{27} \]
\[ \Delta = \left(\frac{q}{2}\right)^2 + \left(\frac{p}{3}\right)^3 = \left(\frac{32}{27}\right)^2 + \left(-\frac{16}{9}\right)^3 = \frac{1024}{729} - \frac{4096}{729} \cdot \frac{1}{...} = 0 \]
Since \( \Delta = 0 \), the equation has a repeated root. With \( \sqrt[3]{-\frac{q}{2}} = \sqrt[3]{-\frac{32}{27}} = -\frac{4}{3} \):
\[ t_1 = 2\left(-\frac{4}{3}\right) = -\frac{8}{3}, \qquad t_2 = t_3 = -\left(-\frac{4}{3}\right) = \frac{4}{3} \]
Back-substituting \( x = t - \frac{8}{3} \):
\[ x_1 = -\frac{8}{3} - \frac{8}{3} = 0, \qquad x_2 = x_3 = \frac{4}{3} - \frac{8}{3} = -4 \]
Result: \( x_1 = 0 \), \( x_2 = -4 \), \( x_3 = -4 \). You can verify this by factoring: \( x^3 + 8x^2 + 16x = x(x+4)^2 \).
How to Use the Calculator
- Enter the leading Coefficient a (the number multiplying \( x^3 \)). It must not be 0 — otherwise the equation is not cubic, and the calculator shows an error.
- Enter Coefficient b, the multiplier of \( x^2 \).
- Enter Coefficient c, the multiplier of \( x \).
- Enter Coefficient d, the constant term. Use 0 if the equation has no constant (as in \( x^3 + 8x^2 + 16x = 0 \)).
- Read the results: Root x₁, Root x₂ and Root x₃. If the equation has only one real solution, the other two fields display “Complex root”, since the remaining two roots are complex conjugates.
What Is a Cubic Equation?
A cubic equation is any polynomial equation of degree three, written in the standard form \( ax^3 + bx^2 + cx + d = 0 \) with \( a \neq 0 \). Every cubic equation with real coefficients has at least one real root and at most three. Unlike a quadratic equation, which can be solved with a single compact formula, a cubic requires either factoring, Cardano's method, or a numerical approach — which is why a solver tool saves so much time.
The calculator works by first eliminating the \( x^2 \) term. The substitution \( x = t - \frac{b}{3a} \) turns any cubic into a depressed cubic \( t^3 + pt + q = 0 \), a simpler form known since the 16th century. Cardano's formula then computes a discriminant-like quantity \( \Delta \) that tells you the nature of the roots before they are even computed: one real plus two complex roots when \( \Delta > 0 \), all real with a repeated root when \( \Delta = 0 \), and three distinct real roots when \( \Delta < 0 \).
Interpreting the output is straightforward. If all three roots are numbers, the graph of \( y = ax^3 + bx^2 + cx + d \) crosses the x-axis at those points (touching it at a repeated root). If two fields say “Complex root”, the graph crosses the x-axis only once, at the single real root shown. The two hidden roots are a complex conjugate pair; you can explore them further with the complex number calculator.
Cubic equations appear everywhere in applied mathematics: finding intersection points in geometry, computing eigenvalues in linear algebra, modeling volume problems in physics, and analyzing stability in engineering and economics.
Assumptions, Limitations and Tips
- Coefficient a must be nonzero. If \( a = 0 \), the equation is actually quadratic (or linear) — use the quadratic equation solver instead.
- Complex roots are flagged, not computed. The calculator reports real roots numerically and shows “Complex root” for the non-real pair. This keeps the output clean for everyday use.
- Rounding to 5 decimal places. Results are rounded, so a root like \( \sqrt[3]{2} \) appears as 1.25992. For most purposes this is more than enough precision; tiny discrepancies may appear if you substitute a rounded root back into the equation.
- Numerical edge cases. Very large or very small coefficients can cause floating-point round-off, so a discriminant that is mathematically exactly zero may compute as a very small positive or negative number. In such cases the displayed roots may differ in the last decimals.
- Check with Descartes' rule. Before solving, you can estimate how many positive and negative real roots exist using the Descartes' Rule of Signs calculator, then use the result as a sanity check on the solver's output. Hand in hand with that, the cubic root calculator is useful when you only need \( \sqrt[3]{n} \) for a single number.
- Simple factoring first. Always check whether \( x = 0 \) is a root (i.e., \( d = 0 \)) or whether an obvious integer like 1, −1, 2 or −2 satisfies the equation — factoring out one root reduces the cubic to a quadratic you can solve mentally.
Frequently Asked Questions
How do I solve a cubic equation by hand without Cardano's formula?
First try the rational root theorem: any rational root \( \frac{m}{n} \) has \( m \) dividing the constant \( d \) and \( n \) dividing the leading coefficient \( a \). Test candidates like ±1, ±2, ±d by substitution. Once one root \( x_1 \) is found, divide the polynomial by \( (x - x_1) \) (long division or synthetic division) to get a quadratic, then apply the quadratic formula. This covers most textbook cubics.
How many real roots can a cubic equation have?
Always at least one and at most three. The page's quantity \( \Delta \) decides: \( \Delta > 0 \) gives one real root plus a complex conjugate pair, \( \Delta = 0 \) gives three real roots with at least two equal, and \( \Delta < 0 \) gives three distinct real roots. You can also check quickly with the graph: an odd-degree polynomial with real coefficients must cross the x-axis at least once.
How can I verify the roots the calculator gives me?
Substitute each root back into \( ax^3 + bx^2 + cx + d \) — the result should be 0 (or very close, since values are rounded to 5 decimals). You can also use Vieta's formulas as a cross-check: the sum of the roots equals \( -\frac{b}{a} \) and their product equals \( -\frac{d}{a} \). For the example \( x(x+4)^2 \), the sum is \( 0 - 4 - 4 = -8 = -\frac{8}{1} \).
Why does the calculator say “Complex root” instead of showing a number?
When \( \Delta > 0 \) the two remaining roots are complex conjugates \( u \pm vi \). The calculator only reports numerical real roots, so it flags the non-real pair rather than printing complex values. If you need them, note that the real part \( u \) equals \( -\frac{b}{3a} \) minus half the real root, and use the quadratic factor that remains after dividing out the real root.
What does a repeated root mean geometrically?
A repeated (double) root is a point where the curve \( y = ax^3 + bx^2 + cx + d \) touches the x-axis without crossing it, like a parabola's vertex on the axis. In the default example, \( x(x+4)^2 = 0 \), the graph crosses at \( x = 0 \) and merely touches the axis at \( x = -4 \). A triple root (all three equal) looks like an inflection point sitting exactly on the axis.
Can I enter fractions or decimals as coefficients?
The input fields accept decimals, including negative ones (e.g., 0.5 or -2.75). For fractional coefficients like \( \frac{1}{2}x^3 - 3x + 4 \), either convert to decimals (a = 0.5) or multiply the whole equation by the common denominator first — multiplying every term by the same nonzero number does not change the roots.
What are common mistakes when using a cubic equation solver?
The most frequent errors are entering terms in the wrong order (remember: a multiplies \( x^3 \), d is the plain constant), forgetting a zero coefficient (in \( x^3 - 8 = 0 \) you must enter b = 0 and c = 0), and dropping minus signs when copying from paper. Also note that \( x^3 + 5x^2 \) is not complete — missing terms are not automatically assumed to be zero unless you type 0.