# Behavior of Reduce with variables as domain

When using Reduce, I accidentally put a set of variables as the domain. To my surprise, it not only seems that Reduce expects this sort of input, but I found the output to be very useful.

Let me explain with an example. In a system of equations with multiple variables, I am often interested in the conditions placed on certain variables. Suppose I have x + y == 1 && x y == 2 and want to know what conditions this places on x. Normally, I would do this:

Reduce[x + y == 1 && x y == 2, x]

(* (y == 1/2 (1 - I Sqrt) || y == 1/2 (1 + I Sqrt)) && x == 1 - y *)


This output is not in the best form for what I want. Namely, Reduce has given me specific values for y and then expressed x and a function of y. I would have preferred if this had been the other way around, then I would have exactly what I want after ignoring y. (Oddly enough, Reduce gives specific values for x and expresses y as a function of x if you ask it to solve for y.)

Recently, I was working with a system of equation like this and accidentally put the other variables (in this case, just the variable y) as the domain.

Reduce[x + y == 1 && x y == 2, x, {y}]

(* x == 1/2 (1 - I Sqrt) || x == 1/2 (1 + I Sqrt) *)


Fantastic! This is exactly what I was looking for: the constraints placed on x. As far as I can tell, this behavior is not described in the documentation for Reduce.

## Question:

Is this expected behavior from Reduce? If so, where is this behavior described?

If you enter a bare Symbol as the third argument you get an illuminating Message:

Reduce[x + y == 1 && x y == 2, x, y];


Reduce::bdomv: Warning: y is not a valid domain specification. Mathematica is assuming it is a variable to eliminate. >>

This is analogous to the syntax of Solve which is documented as the primary usage through version 7, and as gwr points out presently in a tutorial:

Solve[eqns, vars, elims]
attempts to solve the equations for vars, eliminating the variables elims.

I have been using this syntax for a long time so I was surprised to find that it is missing from the current documentation. A bit of searching shows that it was a documented syntax in version 4 (and earlier):

Reduce[eqns, vars, elims] simplifies the equations, trying to eliminate the variables elims.

Why this was left out of later documentation is a mystery to me.

• It was changed to be a domain spec. When it is clearly NOT a domain spec then it reverts to the version <=4 interpretation as variables to eliminate. Possibly that should be an option rather than an optional argument, so as to avoid this ambiguity (and lack of ducumentation). Not my call though. Jan 28, 2014 at 17:41
• @Daniel Thanks for the explanation. If this is a deprecated syntax how is the operation intended to be written now? Jan 28, 2014 at 23:40
• I, umm, don't know. Sorry about that. Jan 29, 2014 at 16:21
• It seems to still be documented as can be seen here? Isn't Reduce a sepecial instance of Solve, eg. with the option Method->Reduce?
– gwr
May 21, 2015 at 13:12
• @gwr I guess that does make it documented but probably someone hasn't updated that tutorial yet, or this falls into the "not my job" area for someone. May 21, 2015 at 13:15

There are all sorts of nuggets like this, search the site for "undocumented". Who knows why something like this example works this way...it appears to invoke refinement of the result. Try, e.g., the second of these various forms,and the last which also causes a different refinement:

Reduce[x + y == 1 && x y == 2, {y}]
Reduce[x + y == 1 && x y == 2, {y}] // Refine[#, Last[#]] &
Reduce[x + y == 1 && x y == 2, {x}, {y}]
Reduce[x + y == 1 && x y == 2, {x}, Complexes]
Reduce[x + y == 1 && x y == 2, {x}, {Complexes}]