# Cubic equation solution

Writing:

eqn = x^3 + c2 x^2 + c1 x + c0 == 0;
ass = {c2 -> 3, c1 -> 3, c0 -> 3};
sol = Assuming[c1 == c2^2/3, Simplify[Solve[eqn, x]]] /. ass;
eqn /. ass /. sol // FullSimplify


I get:

{False, False, False}

and I can't understand why! Ideas? Thank you!

• For a start, in the first case your assumptions in Assuming have no effect, because the result of Solve does not contain c1 or c2, since you have replaced them with explicit numerical values by doing eqn /. ass. – MarcoB Mar 22 '19 at 18:48
• @MarcoB: Thanks, in fact I hadn't thought about it well. But in the second case I don't understand why the correct solution is not obtained. Thanks again! – TeM Mar 22 '19 at 19:43
• The Cardano-Tartaglia form of solution is not valid for that set of substitution values (it makes numerator and denominator vanish). – Daniel Lichtblau Mar 22 '19 at 20:44
• I don't understand what formulation MMA refers to, I know this one that has no denominators: it.wikipedia.org/wiki/… – TeM Mar 22 '19 at 21:54

The way you have it you are substituting your values too late. It works if the substitution occurs before it tries to solve.

eqn = x^3 + c2 x^2 + c1 x + c0 == 0;

ass = {c2 -> 3, c1 -> 3, c0 -> 3};

sol = Solve[eqn /. ass, x]
(*{{x -> -1 - 2^(1/3)}, {x -> -1 + (1 - I Sqrt[3])/2^(
2/3)}, {x -> -1 + (1 + I Sqrt[3])/2^(2/3)}}*)

sol = Solve[eqn, x]


Gives you a solution, but when you substitute your values you get indeterminates. Taking limits may help, but the problem is avoided by making the substitution first.

I think it's much more robust to use Root objects instead of radicals. If you do that with your example, there is no issue:

eqn = x^3+c2 x^2+c1 x+c0==0;
ass = {c2->3,c1->3,c0->3};
sol = Assuming[c1==c2^2/3,
Simplify[Solve[eqn, x, Cubics->False]]
] /. ass;
eqn /.ass/. sol //FullSimplify


{True, True, True}