Unitary Cubic Equation Solver: Step-by-Step
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This calculator solves a cubic equation of the form ax³ + bx² + cx + d = 0 for real and complex roots. You enter the four coefficients (a, b, c, d), and it returns all three roots using the standard algebraic method (Cardano’s formula). The first output shows the real root if one exists, followed by the other roots.
Formula
The general cubic equation is:
ax³ + bx² + cx + d = 0
where a, b, c, d are real numbers and a ≠0. The roots are found using the depressed cubic transformation. First, substitute x = t – b/(3a) to eliminate the squared term, giving:
t³ + pt + q = 0
with
- p = (3ac – b²) / (3a²)
- q = (2b³ – 9abc + 27a²d) / (27a³)
Then the three roots are:
- tâ‚� = ∛(-q/2 + √Δ) + ∛(-q/2 – √Δ)
- tâ‚‚ = ω∛(-q/2 + √Δ) + ω²∛(-q/2 – √Δ)
- t₃ = ω²∛(-q/2 + √Δ) + ω∛(-q/2 – √Δ)
where Δ = (q/2)² + (p/3)³ and ω = (-1 + i√3)/2 (the complex cube root of unity). Finally, add back the shift: x = t – b/(3a). The calculator uses these formulas directly, handling complex numbers when Δ is negative.
Worked Example
Using the default values a=1, b=-6, c=11, d=-6, we solve x³ – 6x² + 11x – 6 = 0.
- Compute p = (3*1*11 – (-6)²) / (3*1²) = (33 – 36) / 3 = -1.
- Compute q = (2*(-6)³ – 9*1*(-6)*11 + 27*1²*(-6)) / (27*1³) = (-432 + 594 – 162) / 27 = 0 / 27 = 0.
- Compute Δ = (0/2)² + (-1/3)³ = 0 – 1/27 = -1/27.
- Since Δ < 0, the roots are all real. Using the trigonometric form (or the complex formula), the roots are x = 1, x = 2, and x = 3.
The calculator outputs: r1 = 1, r2 = 2, r3 = 3 (rounded to 4 decimals). You can verify: (1-1)(1-2)(1-3)=0, etc.
When to Use a Cubic Solver
You need a cubic solver when you encounter an equation with a highest exponent of 3. Real-world applications include:
- Physics: calculating projectile motion with air resistance, or the period of an anharmonic oscillator.
- Engineering: beam deflection under certain loads, or fluid flow in a pipe with friction.
- Economics: cubic cost or demand functions.
- Chemistry: van der Waals equation of state for real gases.
- Mathematics: finding eigenvalues of a 3×3 matrix (characteristic polynomial).
If your equation has a highest exponent of 2, use a quadratic solver instead. For exponent 4, use a quartic solver (though the formulas are much more complex).
How to Choose the Right Solver
Before entering coefficients, check that your equation is in standard form. If it isn’t, rearrange it. For example, x³ = 2x + 5 becomes x³ – 2x – 5 = 0, so a=1, b=0, c=-2, d=-5.
If the coefficient a is zero, you don’t have a cubic equation—it’s quadratic or lower. The calculator will return an error because division by zero occurs. In that case, use the appropriate lower-degree solver.
If you only need real roots, the calculator still gives you all three, but you can ignore the complex ones. If you need complex roots (for example, in electrical engineering), they are provided as well.
Common Mistakes and Misconceptions
One frequent error is mixing up signs when entering coefficients. For instance, the equation x³ – 4x² + 6x – 4 = 0 requires b = -4, not 4. Double-check the sign of each term.
Another mistake is forgetting that a cannot be zero. If a=0, the equation is not cubic.
Many people believe that a cubic equation always has one real root and two complex roots. In fact, it can have three real roots (like the example above) or one real and two complex, depending on the discriminant. The discriminant for the depressed cubic is Δ = (q/2)² + (p/3)³. If Δ > 0, one real and two complex; if Δ = 0, multiple real roots; if Δ < 0, three distinct real roots.
Rounding errors can occur if you round intermediate steps. The calculator uses full precision internally, so it’s more accurate than doing it by hand with a few decimals.
Limitations of the Formula
Cardano’s formula works for all cubic equations with real coefficients, but it has some practical limitations:
- When Δ < 0, the formula involves cube roots of complex numbers, which many calculators cannot handle directly. The calculator here does handle them, but the result may show tiny imaginary parts due to floating-point arithmetic (e.g., 1e-15i). You can safely ignore these.
- For very large or very small coefficients, numerical instability can occur. In such cases, it’s better to normalize the equation by dividing all coefficients by a.
- The formula does not work if a=0, as noted.
- If you need roots to high precision (say 20 digits), this calculator may not be sufficient; use a computer algebra system.
For most practical purposes, the results are accurate to 4 decimal places, which is enough for engineering and physics problems.
Alternatives to the Algebraic Formula
Besides Cardano’s formula, there are other methods to solve cubic equations:
- Numerical methods: Newton-Raphson iteration, bisection, or secant method. These are useful when you only need one real root and the coefficients are messy.
- Trigonometric method: For the case Δ < 0 (three real roots), the trigonometric solution is more stable and avoids complex numbers. It uses cos and arccos.
- Factoring: If the cubic has rational roots, you can use the Rational Root Theorem to find one root, then factor into a quadratic. This is often taught in algebra classes.
- Graphing: Plot the function and find x-intercepts. This gives approximate roots but is quick for a sanity check.
This calculator uses the algebraic formula, which is exact (subject to rounding) and works for all cases.
Frequently Asked Questions
What is a cubic equation?
A cubic equation is a polynomial equation of degree three, meaning the highest power of the variable is 3. The standard form is ax³ + bx² + cx + d = 0, where a is not zero. It always has exactly three roots (counting multiplicity), but some may be complex numbers.
How do I know if my equation is cubic?
Look for the highest exponent of the variable. If it is 3, the equation is cubic. For example, 2x³ + x – 5 = 0 is cubic, but x³ + x² = 0 is also cubic (it can be written as x³ + x² + 0x + 0 = 0). If the highest exponent is higher, it’s a higher-degree polynomial.
What does the discriminant tell me?
For a cubic, the discriminant (related to Δ) tells you the nature of the roots. If Δ > 0, there is one real root and two complex conjugate roots. If Δ = 0, there are multiple real roots (possibly a double root). If Δ < 0, there are three distinct real roots. This is similar to how the discriminant of a quadratic tells you about real vs. complex roots.
Can I use this calculator for equations with complex coefficients?
No, this calculator expects real coefficients. If you have complex coefficients, you need a more advanced solver that handles complex arithmetic. Most real-world problems use real coefficients, so this is rarely an issue.
Why does the calculator show a tiny imaginary part for real roots?
Due to floating-point arithmetic, when the discriminant is negative, the intermediate calculations involve complex numbers, and rounding can leave a tiny imaginary residue (like 1e-15). This is normal and can be ignored; the real part is the correct root.
What if my equation has a missing term?
If a term is missing, simply enter 0 for that coefficient. For example, x³ – 8 = 0 has b=0, c=0, d=-8. The calculator will handle it correctly.
Related
Formula used
in a | Coefficient a | - | 1 | 0 in b | Coefficient b | - | -6 | 0 in c | Coefficient c | - | 11 | 0 in d | Coefficient d | - | -6 | 0 out r1 | First root | - | -b/(3*a) - cbrt((2*b^3 - 9*a*b*c + 27*a^2*d + sqrt((2*b^3 - 9*a*b*c + 27*a^2*d)^2 - 4*(b^2 - 3*a*c)^3))/(54*a^3)) - cbrt((2*b^3 - 9*a*b*c + 27*a^2*d - sqrt((2*b^3 - 9*a*b*c + 27*a^2*d)^2 - 4*(b^2 - 3*a*c)^3))/(54*a^3)) | 4 out r2 | Second root | - | -b/(3*a) + (1 + sqrt(-3)*1i)/2 * cbrt((2*b^3 - 9*a*b*c + 27*a^2*d + sqrt((2*b^3 - 9*a*b*c + 27*a^2*d)^2 - 4*(b^2 - 3*a*c)^3))/(54*a^3)) + (1 - sqrt(-3)*1i)/2 * cbrt((2*b^3 - 9*a*b*c + 27*a^2*d - sqrt((2*b^3 - 9*a*b*c + 27*a^2*d)^2 - 4*(b^2 - 3*a*c)^3))/(54*a^3)) | 4 out r3 | Third root | - | -b/(3*a) + (1 - sqrt(-3)*1i)/2 * cbrt((2*b^3 - 9*a*b*c + 27*a^2*d + sqrt((2*b^3 - 9*a*b*c + 27*a^2*d)^2 - 4*(b^2 - 3*a*c)^3))/(54*a^3)) + (1 + sqrt(-3)*1i)/2 * cbrt((2*b^3 - 9*a*b*c + 27*a^2*d - sqrt((2*b^3 - 9*a*b*c + 27*a^2*d)^2 - 4*(b^2 - 3*a*c)^3))/(54*a^3)) | 4
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.