Proof that with $b < 0$, $a$ mod $b \in (b,0]$

90 Views Asked by At

I was trying to prove that $a$ mod $b \in (b,0]$ when $b < 0$. To do that basically I need to prove that $a - b\lfloor a/b \rfloor < 0$ which means that we need to prove that $b\lfloor a / b\rfloor > a$. The only way I found to do that is to show that the absolute value of $\lfloor a / b \rfloor > a / b$ weh b < 0. But I don't think is a consistent proof. How should I do?

1

There are 1 best solutions below

0
On

We have $\lfloor a/b\rfloor\le a/b$.

Because we're saying $b<0$, when multiplying both sides by $b$ the inequality must be reversed:

$b\lfloor a/b\rfloor \color{red}\ge a$.

Hence $a-b\lfloor a/b\rfloor\le0$.