Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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[7]) || y == 1/2 (1 + I Sqrt[7])) && 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[7]) || x == 1/2 (1 + I Sqrt[7]) *)

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.


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

share|improve this question
up vote 11 down vote accepted

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.

share|improve this answer
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. – Daniel Lichtblau Jan 28 '14 at 17:41
@Daniel Thanks for the explanation. If this is a deprecated syntax how is the operation intended to be written now? – Mr.Wizard Jan 28 '14 at 23:40
I, umm, don't know. Sorry about that. – Daniel Lichtblau Jan 29 '14 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 '15 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. – Mr.Wizard May 21 '15 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 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}]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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