# Reduce gives wrong solutions

Given the follwing system of equations

eqs = {
x/(x - 2) - 4/y == 1,
x/(2 + 1/y) == y/(3 - 1/x)
}


Although the domain of this system does not contain points (x,y) with x == 0, Reduce claimes (0,-4) to be a solution of the system

Reduce[eqs, {x, y}]
(x == 0 && y == -4) || (x == 6 && y == 8)

Reduce[eqs, {x, y}, Reals]
(x == 0 || x == 6) && y == -4 + 2 x


One gets this wrong solution also by hand when simplifying the two equations to

-4x-2y==-2
-3x+2y==-2


and using the accumulation method to solve the system.

I always expected Reduce to give correct results. Is this a bug or a feature?

It appears that Mathematica does automatic simplification in some cases which can change the domain of a function. In your case

Simplify[eqs]


Gives {1/(2-x)+2/y==0, x y (1/(1-3 x)+1/(2 y+1))==0}, putting x=0 in the domain. A similar thing happens with expressions like

Simplify[(x^2-36)/(x+6)]

• I wonder how this ties in with the documentation, which says "The result of Reduce[expr,vars] always describes exactly the same mathematical set as expr. ". Commented Apr 22, 2015 at 10:36
• That's exactly the point! I don't mind if Solve gives me some false solutions, since Solve treats the generic case. In contrast I expect Reduce not to change the set of solutions i.e. to handle all possible cases in the specified domain. Commented Apr 22, 2015 at 19:13

Well, this is consistent, sort of. 1/0 is ComplexInfinity in Mathematica, and 1/ComplexInfinity is 0, so it works. For an excellent analysis of both the pragmatic reasons for this, and the associated difficulties, see: http://forums.wolfram.com/mathgroup/archive/2006/May/msg00125.html

• Hello, and welcome to Mathematica.SE! This is an interesting point and link, but as it stands, your answer is more a comment than a full answer. Could you please expand on it a little, say, by summarising the content in the linked post? Commented Apr 23, 2015 at 3:32
• Expand by summarizing? It really all comes down to whether you want to treat infinity as some sort of number. In applied math, we often do: we reason about perfectly stiff structural members or amplifiers with infinite bandwidth. Maybe we represent an infinite quantity by a zero reciprocal. Perhaps the equations above represent such a situation. Commented Apr 23, 2015 at 15:48
• Mathematica's design is essentially pragmatic here: it uses "compactification" heuristically, as when it reduces x/x to 1. It does a good job of reproducing the way we do applied math, but it's not full consistent as Andrzej points out in the link. Commented Apr 23, 2015 at 15:57
• If I apply eqs/.x->0 Mathematica produces the warning Power::infy: "Infinite expression 1/0 encountered." before returning the result {-(4/y) == 1, True}. This way I can check the results Reduce returns: With res = Reduce[eqs, {x, y}], eqs /. ToRules[res[[1]]] returns {True, True} with the warning mentioned above. Commented Apr 26, 2015 at 11:15
• Does anyone know how to restrict the domain to the open Reals or Complex set, i.e. to avoid any compactification? Commented Apr 26, 2015 at 11:24

This behavior is similar to Solve returning "generic" solutions as in

Solve[a x == b, x]


{{x -> b/a}}

which, of course, does not make sense for a=0. However, as the expression provided to Solve does not involve any other constraints, MMA gives the "generic" solution, i.e., one that holds for almost all values of a, b, except for (possibly) some values with zero Lebesgue measure (in this case, a=0).

Apparently, Reduce (or, maybe, Simplify if called internally) treats x the same way and provides solutions assuming that the input equations correspond to a "generic" x.

Of course, one could always provide explicit domain constraints:

Reduce[And @@ Flatten[{eqs, x != 0}], {x, y}]


x == 6 && y == 8