Cubic Equation Solver
Find all roots (real and complex) of cubic equations.
Quick Examples
What is a Cubic Equation?
A cubic equation is a polynomial equation of degree three, written in the standard form ax³ + bx² + cx + d = 0, where a ≠ 0. The highest power of the variable is 3, which is why it is called "cubic" (from the Latin cubus, meaning cube). By the Fundamental Theorem of Algebra, every cubic equation has exactly three roots — real or complex — counting multiplicity.
How to Solve a Cubic Equation
The approach depends on whether the constant term d is zero or not. Both cases ultimately aim to factor or reduce the equation to simpler forms.
Methods to Solve Cubic Equations That Do Not Have a Constant (d = 0)
When d = 0, the equation becomes ax³ + bx² + cx = 0. Factor out x:
This immediately gives x = 0 as one root. The remaining two roots come from solving the quadratic ax² + bx + c = 0 using the quadratic formula. This is the simplest case and requires no advanced techniques.
Methods to Solve Cubic Equations That Have a Constant (d ≠ 0)
When a constant term is present, the following methods apply:
- Rational Root Theorem: Test candidate roots of the form ±(factor of d) / (factor of a). If a rational root is found, divide it out and solve the remaining quadratic.
- Cardano's Formula: A general algebraic formula valid for all cubics. Substitute x = t − b/(3a) to eliminate the x² term, then apply the depressed cubic formula.
- Trigonometric Method: When the discriminant is positive (three real roots), express the roots using cosine to avoid complex intermediate values.
- Numerical Methods: Newton-Raphson iteration locates roots to any desired precision when exact forms are impractical.
What is the Cubic Equation Formula?
Cardano's formula solves the depressed cubic t³ + pt + q = 0 (obtained after eliminating the x² term):
Where p = (3ac − b²) / (3a²) and q = (2b³ − 9abc + 27a²d) / (27a³). Back-substitute x = t − b/(3a) to recover the roots of the original equation.
Discriminant of a Cubic Equation
The discriminant Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d² reveals the nature of the roots without solving the equation:
| Discriminant | Nature of Roots |
|---|---|
| Δ > 0 | Three distinct real roots |
| Δ = 0 | Repeated root; at least two roots are equal (all real) |
| Δ < 0 | One real root and two complex conjugate roots |
How to Solve a Cubic Equation Step by Step
- Write in standard form: Arrange as ax³ + bx² + cx + d = 0 and identify a, b, c, d.
- Check for d = 0: If d = 0, factor out x and solve the resulting quadratic.
- Try the Rational Root Theorem: Test ±(factors of d)/(factors of a). Substitute each candidate into the equation.
- Divide out known roots: Use synthetic division or polynomial long division to reduce the cubic to a quadratic.
- Solve the quadratic: Apply the quadratic formula to find the remaining two roots.
- Apply Cardano's formula if no rational root exists: Compute p and q, evaluate the formula, then back-substitute.
What are the Roots of a Cubic Equation?
The three roots of ax³ + bx² + cx + d = 0 satisfy Vieta's formulas:
- x₁ + x₂ + x₃ = −b/a
- x₁x₂ + x₁x₃ + x₂x₃ = c/a
- x₁ · x₂ · x₃ = −d/a
These relationships are useful for checking solutions and constructing equations when roots are known. A cubic always has at least one real root because its graph must cross the x-axis (it extends to +∞ and −∞).
Cubic Equation — Examples
Example 1 (d = 0): Solve 2x³ − 8x² + 6x = 0
Factor: 2x(x² − 4x + 3) = 0 → 2x(x − 1)(x − 3) = 0
Roots: x = 0, x = 1, x = 3
Example 2 (rational root): Solve x³ − 6x² + 11x − 6 = 0
Test x = 1: 1 − 6 + 11 − 6 = 0 ✓. Divide: (x − 1)(x² − 5x + 6) = (x − 1)(x − 2)(x − 3)
Roots: x = 1, x = 2, x = 3
Example 3 (one real root): Solve x³ + x + 2 = 0
Test x = −1: −1 − 1 + 2 = 0 ✓. Divide: (x + 1)(x² − x + 2) = 0
Quadratic discriminant = 1 − 8 = −7 < 0
Roots: x = −1 and two complex roots x = (1 ± i√7)/2
Special Cubic Forms Worth Recognizing
Before reaching for Cardano's formula, check whether your cubic matches one of these special forms — they factor in one step:
| Form | Factorization | Roots |
|---|---|---|
| x3 = a | — | x = ³√a (one real root; two complex) |
| (x + a)3 = 0 (perfect cube) | (x + a)(x + a)(x + a) = 0 | x = −a (triple root) |
| x3 − a3 = 0 (difference of cubes) | (x − a)(x2 + ax + a2) = 0 | x = a, plus two complex roots |
| x3 + a3 = 0 (sum of cubes) | (x + a)(x2 − ax + a2) = 0 | x = −a, plus two complex roots |
| ax3 + bx2 + cx = 0 (no constant) | x(ax2 + bx + c) = 0 | x = 0 and the two quadratic roots |
Worked example: Solve x3 − 8 = 0. This is a difference of cubes with a = 2: (x − 2)(x2 + 2x + 4) = 0. The linear factor gives x = 2. The quadratic has discriminant 4 − 16 = −12, giving x = −1 ± i√3. Recognizing the form saved all the Cardano arithmetic.
The Depressed Cubic and the Trigonometric Method
Every cubic ax3 + bx2 + cx + d = 0 becomes a depressed cubic t3 + pt + q = 0 (no t2 term) with the substitution x = t − b/(3a), where:
When the discriminant is positive (three real roots), Cardano's formula forces square roots of negative numbers — the casus irreducibilis. The trigonometric method avoids this entirely:
Worked example: Solve x3 − 3x + 1 = 0 (already depressed, p = −3, q = 1). Then 2√(−p/3) = 2 and (3q/2p)√(−3/p) = −1/2, so arccos(−1/2) = 120°. The three roots are 2cos(40°) ≈ 1.532089, 2cos(40° − 120°) ≈ 0.347296, and 2cos(40° − 240°) ≈ −1.879385 — all real, no complex intermediates.
A Short History of the Cubic Formula
The cubic formula is one of algebra's great stories. Scipione del Ferro solved the depressed cubic around 1515 but kept it secret. Niccolò Tartaglia independently found the method and shared it with Gerolamo Cardano under an oath of secrecy — which Cardano broke, publishing the formula in his 1545 book Ars Magna. The solution is still called Cardano's formula today. The work also forced mathematicians to take square roots of negative numbers seriously, planting the seeds of complex numbers.
Reading a Cubic from Its Graph
The graph of y = ax3 + bx2 + cx + d is an S-shaped curve (or an inverted S when a < 0):
- End behavior: When a > 0, the curve falls from the lower left and rises to the upper right; when a < 0, the reverse. This is why a cubic always crosses the x-axis at least once — it must travel from −∞ to +∞.
- x-intercepts are the real roots: a crossing is a single root, a touch-and-turn is a double root, a flat pass through the axis is a triple root.
- Turning points (local maximum and minimum) sit where the derivative 3ax2 + 2bx + c = 0. There are two when b2 − 3ac > 0, one flat point when it equals 0, and none when it is negative.
- Inflection point: The curve's center of symmetry, where concavity changes, is at x = −b/(3a) — always exactly halfway between the two turning points.
- y-intercept is simply d, the constant term.
Real-World Applications of Cubic Equations
| Field | Where Cubics Appear |
|---|---|
| Physics | Projectile motion with air resistance; the range equation becomes cubic |
| Engineering | Beam deflection and structural analysis under distributed loads |
| Economics | Cubic cost and revenue models for finding optimal production levels |
| Chemistry | Reaction kinetics and equilibrium concentration calculations |
| Computer graphics | Bézier curves and spline interpolation are built from cubic polynomials |
| Volume problems | Designing boxes and containers: volume as a function of one dimension is often cubic |
Common Mistakes to Avoid
- Stopping after one root: A cubic has three roots. Always divide out each root you find and solve the remaining quadratic.
- Skipping the rational root test: Jumping straight to Cardano's formula hides simple integer roots inside nested radicals.
- Forgetting negative and fractional candidates: When the leading coefficient is not 1, candidates are ±p/q, not just factors of d.
- Assuming "no real roots": Every cubic has at least one real root. A negative discriminant means two complex roots — not zero roots.
- Entering a = 0: That makes the equation quadratic, not cubic; the cubic formula divides by a and fails.