# How can I find all values of $m$ such that my cubic equation has three different positive solutions?

I want to find all the values of $m$ such that the equation $$-m^3 + 2 m^2 x + (-2 m - 1) x^2 + m + x^3=0$$ has three different positive solutions. I tried

Clear[f];
f[x_] := -m^3 + 2 m^2 x + (-2 m - 1) x^2 + m + x^3;
sol = Solve[D[f[x], x] == 0, x];
d = Discriminant[D[f[x], x], x];
x1 = x /. sol[];
x2 = x /. sol[];
Reduce[{d > 0, x1 > 0, f[x1] f[x2] < 0, f < 0}, m]


and

Clear[f];
f[x_] := -m^3 + 2 m^2 x + (-2 m - 1) x^2 + m + x^3;
sol = Solve[f[x] == 0, x];
x1 = x /. sol[];
x2 = x /. sol[];
x3 = x /. sol[];
Reduce[{x1 > 0, x2 > 0, x3 > 0, x1 != x2, x1 != x3, x2 != x3}, m]


How can I solve this problem with Mathematica?

• Why are you taking the derivative of f[x]? Jul 18, 2013 at 13:44

I did it finding the expressions for the three roots using Solve, and then using the obvious relations (Greater and Unequal) to get Reduce to satisfy the conditions on them:

With[{roots =
x /. Solve[-m^3 + 2*m^2*x + (-2*m - 1)*x^2 + m + x^3 == 0, x]},
Reduce[Join[# > 0 & /@ roots, #1 != #2 & @@@ Subsets[roots, {2}]]]]


Output is 1 < m < 4/3, which appears to be correct.

EDIT in response to comment: The most straightforward way I could think of to find the condition where you have one negative root and two positive roots is to construct a Boolean expression for Reduce that expresses that condition. We still have the condition that the roots are distinct, but we need to consider a disjunction of three different sets of inequalities, one for each root that could be negative while the others remain positive.

This can be done as follows:

With[{roots =
x /. Solve[-m^3 + 2*m^2*x + (-2*m - 1)*x^2 + m + x^3 == 0, x]},
With[{
distinct = Unequal @@ Subsets[roots, 2],
inequalities =
Or @@ (And[#1 < 0, 0 < #2, 0 < #3] & @@@
NestList[RotateLeft, roots, 2])},
Reduce[inequalities && distinct, m]]]


I used With here just to name the pieces to try to make it a little clearer what's going on because all the different use of Apply get a little confusing.

Output is 0 < m < 1, which is again as it should be.

• If I want to the given equation has two negative solutions and one positive solution, how to solve? Jul 20, 2013 at 4:14

The Neat Solution ;-)

This kind of problem can be expressed compactly and solved neatly with the help of existential quantifiers and Resolve:

poly = -m^3 + 2 m^2 x + (-2 m - 1) x^2 + m + x^3;
Resolve @ ForAll[x, poly == 0 \[And] Im[m] == 0, Re[x] > 0 \[And] Im[x] == 0]

(* 1 < m < 4/3 *)


which returns conditions on m that satisfy: For all x, which are roots of our polynomial with the assumption of purely real m, x is an element of the positive real number line.

Previous (more verbose) solution

We can get a constraint on m from the condition that all three roots should be distinct and real

distinctrealcond = Reduce[Discriminant[poly, x] > 0, m, Reals]
(* 0 < m < 4/3 *)


and another one from the requirement, that all roots should be positive (their real part that is), which can be expressed neatly with the help of existential quantifiers

positiverootscond = Resolve@ForAll[x, poly == 0 \[And] Im[m] == 0, Re[x] > 0]
(* m > 1 *)


Combining the constraints results in

Reduce[distinctrealcond \[And] positiverootscond]
(* 1 < m < 4/3 *)


Assuming $m$ is real. Given $x^3 + a_1 x^2 + a_2 x + a_3 = 0$, the discriminant is $D = Q^3 + R^2$, where $Q = (3 a_2 - a_1^2)/9$ and $R = (9 a_1 a_2 - 27 a_3 - 2 a_1^3)/54$. In your case, $D = m (3 m - 4) (m^2 + 1)^2 / 108$. The discriminant $D<0$ when there are three unequal real roots. Thus,

Reduce[m (3 m - 4) (m^2 + 1)^2 / 108 < 0, m]


gives $0<m<4/3$. The additional condition that the three distinct real roots are all positive implies $-a_3 = x_1 x_2 x_3 > 0$, where $x_i$ are the three roots. (The converse is not necessarily true. $-a_3>0$ does not imply three positive roots.) Incorporating the condition into Reduce

Reduce[{m (3 m - 4) (m^2 + 1)^2 / 108 < 0, -m + m^3 > 0}, m]


gives the solution $1<m<4/3$.

Alternatively, the equation may be factored into $x -(m+1)$ and a quadratic. The roots of the quadratic are $(m \pm \sqrt{4m-3m^2})/2$. Using the discriminant condition and positivity on the smaller quadratic root via

Reduce[{m (3 m - 4) (m^2 + 1)^2 / 108 < 0, (m - Sqrt[4m - 3m^2])/2 > 0}, m]


gives $1<m<4/3$.

Reduce lets you solve inequalities, which is what you get when you add your requirement on x:

 Reduce[{f[x] == 0, x > 0}, x, Reals]


This finds the zeros of f, subject to the constraint that x>0, in the domain of real numbers (remove the last part if you don't want that restriction).

• I don't think this satisfies the condition that the roots be distinct, though, and doesn't produce a simple condition on m, which I believe exists. Jul 18, 2013 at 13:57