What the calculator does
Enter the four coefficients of a cubic equation and the solver returns:
- all three roots, counted with multiplicity, whether real or complex;
- exact values for rational roots and for roots of quadratic factors;
- the discriminant, which classifies the roots before you solve anything;
- the factored form of the polynomial over the rational numbers;
- the working that leads to each root.
How to use it
Write your equation in the standard form ax³ + bx² + cx + d = 0, collecting every term on one side. Then enter a, b, c and d. If a term is missing, its coefficient is 0. For x³ − 8 = 0, enter a = 1, b = 0, c = 0, d = −8. Fractions such as 3/4 and decimals such as −0.25 are accepted and treated as exact values.
The formulas
The discriminant
| Value of Δ | Roots |
|---|---|
| Δ > 0 | three distinct real roots |
| Δ = 0 | a repeated root; all roots are real |
| Δ < 0 | one real root and a pair of complex conjugates |
Rational roots
If a cubic has integer coefficients, any rational root p/q in lowest terms has p dividing the constant term d and q dividing the leading coefficient a. Testing this short list of candidates finds every rational root. Each one gives a factor, and dividing it out leaves a quadratic that the quadratic formula solves.
Cardano’s method
When there is no rational root, the substitution x = t − b/(3a) removes the x² term and gives the depressed cubic
With one real root, Cardano’s formula gives it directly:
With three real roots, the square root in Cardano’s formula is of a negative number, even though every root is real. This is the casus irreducibilis. The trigonometric form avoids complex arithmetic:
Worked example
Solve 2x³ − 3x² − 11x + 6 = 0.
- Discriminant. Substituting a = 2, b = −3, c = −11, d = 6 gives Δ = 15625. It is positive, so there are three distinct real roots.
- Rational root candidates. p divides 6 and q divides 2, so the candidates are ±1, ±2, ±3, ±6, ±1/2 and ±3/2.
- Test them. Substituting x = 3 gives 54 − 27 − 33 + 6 = 0, so x = 3 is a root and (x − 3) is a factor.
- Divide. 2x³ − 3x² − 11x + 6 = (x − 3)(2x² + 3x − 2).
- Solve the quadratic. 2x² + 3x − 2 = (2x − 1)(x + 2), so x = 1/2 or x = −2.
The roots are −2, 1/2 and 3. As a check, they add up to 3/2, which equals −b/a = 3/2.
Common mistakes
- Leaving terms on both sides. Move everything to one side before reading off a, b, c and d, and keep track of signs.
- Skipping a missing term. In x³ − 7x + 6, the x² coefficient is 0, not −7.
- Treating a repeated root as two different roots. If (x − 1)² divides the cubic, x = 1 is one root of multiplicity 2.
- Assuming the roots are real. When Δ < 0, two of the roots are complex.
- Rounding too early. Rounding intermediate values in Cardano’s formula can noticeably shift the final roots. The solver keeps full precision and only rounds for display.
Practical applications
- Equations of state. The van der Waals equation is cubic in the molar volume of a gas.
- Linear algebra. The eigenvalues of a 3×3 matrix are the roots of its characteristic polynomial, which is a cubic.
- Optimisation. Setting the derivative of a quartic function to zero gives a cubic.
- Engineering. Beam deflection, open-channel flow depth and some control-system designs lead to cubic equations.
Assumptions and limitations
Coefficients must be real numbers. Exact forms are given for rational roots and for roots of quadratic factors. Other irrational roots are computed numerically to about 15 significant digits and then rounded to the decimal places you choose. When two distinct roots are extremely close together, the solver warns that their decimal values may be less accurate.