# Proving that $\lfloor{i/2^h}\rfloor = \lfloor \lfloor\cdots \lfloor i/2\rfloor/2\cdots\rfloor/2\rfloor$

I am trying to prove that $$\left\lfloor{\frac{i}{2^h}}\right\rfloor$$ equals to performing a series of $$h$$ operations of $$\left\lfloor\frac{\left\lfloor\frac{\left\lfloor\frac{i}{2}\right\rfloor}{2}\right\rfloor}{2}\right\rfloor$$ etc...

I am using this property as part of a larger proof for an algorithm and this property is all I need... any help?

• Both correspond to truncating the bottom $h$ digits of the binary expansion of the number. – jgon Dec 15 '18 at 18:22
• Thank! any idea how i can formally/mathematically prove it? @jgon – Limitless Dec 15 '18 at 18:33
• Yes, I would first prove that dividing by $2^n$ and taking the floor deletes the last $n$ bits of the number, and then prove by induction that therefore since the operation divide by two and then take the floor deletes the least significant bit of the number, iterating that operation $n$ times deletes the last $n$ bits of the number. – jgon Dec 15 '18 at 18:53

Hint: You can show that it is true if $$i < 2^h$$ easily. In both cases, the evaluation is $$0$$.
After that, you can prove it easily for $$2^h$$. Both are equal to $$1$$ as in the second case each time we have a power of $$2$$ and the result is integer each time.
For the last case $$i > 2^h$$. Hence, we can write it likes $$i = 2^n + k$$ whcih $$n \geq h$$ and $$k < 2^h$$. First case is $$2^{n-h}$$. we can prove for the second case easily by induction over $$n$$ with base of $$n = h$$.