5
$\begingroup$

Mathematica finds no roots for

Solve[-1==Sqrt[x]*Abs[a],x]

but it does find a root for

Solve[-1/Abs[a]==Sqrt[x],x]

which seems inconsistent to me.

$\endgroup$
  • $\begingroup$ Using the option MaxExtraConditions -> All gives some insight. $\endgroup$ – Szabolcs Sep 22 '16 at 12:51
  • $\begingroup$ Solve[-1 == Sqrt[x] Abs[a], x, Reals] works. $\endgroup$ – corey979 Sep 22 '16 at 12:54
  • $\begingroup$ May be I do not see something, but I cannot understand, how it can work? Sqrt[x] is always non-negative and so is Abs[a]. Did I miss something? $\endgroup$ – Alexei Boulbitch Sep 22 '16 at 13:05
  • $\begingroup$ My question is why does it give a solution in the second case? $\endgroup$ – James Rowland Sep 22 '16 at 13:12
  • $\begingroup$ I found an even worse example Solve[-Abs[a]==Sqrt[x]*Abs[a],x] gives the solution x=1. $\endgroup$ – James Rowland Sep 22 '16 at 13:15
3
$\begingroup$

This isn't a full answer, but hopefully it will shine some light on what is happening.

To recap, we want to solve the equation

eq1 = -1 == Sqrt[x] Abs[a]

which can also be written in the equivalent form

eq2 = -1/Abs[a] == Sqrt[x]

There is no solution of this because -1/Abs[a] is always negative and Sqrt[x] is never negative.

Solve gets this right for eq1 but not for eq2.

Solve usually gives generic solutions (see documentation, under Details) which may not be valid for all values of the parameters (here a). However, we can ask it to generate (some or all) conditions under which the solution is valid.

Solve[eq1, x, MaxExtraConditions -> All]

{{x -> ConditionalExpression[1/Abs[a]^2, Abs[a] < 0]}}


sol = Solve[eq2, x, MaxExtraConditions -> All]

{{x -> ConditionalExpression[1/Abs[a]^2, Abs[a] < 0]}}

As you see, in both cases the solution is valid only under the condition that Abs[a] < 0. Which is of course never true. But in the case of eq2, Mathematica doesn't go all the way to find that out.

So this is really just a freak example of what "generic solution" can mean. In some cases it's not valid for any values of the parameters. But to "see" (compute) this, it requires extra work, which isn't always done automatically. Solve treats Abs[a] as any quantity and doesn't attempt to solve for the condition, even though it can.

Reduce[Abs[a] < 0, a]
(* False *)

We can instruct it to do this explicitly using Refine:

Refine[sol]

During evaluation of In[]: Refine::fas: Warning: one or more assumptions evaluated to False.

(* {{x -> Undefined}} *)

Or like this

Reduce[eq2, x]
(* Abs[a] < 0 && x == 1/Abs[a]^2 *)

Refine[%]
(* False *)

The question of course remains: why does Mathematica take the extra step to verify that the condition isn't always False in the case of eq1? I don't know. I just wanted to point out how the result we get is not as outrageous as it seems on first sight. I do remember a question where Reduce wouldn't fully solve a complicated equation unless it was applied multiple time. So it was clear that it was in principle capable of solving it, yet it wouldn't automatically do so without some nudging, at least when he equation was expressed in certain ways.

$\endgroup$
  • $\begingroup$ I appreciate the effort but I already discovered most of these things (except the MaxExtraConditions option which is awesome to know about). It would not bother me if Mathematica returned no solution sometimes, and a solution with false conditional other times. The thing that bothers me is that it simply returns the solution with no conditional. The -Abs[a]==Sqrt[x]*Abs[a] example illustrates this very well. Mathematica returns x->1 with no conditionals but this is not a valid solution. It is a solution if you consider Sqrt[x] as a multivalued function but Mathematica does not do that. $\endgroup$ – James Rowland Sep 23 '16 at 2:31
  • $\begingroup$ I really want to understand what the logic branching looks like that allows x->1 to be returned as a solution. I cannot think of any consistent rules which would allow this. $\endgroup$ – James Rowland Sep 23 '16 at 2:32
1
$\begingroup$

I think the reason for the difference in the results of Solve[..] (cf. Trace[Solve[..], TraceInternal -> True]) is that the replacement

{x -> 1/Abs[a]^2}

makes the first equation False but does not make the second False:

-1 == Sqrt[x]*Abs[a] /. {x -> 1/Abs[a]^2}
(*  False *)

-1/Abs[a] == Sqrt[x] /. {x -> 1/Abs[a]^2}
(*  -(1/Abs[a]) == 1/Abs[a]  *)

Aside: There is a value you can plug in for a to make this last equation evaluate to True, and in turn to make {x -> 1/Abs[a]^2} into a solution, namely a = Infinity. It's not really a number, though. The question is why doesn't the Equal[] evaluate to False, and perhaps it's because it is sometimes true (i.e., at least once).

Block[{a = Infinity},
 -1/Abs[a] == Sqrt[x] /. {x -> 1/Abs[a]^2}]
(*  True   *)

The first equation cannot be solved if a = Infinity. That might be the reason for the difference in the two Solve[] results.

$\endgroup$

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.