$\operatorname{card}\bigl((a,b]\cap \Bbb{Z}\bigr)=\lfloor b\rfloor-\lfloor a\rfloor$ for $a,b\in \Bbb{R}$

49 Views Asked by At

I was playing with my little brother with numbers when some examples suggested that for any $a,b\in \Bbb{R}$ we have $$\operatorname{card}\bigl((a,b]\cap \Bbb{Z}\bigr)=\lfloor b\rfloor-\lfloor a\rfloor.$$

Unfortunately I don't see how can I prove that, when we count the left side we see that is always the right side but it's not a proof.

2

There are 2 best solutions below

0
On BEST ANSWER

Hint: solve for $\,a=0\,$ to get the intutition. Then use that $\operatorname{card}\bigl((a,b]\cap \Bbb{Z}\bigr)=\operatorname{card}\bigl((\lfloor a \rfloor,b]\cap \Bbb{Z}\bigr)\,$, since the (possibly empty) interval $(\lfloor a \rfloor,a)$ never contains an integer.

0
On

Assuming $a<b$, the largest integer less than or equal to $b$ is $\lfloor b\rfloor$ and the largest integer less than or equal to $a$ is $\lfloor a\rfloor$. So an integer $n$ belongs to $(a,b]$ if and only if $$ \lfloor a\rfloor+1\le n\le\lfloor b\rfloor $$ Now, just count.