4
$\begingroup$

I'm seeking the range of potential values of three ordered real variables that sum to 1.0:

Reduce[{x+y+z == 1,
        z > y,
        y > x,
        x >= 0},
        {x,y,z}]

$$0\leq x<\frac{1}{3}\land x<y<\frac{1-x}{2}\land z=-x-y+1$$

[For simplicity, don't worry about cases where the variables are equal.]

This properly reveals that the range of potential values for the smallest variable is $0 \leq x < 1/3$. Fine.

The problem is the range for the other variables, $(y,z)$ are expressed in terms of a particular value of $x$.

The solution I seek is:

$$0 \leq x < \frac{1}{3}$$

$$0 < y < \frac{1}{2}$$

$$1/3 < z < 1$$

Basically, these are the cases where it is possible to find any given variable (for some values of the other two variables)... a subtle difference from the first "solution."

For instance, it is possible to have $1/3 = z$ with the other variables being $x = y = 1/3$. But it is never possible to find a value $z < 1/3$ given these constraints. And so on.

How does one solve for the range of solutions over all other possible values of the other variables, honoring the constraints? (I'm hoping there is a solution that isn't a brute force solution for each variable taken individually as I want to generalize this problem to $n$ variables.)

I've tried Solve and other obvious methods, without success.

$\endgroup$
2
  • 1
    $\begingroup$ Since it seems Reduce picks the first variable, and uses that to express the other in terms of it, you could do this (just change the order of the variables) i.sstatic.net/LqweAedr.png ofcourse this is not a general method. But I just thought to mention it. There should be a more automated way to do what you want than this. $\endgroup$ Commented Dec 13 at 0:55
  • $\begingroup$ @Nasser. Thanks... I thought about just such a solution, but it seemed like such a kludge (as I wrote): essentially breaking the single problem into three separate ones. I have a feeling there is a much more elegant solution out there. And actually, your "solution" doesn't give the final answer in my desired form anyway. $\endgroup$ Commented Dec 13 at 1:09

4 Answers 4

4
$\begingroup$
$Version

(* "14.3.0 for Mac OS X ARM (64-bit) (July 8, 2025)" *)

Clear[x, y, z]

sys = {x + y + z == 1, z > y, y > x, x >= 0};

Ignoring equality,

#[[1, -1]] < #[[1, 1]] < #[[-1, -1]] & /@ 
 Outer[{#1, #2[#1, sys, {x, y, z}]} &, {x, y, z}, {MinValue, MaxValue}]

(* {0 < x < 1/3, 0 < y < 1/2, 1/3 < z < 1} *)
$\endgroup$
1
  • $\begingroup$ Oh how clever... test the extremes. $(\checkmark)$. $\endgroup$ Commented Dec 13 at 1:41
8
$\begingroup$

Method-1

  • Reduce[...,{x},{y,z}] etc.
{Reduce[{x + y + z == 1, z > y, y > x, x >= 0}, {x}, {y, z}], 
 Reduce[{x + y + z == 1, z > y, y > x, x >= 0}, {y}, {z, x}],
 Reduce[{x + y + z == 1, z > y, y > x, x >= 0}, {z}, {x, y}]}

{0 <= x < 1/3, 0 < y < 1/2, 1/3 < z < 1}.

Method-2

  • RegionBounds.
reg = ImplicitRegion[{x + y + z == 1, z > y, y > x, x >= 0}, {x, y, z}];
RegionBounds[reg]

{{0, 1/3}, {0, 1/2}, {1/3, 1}}

$\endgroup$
5
  • $\begingroup$ Where did you find the form Reduce[{x + y + z == 1, z > y, y > x, x >= 0}, {x}, {y, z}]? I do not see it anywhere is help and also looked a few examples. Is this documented somewhere? Nice solution. $\endgroup$ Commented 2 days ago
  • $\begingroup$ 🤦🏻‍♂️ could not recall RegionBounds. +1 :) $\endgroup$ Commented 2 days ago
  • $\begingroup$ @Nasser It is undocumented and I learn this from this forum at least 5 years ago. $\endgroup$ Commented 2 days ago
  • $\begingroup$ The documentation for both versions 6 and 7 include the form Solve[eqns, vars, elims]. Although currently undocumented, this form still works and appears to have been extended to Reduce. $\endgroup$ Commented 2 days ago
  • $\begingroup$ Ohhh.... I really like RegionBounds. Thanks! ($+1$) $\endgroup$ Commented 2 days ago
3
$\begingroup$

This can also be seen as a linear programming exercise, e.g.

sys = {x + y + z == 1, 0 <= x < y < z};
f[u_] := 
 Module[{r = (Abs[#] /. 
        LinearOptimization[#, sys, {x, y, z}]) & /@ {u, -u}}, 
  r[[1]] < u < r[[2]]]
f /@ {x, y, z}

=>

{0 < x < 1/3, 0 < y < 1/2, 1/3 < z < 1}

Illustrating:

g[u_] := {x, y, z} /. LinearOptimization[u, sys, {x, y, z}]
p = Union[g /@ (Times @@@ Tuples[{{x, y, z}, {1, -1}}])];
Show[Plot3D[1 - x - y, {x, 0, 1}, {y, 0, 1}, Mesh -> None],
 Plot3D[1 - x - y, {x, 0, 1}, {y, 0, 1}, Mesh -> None, 
  RegionFunction -> Function[{x, y, z}, x < y < z], PlotStyle -> Red],
  Graphics3D[{PointSize[0.03], Point[p]}]
 ]

enter image description here

$\endgroup$
3
$\begingroup$
$Version

(* "14.3.0 for Mac OS X ARM (64-bit) (July 8, 2025)" *)

Generalizing cvgmt's Method-1

ClearAll[x]

Format[x[n_]] := Subscript[x, n]

sol[n_Integer?Positive] := Module[{var, sys, rot},
  var = x /@ Range[n];
  sys = {Less @@ var, x[1] >= 0, Total[var] == 1};
  rot = RotateLeft[var, #] & /@ Range[0, n - 1];
  Reduce[sys, First@#, Rest@#] & /@ rot]

sol[3]

enter image description here

sol[10]

enter image description here

$\endgroup$
1
  • $\begingroup$ Yep... that's a generalization! Thanks. ($+1$) $\endgroup$ Commented 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.