Floor function simplification identities

3.1k Views Asked by At

I can't seem to find any identity(if any)for division/multiplication involving floor functions: for example $$\lfloor{\frac{n-1}{2}}\rfloor\cdot 2$$ I know does not simplify down to $$n-1$$.

3

There are 3 best solutions below

0
On

The floor function involves rounding down to the greatest integer less than or equal to the number. Thus, it involves a reduction of $0$ up to just less than $1$. In particular, this means for all real $x$ that

$$x - 1 \lt \lfloor x \rfloor \le x \tag{1}\label{eq1}$$

Thus, with your example, you have

$$\frac{n - 3}{2} \lt \left\lfloor \frac{n-1}{2} \right\rfloor \le \frac{n-1}{2} \tag{2}\label{eq2}$$

Multiplying by $2$ gives

$$n - 3 \lt \left\lfloor \frac{n-1}{2} \right\rfloor \cdot 2 \le n-1 \tag{3}\label{eq3}$$

Among integers, the result can potentially be either $n - 2$ or $n - 1$, depending on the value of $n$. For example, if $n = 2$, then the result is $0$, i.e., $n - 2$.

0
On

We have that $$ x = \frac{x} {2} + \frac{x} {2} = 2\left\lfloor {\frac{x} {2}} \right\rfloor + 2\left\{ {\frac{x} {2}} \right\} = 2\left\lfloor {\frac{x} {2}} \right\rfloor + x\bmod 2 $$ so $$ 2\left\lfloor {\frac{x} {2}} \right\rfloor = x - 2\left\{ {\frac{x} {2}} \right\} = x - x\bmod 2 $$ which means that for any $x$ $$ x - 2 < 2\left\lfloor {\frac{x} {2}} \right\rfloor \leqslant x $$

0
On

You could consider separately what happens when $n$ is an even number and when $n$ is an odd number.

If $n=2k$, then \begin{align} 2\left\lfloor \dfrac{n-1}{2} \right\rfloor &= 2\left\lfloor \dfrac{2k-1}{2} \right\rfloor\\ &= 2\left\lfloor k - \dfrac 12 \right\rfloor\\ &= 2(k-1) \\ &= 2\left( \dfrac n2 - 1 \right) \\ &= n - 2 \end{align}

If $n=2k+1$, then \begin{align} 2\left\lfloor \dfrac{n-1}{2} \right\rfloor &= 2\left\lfloor \dfrac{2k+1-1}{2} \right\rfloor\\ &= 2\left\lfloor k \right\rfloor\\ &= 2k \\ &= n - 1 \end{align}