2
$\begingroup$

I use command Reduce to solve an inequality. First, I used

Reduce[Sqrt[4 x + 5] - Sqrt[-6 x + 10] <= Sqrt[2 x - 1], x]

and got

x < -(5/4) || 1/2 <= x <= 1

I put

f[x_] := Sqrt[4 x + 5] - Sqrt[-6 x + 10] - Sqrt[2 x - 1]

and found $f[-2]$,

I Sqrt[3] - I Sqrt[5] - Sqrt[22]

That is meant I Sqrt[3] - I Sqrt[5] - Sqrt[22]<= 0. I think, this is wrong.

Second, I used

Reduce[Sqrt[4 x + 5] - Sqrt[-6 x + 10] <= Sqrt[2 x - 1], x, Reals]

I got

1/2 <= x <= 1

Is this a bug with Reduce[Sqrt[4 x + 5] - Sqrt[-6 x + 10] <= Sqrt[2 x - 1], x]?

$\endgroup$
2
$\begingroup$

I wanted to leave a comment responding to Szabolcs's tricky example Reduce[x + Sqrt[-x] < x^2 + Sqrt[-x], x], but it's too long so I will leave an answer.

Even adding restrictions to the reals will leave the inequality x > 1:

Reduce[x + Sqrt[-x] < x^2 + Sqrt[-x] && x ∈ Reals, x, Reals]
x < 0 || x > 1

If you want to be as careful and meticulous as possible, you can restrict your inequality to the domain of the lhs and rhs.

CarefulRealReduce[head_[f_, g_], x_] := Reduce[head[f, g] && 
  FunctionDomain[f, x, Method -> {Reduce -> False}] && 
  FunctionDomain[g, x, Method -> {Reduce -> False}], x]

CarefulRealReduce[x + Sqrt[-x] < x^2 + Sqrt[-x], x]
x < 0
CarefulRealReduce[Sqrt[4 x + 5] - Sqrt[-6 x + 10] <= Sqrt[2 x - 1], x]
1/2 <= x <= 1
$\endgroup$
  • 1
    $\begingroup$ And this works for the OP's example too. Using the domain Reals feels uncomfortable because of things like the casus irreducibilis. $\endgroup$ – Szabolcs Apr 1 '15 at 22:36
  • $\begingroup$ @Szabolcs That is a very good point. Determining what is real is not just as simple as looking for the imaginary unit in the expression. Another subtle thing is symbolic expressions like ArcSin[2] are not real, yet the imaginary unit does not appear. $\endgroup$ – Chip Hurst Apr 2 '15 at 17:17
0
$\begingroup$

If you specify the domain Reals, the problem goes away:

Reduce[Sqrt[4 x + 5] - Sqrt[-6 x + 10] <= Sqrt[2 x - 1], x, Reals]
(* 1/2 <= x <= 1 *)

The problem region, x < -5/4, is where both expressions contain an imaginary part, so we should have discarded it anyway.

$\endgroup$
  • $\begingroup$ Yes, my understanding is that the question is about why x < -5/4 is returned and whether it is a bug. An inequality should implicitly assume that both sides are real. But then there are some edge cases that require a bit more thought before hastily declaring them a bug, even if strictly mathematically they're incorrect ... e.g. what about Reduce[x + Sqrt[-x] < x^2 + Sqrt[-x], x]? It says x < 0 || x > 1. But for x>1, both sides have imaginary components ... which do cancel out. $\endgroup$ – Szabolcs Apr 1 '15 at 18:59
  • $\begingroup$ @Szabolcs I wouldn't call either of these cases a bug, they're just examples of undefined behavior. Mathematica can manipulate the inequality however it wants internally, and will do so assuming the arguments are real, even if the arguments may actually be complex. To get defined behavior, we have to tell Mathematica to watch for possible complex numbers by using the domain Reals, or by limiting x to the range where the inequality makes sense, e.g. by adding && x > 1/2. $\endgroup$ – 2012rcampion Apr 1 '15 at 19:14
  • $\begingroup$ What Reals does is that it assumes that all subexpressions are real, at least according to the documentation (which often simplifies things). This makes things much simpler because it needs to restrict each of Sqrt[4 x + 5], Sqrt[-6 x + 10] and Sqrt[2 x - 1] to be real separately. I still don't understand where x < -5/4 comes from and it is clearly a wrong answer. Do you understand how it arrives to this wrong result? (Other than the fact that 4x+5 changes sign at that value.) $\endgroup$ – Szabolcs Apr 1 '15 at 19:34
  • $\begingroup$ @Szabolcs x < -5/4 makes sense as an answer, but only the developers can tell you why. It's just an example of GIGO: if you give an inequality whose arguments may be complex, you shouldn't expect any result at all. $\endgroup$ – 2012rcampion Apr 1 '15 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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