Let's say we are given $a$, $b$, $d$ with $1 \leq a, b, d \leq 1000$ and inequalities $x \geq a$, $y \geq b$, and $a+b < x + y \leq a+b+d$.

I need to combine all this and the following into one inequality. Is there a common factor that we can multiply to one or the other or something? Can we exploit the fact that ranges are known? How do we proceed in such a case? Any help is appreciated.

  • $\begingroup$ Instead of writing $1 \leq a \leq 1000$, $1 \leq b \leq 1000$ and $1 \leq d \leq 1000$, I instead wrote $1 \leq a, b, d \leq 1000$ which is equivalent. $\endgroup$ – Michael Albanese Feb 6 '13 at 8:12

I think we can do this with two helper functions:

Let $f(x)=1+\lfloor \frac{x}{x^2+1} \rfloor =\left\{\begin{matrix} 1&\text{if }x\ge 0\\ 0& \text{if }x<0 \end{matrix}\right.$

And let $g(x)=-\lfloor\frac{-x}{x^2+1}\rfloor=\left\{\begin{matrix} 1&\text{if }x > 0\\ 0& \text{if }x\le0 \end{matrix}\right.$

Then inequalities of the form $p\ge q$ are true if and only if $f(p-q)=1$; and inequalities of the form $p>q$ are true if and only if $g(p-q)=1$. For several inequalities to be simultaneously true, we need many factors of these types to multiply to $1$.

In your situation, we require $$f(a-1)f(b-1)f(d-1)f(1000-a)f(1000-b)f(1000-d)f(x-a)f(y-b)f(a+b+d-x-y)g(x+y-a-b)=1$$

  • $\begingroup$ +1 Very cool! ${}$ $\endgroup$ – Ovi Jul 13 '18 at 23:42
  • $\begingroup$ @Ovi. Thanks!... $\endgroup$ – paw88789 Jul 14 '18 at 1:58

The range defined for one set of value(s) is independent from the range of some other. For instance, $a+b<x+y$ can hold regardless of whether $x\ge a$ or $y \ge b$ is true. So, there is no way to combine them all into one expression using merely relational operators.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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