TITLE: How do you handle the floor and ceiling function in an equation?
QUESTION [25 upvotes]: 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?

REPLY [3 votes]: Observe that
\begin{eqnarray}
G(n) = \left \lfloor n \log \varphi - \log \sqrt{5} \right \rfloor + 1 = \left \lceil n \log \varphi - \log \sqrt{5} \right \rceil
\end{eqnarray}
and write
\begin{eqnarray}
\left \lceil \frac{G(n)}{\log \varphi} + \log_{\varphi} \sqrt{5} \right \rceil & = & \left \lceil \tfrac{1}{\log \varphi} \left \lceil n \log \varphi - \log \sqrt{5}  \right \rceil + \log_{\varphi} \sqrt{5} \right \rceil = n.
\end{eqnarray}