# Solving system of inequalities with floor function

I have set up a system of equations that I need to solve for $a$ and $b$. $M$ and $m$ are known constants. The system of inequalities is as follows:

\begin{cases} a - \left \lfloor{\frac{a}{b}}\right \rfloor \cdot b \leq M \\ a - \left \lfloor{\frac{a}{b}}\right \rfloor \cdot b \geq m \end{cases}

Unfortunately, I have tried to solve it even in Mathematica with the method "Reduce", but I wasn't able to manage to do it... How do I approach this problem with "simple" calculations carried out by hand?

Hint: Write $a = b q + r$ with $0 \le r < b$.

Edit

Let ${\cal S}$ be the set of all the solutions $(a, b)$.

For the sake of simplicity let us seek the solutions such that $b>0$. For any $a\in {\mathbb R}$, one can write $a = b q + r$ in a unique way, with $q\in {\mathbb Z}$ and $0\le r < b$. Obviously, the pair $(a, b)$ is a solution if and only if $m\le r \le M$. Hence

$$\{(a,b)\in{\mathcal S}: b > 0\} = \{(b q + r, b): \max(0, m)< b \textrm{ and } q \in {\mathbb Z}\textrm{ and } r\in [0,b)\cap [m, M]\}$$

of course, there are conditions to ensure that the interval $[0,b)\cap [m, M]$ is non empty, namely $m\le M$ and $m< b$ and $0\le M$.

Hint To investigate the case $b < 0$, define $a^\prime=-a$ and $b^\prime=-b$

• Wouldn't this complicate the things? You are introducing two other unknowns, $q$ and $r$... I wouldn't know how to proceed from there – james42 Sep 11 '17 at 11:59
• No, $q\in {\mathbb Z}$ is defined uniquely by $q = \lfloor \frac{a}{b}\rfloor$ and $r$ is the remainder modulo $b$, at least if $b\ge 0$. – Gribouillis Sep 11 '17 at 12:04
• I'm still not able to solve it... can you please be more explicit? – james42 Sep 11 '17 at 16:54
• @james42 See my edit above. – Gribouillis Sep 11 '17 at 19:08