[Math] How to handle the floor and ceiling function in an equation

algebra-precalculusfunctions

I tried to do some math in a blog post of mine and came to one with a floor function. I wasn't sure how to deal with it so I just ignored it, and then added the ceiling function in my final equation as that seemed to give me the result I wanted. I'm wondering what is the correct way of handling these functions in equations?

What I did was this:

$$\begin{align}
G(n) &= \left\lfloor n\log{\varphi}-\dfrac{\log{5}}{2}\right\rfloor+1 \\\\
n\log{\varphi} &= G(n)+\dfrac{\log{5}}{2}-1 \\\\
n &= \left\lceil\dfrac{G(n)+\dfrac{\log{5}}{2}-1}{\log\varphi}\right\rceil
\end{align}$$

How should I have done this in a correct way? How do I work with the ceiling and floor functions when I shuffle around with equations?

Best Answer

You can replace $\lfloor x \rfloor$ with $x - \theta$, where $\theta \in [0,1)$ is some unknown quantity. Similarly, $\lceil x \rceil = x + \theta$ (a different $\theta$ within the same range).

Another helpful identity is $\lfloor x \rfloor + n = \lfloor x + n \rfloor$ for any integer $n$.