2
$\begingroup$

According to this question, the solutions to the equation $x^3 + p x^2 + q x + r = 0$ ($p, q, r \in \mathbb R$) are positive iff $p < 0$, $q > 0$, $r < 0$, and $-27 r^2 - 2 p {\left(2 p^2-9 q\right)} r + q^2 {\left(p^2-4 q\right)} \geqslant 0$.
Mathematica is able to reduce the corresponding inequalities as follows:

{x1,x2,x3}=SolveValues[x^3+p*x^2+q*x+r==0,x,Cubics->False];

con1=ApplySides[FullSimplify,Reduce[{x1,x2,x3}\[VectorGreater]0,Reals]]

The output is not very inspiring, yet we can see that it is equivalent to the above conditions:

con0=And[p<0,q>0,r<0,Discriminant[x^3+p*x^2+q*x+r,x]≥0];

Resolve[ForAll[{p,q,r},con1\[Equivalent]con0],Reals]

          True

However, I do not understand why the following code does not work:

con2=Reduce[ForAll[x,x^3+p*x^2+q*x+r==0,x>0],Reals];

Resolve[ForAll[{p,q,r},con2\[Equivalent]con0],Reals]

          False

The documentation claims that “ForAll[x, cond, expr] states that expr is true ∀ x satisfying the condition cond”, so ForAll[x, x^3 + p x^2 + q x + r + x^3 == 0, x > 0] should mean that all roots of x^3 + p*x^2 + q*x + r must be positive. But why is con2 not equivalent to con0?

$\endgroup$
3
  • $\begingroup$ I think con2 is condition for at least one positive root while con0 for all three roots positive. $\endgroup$ Commented Sep 15 at 11:30
  • 1
    $\begingroup$ @azerbajdzan Shouldn't the statement "at least one positive root" be equivalent to Exists[x,x^3+p*x^2+q*x+r==0,x>0]? Note that Exists[x, cond, expr] states that there exists an x satisfying the condition cond for which expr is True. Therefore, Exists[x,x^3+p*x^2+q*x+r==0,x>0] means that there exists an x satisfying x^3+p*x^2+q*x+r==0 where x > 0 (in other words, one or more roots of x^3 + p*x^2 + q*x + r is positive). $\endgroup$
    – user688486
    Commented Sep 15 at 12:47
  • $\begingroup$ Correction. con2 is condition that for all real x the root is positive. While co0 is condition that for all x the root is positive. $\endgroup$ Commented Sep 15 at 13:31

2 Answers 2

3
$\begingroup$

The following works in 14.1 on Windows.

Resolve[Exists[{x1, x2, x3}, x1 > 0 && x2 > 0 && x3 > 0, 
ForAll[x, x^3 + p*x^2 + q*x + r == (x - x1)*(x - x2)*(x - x3)]],  Reals] // FullSimplify

p < 0 && ((p^2 == 3 q && 2 p^3 + 2 Sqrt[(p^2 - 3 q)^3] + 27 r == 9 p q) || (2 p^3 + 2 Sqrt[(p^2 - 3 q)^3] + 27 r >= 9 p q && ((p^2 > 3 q && 2 (p^2 - 3 q)^(3/2) + 9 p q >= 2 p^3 + 27 r && p^2 < 4 q) || (q > 0 && p^2 >= 4 q && r < 0))))

If you want to have at least two disjoint roots, then

Resolve[Exists[{x1, x2, x3}, x1 > 0 && x2 > 0 && x3 > 0 && x1 != x2, 
ForAll[x, x^3 + p*x^2 + q*x + r == (x - x1)*(x - x2)*(x - x3)]], 
Reals] // FullSimplify

p < 0 && 2 p^3 + 2 Sqrt[(p^2 - 3 q)^3] + 27 r >= 9 p q && ((p^2 > 3 q && 2 (p^2 - 3 q)^(3/2) + 9 p q >= 2 p^3 + 27 r && p^2 < 4 q) || (q > 0 && p^2 >= 4 q && r < 0))

does the job.

$\endgroup$
1
  • $\begingroup$ Many thanks. This is a neat and useful trick (although sometimes an unsolved form might be more desirable). $\endgroup$
    – user688486
    Commented Sep 15 at 15:09
3
$\begingroup$

This answers OP's question: "But why is con2 not equivalent to con0?"

con2 is solved over Reals. So it takes into account only real roots. Bellow is an example where all real roots are positive although there are some complex.

con2 = Resolve[Exists[x, x^3 + p*x^2 + q*x + r == 0, x > 0], Reals];
con2 /. {p -> 0, q -> -1, r -> -1}
NSolve[x^3 + p*x^2 + q*x + r == 0 /. {p -> 0, q -> -1, r -> -1}]

True

{{x -> -0.662359 - 0.56228 I}, {x -> -0.662359 + 0.56228 I}, {x -> 1.32472}}
$\endgroup$
3
  • $\begingroup$ Thanks! Now I see why con2 is not equivalent to con0. $\endgroup$
    – user688486
    Commented Sep 15 at 15:01
  • $\begingroup$ @user688486 I thought this was the main question. But then I realized that in the title was another question. $\endgroup$ Commented Sep 15 at 15:03
  • $\begingroup$ Oops. I remember that writing two interrogative sentences in one question appeared to be frowned upon … so I ended up moving the main one into the title. $\endgroup$
    – user688486
    Commented Sep 15 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.