Find all three roots of ax³ + bx² + cx + d = 0 instantly
A cubic equation is a polynomial equation of degree three, written in the standard form ax³ + bx² + cx + d = 0, where a ≠ 0. Unlike quadratic equations (which can have zero, one, or two real roots), every cubic equation with real coefficients is guaranteed to have at least one real root — and exactly three roots when counted with multiplicity in the complex number system. Our Cubic Equation Solver takes your four coefficients (a, b, c, and d) and instantly computes all three roots, whether they are three distinct real numbers, one real number paired with two complex conjugates, a double root with a single root, or a single triple root. This tool uses Cardano's method combined with a trigonometric approach (Viète's substitution) to handle all cases accurately. For equations where the discriminant is negative (three distinct real roots), the trigonometric method is used because Cardano's formula produces intermediate complex cube roots even though the final answers are all real — a phenomenon known as casus irreducibilis. For equations with a positive discriminant (one real root and two complex conjugates), Cardano's formula is applied directly to produce the real and imaginary parts of each root. Beyond just the roots, this solver provides a comprehensive educational breakdown. The discriminant (Δ) tells you at a glance what type of roots to expect before you even solve: Δ < 0 means three distinct real roots, Δ = 0 means at least one repeated root, and Δ > 0 means one real and two complex conjugate roots. The depressed cubic form (t³ + pt + q = 0) shows the intermediate step where the x² term is eliminated by substituting x = t − b/(3a), which is the key step in Cardano's derivation. The factored form a(x − r₁)(x − r₂)(x − r₃) allows you to reconstruct the polynomial from its roots and verify the solution by expanding. Vieta's formulas provide an independent verification mechanism. Named after the French mathematician François Viète, these formulas state that the sum of the roots equals −b/a, the sum of products of root pairs equals c/a, and the product of all three roots equals −d/a. Checking that the computed roots satisfy these relationships confirms the solution's correctness. Cubic equations appear throughout mathematics, science, and engineering. In physics, the intersection of a plane with a cubic surface, the energy levels of a potential well, and the equation of state for ideal gases all involve cubic equations. In engineering, cubic equations arise in beam deflection calculations, fluid mechanics, and control system analysis. In economics, models of cubic cost and revenue functions lead to cubic equations when finding optimal production levels. Even in everyday life, problems involving the dimensions of a rectangular box given its volume, surface area, and edge relationships reduce to cubic equations. This solver is designed for students, engineers, scientists, and anyone who needs to quickly and accurately solve cubic equations. The step-by-step solution panel (expandable) walks through the entire derivation: normalizing coefficients, computing p and q for the depressed cubic, evaluating the discriminant, applying the appropriate solution method, and recovering the original roots from the depressed cubic substitution. Whether you are checking your work, learning the theory, or simply need a fast answer, this tool provides all the detail you need.
Understanding Cubic Equations
What Is a Cubic Equation?
A cubic equation is any polynomial equation where the highest power of the variable is three. The standard form is ax³ + bx² + cx + d = 0, where a, b, c, and d are real numbers and a cannot be zero (if a = 0, the equation degenerates into a quadratic or lower-degree polynomial). By the fundamental theorem of algebra, every cubic polynomial with real or complex coefficients has exactly three roots in the complex number system when counted with multiplicity. If the coefficients are real, then complex roots always come in conjugate pairs, which means a cubic with real coefficients always has at least one real root. The three possible root configurations are: three distinct real roots, one real root and two complex conjugate roots, or repeated roots (a double root and a single root, or a triple root).
How Are the Roots Calculated?
The standard approach is Cardano's method, published by Gerolamo Cardano in 1545. First, the equation is reduced to the depressed cubic form t³ + pt + q = 0 by substituting x = t − b/(3a), which eliminates the x² term. The depressed cubic coefficients are p = (3ac − b²) / (3a²) and q = (2b³ − 9abc + 27a²d) / (27a³). Next, the discriminant-like quantity D = (q/2)² + (p/3)³ is computed. If D > 0, Cardano's formula gives one real and two complex roots. If D ≤ 0 (three real roots), the trigonometric method (Viète's substitution) is used instead: set m = 2√(−p/3) and θ = (1/3)·arccos(3q/(p·m)), then the three roots are m·cos(θ) − b/(3a), m·cos(θ − 2π/3) − b/(3a), and m·cos(θ − 4π/3) − b/(3a). Finally, each t root is converted back to x by adding the offset −b/(3a).
Why Does the Discriminant Matter?
The discriminant Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d² is a single number that encodes the nature of all three roots without requiring you to actually compute them. A negative discriminant (Δ < 0) guarantees three distinct real roots — the cubic curve crosses the x-axis three times. A zero discriminant (Δ = 0) means at least two roots coincide — the curve is tangent to the x-axis at the repeated root. A positive discriminant (Δ > 0) means one real root and two non-real complex conjugate roots — the curve crosses the x-axis exactly once. Understanding the discriminant before solving helps you choose the right solution method, predict the structure of the answer, and verify that your computed roots are consistent with the expected root type.
Precision and Limitations
All calculations use 64-bit double-precision floating-point arithmetic, which provides approximately 15–16 significant decimal digits. Near-zero values smaller than 1×10⁻¹⁰ in absolute value are rounded to zero to eliminate floating-point noise — for example, the imaginary part of a root that should theoretically be zero but computed as 2.3×10⁻¹⁵ will be displayed as exactly 0. Similarly, real parts that differ from a nearby integer by less than 1×10⁻¹⁰ are snapped to that integer. For coefficients with very large magnitudes (e.g., a = 10¹⁵) or very small non-zero values, floating-point rounding errors may accumulate and affect the last few displayed digits. In these cases, rescaling the equation (dividing all terms by the leading coefficient, or multiplying out denominators for fractional coefficients) before entering values will improve accuracy. This solver is intended for educational and engineering calculations where double-precision results are sufficient.
Cubic Equation Formulas
General Cubic Equation
ax³ + bx² + cx + d = 0 (a ≠ 0)
The standard form of a cubic equation with four coefficients. Every cubic with real coefficients has at least one real root and exactly three roots in the complex number system.
Cubic Discriminant
Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d²
The discriminant determines the nature of the roots: Δ < 0 gives three distinct real roots, Δ = 0 gives at least one repeated root, and Δ > 0 gives one real root and two complex conjugate roots.
Depressed Cubic Substitution
x = t − b/(3a), yielding t³ + pt + q = 0
The Tschirnhaus substitution eliminates the x² term, converting the general cubic into a depressed cubic. Here p = (3ac − b²)/(3a²) and q = (2b³ − 9abc + 27a²d)/(27a³).
Cardano's Formula
t = ∛(−q/2 + √D) + ∛(−q/2 − √D), where D = (q/2)² + (p/3)³
Cardano's formula gives one root of the depressed cubic directly when D > 0. The other two roots are found using the cube roots of unity. When D ≤ 0, the trigonometric method is used instead.
Cubic Equation Reference Tables
Discriminant Interpretation for Cubic Equations
How the value of the discriminant Δ determines the number and type of roots for a cubic equation with real coefficients.
| Discriminant Value | Root Configuration | Graph Behavior | Solution Method |
|---|---|---|---|
| Δ < 0 | 3 distinct real roots | Curve crosses x-axis 3 times | Trigonometric (Viète) method |
| Δ = 0, p ≠ 0 | 1 single root + 1 double root | Curve crosses once and is tangent once | Cardano's formula (simplified) |
| Δ = 0, p = 0 | 1 triple root (x = −b/3a) | Curve has an inflection point on x-axis | Direct calculation |
| Δ > 0 | 1 real + 2 complex conjugate roots | Curve crosses x-axis exactly once | Cardano's formula |
Vieta's Formulas for Cubic Equations
Relationships between the roots r₁, r₂, r₃ and the coefficients of ax³ + bx² + cx + d = 0.
| Relationship | Formula | Description |
|---|---|---|
| Sum of roots | r₁ + r₂ + r₃ = −b/a | The sum of all three roots equals the negation of b/a |
| Sum of root pairs | r₁r₂ + r₁r₃ + r₂r₃ = c/a | The sum of all pairwise products equals c/a |
| Product of roots | r₁ · r₂ · r₃ = −d/a | The product of all three roots equals the negation of d/a |
Worked Examples
Solve x³ − 6x² + 11x − 6 = 0 by Factoring
Coefficients: a = 1, b = −6, c = 11, d = −6. Try rational roots using the Rational Root Theorem.
Possible rational roots are ±(factors of 6)/(factors of 1) = ±1, ±2, ±3, ±6
Test x = 1: 1 − 6 + 11 − 6 = 0 ✓ → x = 1 is a root
Divide by (x − 1) using synthetic division: x³ − 6x² + 11x − 6 = (x − 1)(x² − 5x + 6)
Factor the quadratic: x² − 5x + 6 = (x − 2)(x − 3)
Verify with Vieta's: 1 + 2 + 3 = 6 = −(−6)/1 ✓
The three roots are x = 1, x = 2, and x = 3. Factored form: (x − 1)(x − 2)(x − 3) = 0.
Solve x³ + 3x − 4 = 0 Using Cardano's Method
Coefficients: a = 1, b = 0, c = 3, d = −4. Since b = 0, this is already a depressed cubic with p = 3 and q = −4.
Compute D = (q/2)² + (p/3)³ = (−2)² + (1)³ = 4 + 1 = 5
Since D > 0, use Cardano's formula: S = ∛(−(−4)/2 + √5) = ∛(2 + 2.236) = ∛4.236 ≈ 1.618
T = ∛(2 − 2.236) = ∛(−0.236) ≈ −0.618
First root: t₁ = S + T ≈ 1.618 + (−0.618) = 1.0
The other two roots are complex conjugates: t₂,₃ = −0.5 ± 1.658i
One real root x = 1. Two complex roots x ≈ −0.5 ± 1.658i. Verify: 1³ + 3(1) − 4 = 0 ✓.
How to Use the Cubic Equation Solver
Enter the Four Coefficients
Type your values for a, b, c, and d in the input fields on the left. These correspond to the equation ax³ + bx² + cx + d = 0. For example, for the equation x³ − 6x² + 11x − 6 = 0, enter a = 1, b = −6, c = 11, d = −6. If a term is absent (e.g., no x² term), enter 0 for that coefficient. The equation preview updates live as you type.
Review the Equation Preview
As you type, the equation preview above the inputs shows the formatted cubic equation with your current values. This lets you confirm the equation is entered correctly before solving. You can also click one of the quick example presets to load a well-known equation and see how the solver works.
Read the Results
After entering your coefficients, the solver automatically computes all three roots and displays them on the right. Each root is shown as a decimal approximation. Complex roots are displayed in the form a + bi. The root type badge tells you whether you have three real roots, one real and two complex conjugates, or repeated roots. The discriminant value and its interpretation are shown below the roots.
Explore the Detailed Breakdown
Click 'Show Step-by-Step Solution' to see the full derivation from your coefficients to the final roots, including the depressed cubic, intermediate values, and which method (Cardano or trigonometric) was used. Click 'Show Vieta's Verification' to confirm the roots satisfy the classical sum, sum-of-products, and product relationships. Use 'Export CSV' to download all results, or 'Print' for a printer-friendly version.
Frequently Asked Questions
Does a cubic equation always have at least one real root?
Yes — every cubic polynomial with real coefficients has at least one real root. This follows from the intermediate value theorem: since a cubic function f(x) = ax³ + bx² + cx + d approaches +∞ as x → +∞ and −∞ as x → −∞ (or vice versa when a < 0), the continuous function must cross the x-axis at least once. By the fundamental theorem of algebra, a cubic has exactly three roots (counted with multiplicity) in the complex numbers. Since complex roots of real polynomials come in conjugate pairs, and three minus two equals one, there is always at least one real root.
What does the discriminant tell me about the roots?
The discriminant Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d² is a single number that classifies the nature of all three roots without solving the equation. If Δ < 0, the equation has three distinct real roots (the curve crosses the x-axis three times). If Δ = 0, at least two roots are equal — either one double root and one single root, or one triple root. If Δ > 0, there is one real root and two non-real complex conjugate roots (the curve crosses the x-axis exactly once). The discriminant is essentially a polynomial in the coefficients, computed from the resultant of the cubic and its derivative.
What is Cardano's formula and when is it used?
Cardano's formula is the analytic solution for the depressed cubic t³ + pt + q = 0, published by Gerolamo Cardano in Ars Magna (1545). After reducing ax³ + bx² + cx + d = 0 to depressed form via the substitution x = t − b/(3a), compute D = (q/2)² + (p/3)³. When D > 0, Cardano's formula gives: S = ∛(−q/2 + √D), T = ∛(−q/2 − √D). Then t₁ = S + T, t₂ = −(S+T)/2 + i(S−T)√3/2, t₃ = −(S+T)/2 − i(S−T)√3/2. When D ≤ 0 (three real roots), using Cardano's formula directly requires taking cube roots of complex numbers; the trigonometric (Viète) method avoids this and is used instead.
Why is the trigonometric method needed for three real roots?
When the discriminant is negative (three distinct real roots), Cardano's formula leads to intermediate cube roots of complex numbers even though the final answers are all real. This is the 'casus irreducibilis' (irreducible case) — the cubic cannot be solved using only real arithmetic in Cardano's framework. The trigonometric method bypasses this by writing the depressed cubic in terms of cosines: let m = 2√(−p/3) and θ = (1/3)arccos(3q/(pm)). The three roots are then x₁ = m·cos(θ) − b/(3a), x₂ = m·cos(θ − 2π/3) − b/(3a), x₃ = m·cos(θ − 4π/3) − b/(3a). This method works entirely with real arithmetic and is numerically stable.
What are Vieta's formulas and how do they verify the roots?
Vieta's formulas express relationships between the roots r₁, r₂, r₃ and the coefficients of the polynomial directly. For ax³ + bx² + cx + d = 0: the sum r₁ + r₂ + r₃ = −b/a; the sum of root pairs r₁r₂ + r₁r₃ + r₂r₃ = c/a; the product r₁r₂r₃ = −d/a. These relationships must hold for any set of roots of the cubic. After computing roots, the solver checks all three Vieta conditions. If the computed values match the expected coefficient ratios (within floating-point tolerance), it confirms the roots are correct. Vieta's formulas are named after French mathematician François Viète (1540–1603).
Can this solver handle equations with fractional or negative coefficients?
Yes — the solver accepts any real-number coefficients, including negative values, decimals, and fractions (entered as decimals). For example, to solve 0.5x³ − 1.5x² + 1.5x − 0.5 = 0, enter a = 0.5, b = −1.5, c = 1.5, d = −0.5. The only restriction is that a must not be zero. If you have fractional coefficients like 3/4, convert them to their decimal equivalent (0.75) before entering. For very large or very small coefficient values, you may see minor floating-point rounding in the last displayed digit — this is normal for 64-bit arithmetic and does not affect the practical accuracy of the result.
Related Tools
Equation Solver
Solve linear and quadratic equations with step-by-step solutions and graphing.
Linear Equation Solver
Solve linear equations in slope-intercept, standard, and point-slope forms with graphs.
Algebra Calculator
Solve, simplify, factor, and expand algebraic expressions with step-by-step working.
Derivative Calculator
Compute derivatives of polynomial and transcendental functions step by step.
Matrix Calculator
Perform matrix operations including determinants, inverses, and eigenvalues.