Difference of the floor of a product and the product of floors

1.1k Views Asked by At

Is there any way the following can be simplified?

$$\lfloor f(x)\cdot g(x) \rfloor - \lfloor f(x) \rfloor \cdot \lfloor g(x) \rfloor$$

2

There are 2 best solutions below

4
On BEST ANSWER

The fact that your values $f(x)$ and $g(x)$ are outputs of functions doesn't affect anything unless there is something special about the range of the functions you haven't told us. Therefore, you want another way to write $\lfloor ab\rfloor-\lfloor a\rfloor\lfloor b\rfloor$.

Using the relatively common notation $\{x\}$ for the "fractional part" of $x$, given by $\{x\}=x-\lfloor x\rfloor$, we can write the following: $$\lfloor ab\rfloor-\lfloor a\rfloor\lfloor b\rfloor$$ $$=\left\lfloor (\lfloor a\rfloor+\{a\})(\lfloor b\rfloor+\{b\})\right\rfloor-\lfloor a\rfloor\lfloor b\rfloor$$ $$=\left\lfloor \lfloor a\rfloor\lfloor b\rfloor+\{a\}\lfloor b\rfloor+\{b\}\lfloor a\rfloor+\{a\}\{b\}\right\rfloor-\lfloor a\rfloor\lfloor b\rfloor$$ $$=\left\lfloor \{a\}\lfloor b\rfloor+\{b\}\lfloor a\rfloor+\{a\}\{b\}\right\rfloor\text{ (1)}$$ $$=\left\lfloor \{a\}\lfloor b\rfloor+\{b\}\left(\lfloor a\rfloor+\{a\}\right)\right\rfloor$$ $$=\left\lfloor \{a\}\lfloor b\rfloor+a\{b\}\right\rfloor$$

It may be tempting to discard the term $\{a\}\{b\}<1$ from (1), but that could be enough to change which integer the desired floor is.

0
On

Well, it's $$ \left\lfloor \lfloor f(x) \rfloor ( g(x) - \lfloor g(x) \rfloor ) + g(x) ( f(x) - \lfloor f(x) \rfloor ) \right\rfloor $$

Maybe you consider that simpler, perhaps so if write $\mathrm{frac}(x)$ for the fractional part of $x$ ($0 \leq \mathrm{frac}(x) < 1$): $$ \left\lfloor \lfloor f(x) \rfloor \mathrm{frac}(g(x)) + g(x) \mathrm{frac}(f(x)) \right\rfloor $$

You can also swap $f$ and $g$.

What were you hoping for?