# Using Assuming with Reduce

I have the following code that includes Assuming to cut through irrelevant detail, or so I had hoped.

Assuming[w > 1/2 && P < 1, Reduce[P + f (-1 + P) (-1 + 2 w) > 0]]


To my detriment Mathematica generates an output whose first condition is $w<\frac{1}{2}$

How can I get Mathematica to use my assumptions to focus on only those values that apply within those assumptions?

• Assuming[w > 1/2 && P < 1, FullSimplify@Reduce[P + f (-1 + P) (-1 + 2 w) > 0]]?
– kglr
Commented Aug 10, 2018 at 12:11
• Oh dear. That was beautiful! Commented Aug 10, 2018 at 12:17

• Assuming affects the default assumptions for all functions that have an Assumptions option.

Assumptions is not an option for Reduce:

Options[Reduce]


{Backsubstitution -> False, Cubics -> False, GeneratedParameters -> C, Method -> Automatic, Modulus -> 0, Quartics -> False, WorkingPrecision -> ∞}

You can wrap Reduce with FullSimplify:

Assuming[w > 1/2 && P < 1, FullSimplify@Reduce[P + f (-1 + P) (-1 + 2 w) > 0]]


f (-1 + P + 2 w - 2 P w) < P

There is a warning in the docs for FullSimplify:

Some of the transformations used by FullSimplify are only generically correct.

It's also true for Simplify (e.g. Simplify[Sin[Pi x]/x == 0, x ∈ Integers]). Often one uses Reduce to avoid such errors.

One way to introduce assumptions in Reduce is to include them as constraints:

Assuming[w > 1/2 && P < 1,
Reduce[$Assumptions && P + f (-1 + P) (-1 + 2 w) > 0]] (* w > 1/2 && P < 1 && f < -(P/(1 - P - 2 w + 2 P w)) *)  As mentioned by @kglr (+1) Reduce will ignore the conditions in Assuming but FullSimplify will use them. Composition[ MemberQ[Assumptions], Keys, Options ] /@ {Reduce, FullSimplify} (* {False, True} *)  Another option would have been to incorporate your assumptions into the expression to Reduce. Reduce[ And @@ { P + f (-1 + P) (-1 + 2 w) > 0, w > 1/2, P < 1 } ] (* w > 1/2 && P < 1 && f < -(P/(1 - P - 2 w + 2 P w)) *)  The perfect method is written as follows. Reduce[expr &&$Assumptions, vars] // Simplify

(e.g. Reduce for $$e^a>1$$, whose result is $$a>0$$)

This way is much better than the Reduce[...]//Simplify way, which also exerts the global $Assumptions, but costs much more efforts and may bring about failure. That's because in Reduce part it tries to find all the possible solutions in the whole domain of vars, which is totally not necessary if you assign (e.g.)a>=0. Even worse is it's too heavy-loaded for Mathematica to give a result, and then it gives up. But my way of using $Assumptions in *expr* part of Reduce tells it not to search in the other region.

The Trace functions shows this:

A very simple example in which Reduce fails but reduce succeeds: