Find all three roots of ax³+bx²+cx+d=0 using the depressed-cubic method, including complex roots.
This solver uses the depressed-cubic (Cardano/trigonometric) method. The equation ax³+bx²+cx+d=0 is first reduced to t³+pt+q=0 by substituting x = t − b/(3a). Then the discriminant Δ = −4p³ − 27q² determines the root structure: Δ > 0 gives three distinct real roots (trigonometric solution), Δ = 0 gives a repeated root, and Δ < 0 gives one real and two complex conjugate roots (Cardano's formula).
Depressed cubic substitution
x = t − b/(3a)
Reduced coefficients
p = (3ac − b²)/(3a²), q = (2b³ − 9abc + 27a²d)/(27a³)
It removes the x² term via a linear substitution x = t − b/(3a), reducing the equation to t³ + pt + q = 0, which can be solved by Cardano's formula or the trigonometric method.
When the inner discriminant q²/4 + p³/27 > 0, there is one real root and a pair of complex conjugate roots.