# How to apply the floor function in algebra?

I was reading a statistics paper and saw a formula with floor operators. I wondered how to solve for one of the variables in the formula, but realized that I did not know how to work with these things.

I have the following, where I am trying to solve for $$a$$.

$$y = \lfloor log(a) - log(b) \rfloor + 1$$

I am confused about the order of operations with the floor operators $$\lfloor \rfloor$$.

I see some options

1. Ignore the floor and solve for $$a$$

$$y = log(a) - log(b) + 1$$

$$y - 1 + log(b) = log(a)$$

$$a = exp[y - 1 + log(b) ]$$

1. Apply floor to each expression in the formula then use ceiling

$$y = \lfloor log(a) - log(b) \rfloor + 1$$

$$y = \lfloor log(a) \rfloor - \lfloor log(b) \rfloor + 1$$

$$\lfloor log(a) \rfloor = y - 1 + \lfloor log(b) \rfloor$$

$$log(a) = \lceil y - 1 + \lfloor log(b) \rfloor\rceil$$

$$a = exp[\lceil y - 1 + \lfloor log(b) \rfloor\rceil]$$

I could keep going with more I think, but I hope this gets the point across. I don't know how to do algebra with these ceiling and floor operators.

• There is a more generic question. How should such equations as $~\displaystyle f(x) = \left\lfloor g(x)\right\rfloor~$ or $~\displaystyle f(x) \geq \left\lfloor g(x)\right\rfloor~$ be attacked? My standard approach is to create the $2$ variables $A$ and $r$, where $~A \in \Bbb{Z},~ 0 \leq r < 1,~$ and $~\displaystyle x = A + r \implies A = \left\lfloor x\right\rfloor.$ Commented Apr 12, 2022 at 4:46

You have that $$m = \lfloor{x}\rfloor$$ if and only if $$m \leq x < m + 1$$. Thus, $$y - 1 = \lfloor \log(a) - \log(b) \rfloor \implies y - 1 \leq \log(a) - \log(b) < y$$ and so we get $$y - 1 + \log(b) \leq \log(a) < y + \log(b)$$ Exponentiating $$be^{y - 1} \leq a < be^y$$ and so on...
• This is nice. In practice, when there is a large difference between the left hand side and the right hand side and say there is a need to make a program that calculates $a$ and say that the assumption is to be on the conservative side of things how to people tend to proceed? Could someone say $a = be^y$ or $a = be^y - 1$?