Is this proof of $\left\lfloor \frac{n}{m} \right\rfloor = \left\lceil \frac{n-m+1}{m} \right\rceil$ correct?

208 Views Asked by At

I've been practicing proving things about floor and ceiling functions, so I thought I'd try to prove this well-known identity: $$\left\lfloor \frac{n}{m} \right\rfloor = \left\lceil \frac{n-m+1}{m} \right\rceil$$ for all $n,m \in \mathbb{Z}$, $m>0$.

This is what I came up with. Is my proof correct?

Proof:

[see edit below]

Case 1: $m=1$ $$\left\lfloor \frac{n}{1} \right\rfloor = \lfloor n \rfloor = n$$ $$\left\lceil \frac{n-1+1}{1} \right\rceil = \lceil n \rceil = n$$

Case 2: $m>1$

If $\frac{n}{m}$ is an integer, then

$$\left\lceil \frac{n-m+1}{m} \right\rceil = \left\lceil \frac{n}{m} -1 + \frac{1}{m}\right\rceil = \frac{n}{m} -1 + \left\lceil \frac{1}{m} \right\rceil = \frac{n}{m} -1 + 1 = \frac{n}{m} = \left\lfloor \frac{n}{m} \right\rfloor$$

If $\frac{n}{m}$ is NOT an integer, then

$$\left\lfloor \frac{n}{m} \right\rfloor = \left\lceil \frac{n}{m} \right\rceil - 1 = \left\lceil \frac{n}{m} + \frac{1}{m} \right\rceil - 1 = \left\lceil \frac{n}{m} + \frac{1}{m} -1 \right\rceil = \left\lceil \frac{n-m+1}{m} \right\rceil$$

$\blacksquare$

If it's correct but you know a simpler/better way to prove it, please include that in your answer. Thank you.


EDIT: As pointed out by user peterwhy, "Case 1: $m=1$" is simply a special case of "$\frac{n}{m}$ is an integer" and therefore is not needed; hence I have grayed it out, and we don't need to separate the $m=1$ and $m>1$ cases anymore.

3

There are 3 best solutions below

2
On BEST ANSWER

Your proof looks okay (although the second equality in the $n/m$ not being integer might need some clarification). Notice that this identity can be proven essentially the same way as Prove that $\left\lceil \frac{n}{m} \right\rceil =\left \lfloor \frac{n+m-1}{m} \right\rfloor$ . Here is one variant.

By division with remainder, we can write $n=\lfloor \frac{n}{m} \rfloor m+(n \bmod m)$. Adding $-m+1$ to both sides and dividing by $m$ we get $$ \frac{n-m+1}{m}=\Big\lfloor \frac{n}{m} \Big\rfloor +\frac{(n \bmod m)-m+1}{m}.\tag{*} $$ Since $0 \leq n \bmod m \leq m-1$, we have $-m+1 \leq (n \bmod m)-m+1\leq 0$. So the rightmost fraction in $(*)$ (denote $x$) satisfies $-1<-1+\frac{1}{m}\leq x \leq 0$. Hence applying the ceiling function (and using that $\Big\lfloor \frac{n}{m} \Big\rfloor$ is an integer), we get $$ \Big\lceil \frac{n-m+1}{m}\Big\rceil =\Big\lfloor \frac{n}{m} \Big\rfloor +\Big\lceil\frac{(n \bmod m)-m+1}{m}\Big\rceil=\Big\lfloor \frac{n}{m} \Big\rfloor. $$

Note. Alternatively, if you already know the dual statement $\left\lceil \frac{n}{m} \right\rceil =\left \lfloor \frac{n+m-1}{m} \right\rfloor$, you can just use $\lfloor -x \rfloor=-\lceil x \rceil$ few times: $$ \left\lfloor \frac{n}{m} \right\rfloor = -\Big\lceil \frac{-n}{m} \Big\rceil = - \left \lfloor \frac{-n+m-1}{m} \right\rfloor =-\Big(-\Big\lceil \frac{n-m+1}{m}\Big\rceil\Big)=\Big\lceil \frac{n-m+1}{m}\Big\rceil $$

1
On

As in your previous question on floor and ceiling, I am finding the interval of both sides with inequalities.

Both sides are defined and are integers. They are respectively within these intervals:

$$\begin{array}{rrcl} \text{LHS:}&\dfrac nm-1 <&\left\lfloor\dfrac nm\right\rfloor&\le \dfrac nm\\\hline \text{RHS:}&\dfrac{n-m+1}{m}\le& \left\lceil\dfrac{n-m+1}{m}\right\rceil &< \dfrac{n-m+1}{m}+1\\ \iff&\dfrac{n+1}{m}-1\le& \left\lceil\dfrac{n-m+1}{m}\right\rceil &< \dfrac{n+1}{m}\\ \end{array}$$

The $4$ endpoints are in this order:

$$\frac nm-1 < \frac{n+1}m-1 \le \frac nm < \frac{n+1}m$$

There are no possible integers strictly between $\dfrac nm-1 < \dfrac{n+1}m-1$, and none strictly between $\dfrac nm < \dfrac{n+1}m$. Then both LHS and RHS can only be the one integer within the overlapping interval:

$$\frac{n+1}m-1 \le (\text{Both LHS and RHS})\le \frac nm$$


(BTW in the question, if $\frac nm$ is not an integer, then $\left\lceil\frac nm\right\rceil = \left\lceil\frac nm + \frac 1m\right\rceil$. While intuitive, no integer exists strictly between $\frac nm < \frac{n+1}m$ is how I would explain it to myself)

3
On

Another succinct proof is

$$\left\lfloor\frac nm\right\rfloor = \left\lfloor\frac{n + \frac12}m\right\rfloor = \left\lceil\frac{n - m + \frac12}m\right\rceil = \left\lceil\frac{n - m + 1}m\right\rceil,$$

since $\frac{n + \frac12}m$ and $\frac{n - m + \frac12}m$ are always non-integers with a difference of $1$.