Suppose that $f, g$ are functions from the positive integers to the positive reals. Under what circumstances will $\log f(n)=O(\log g(n))$ imply $f(n)=O(g(n))$?

It's easy to see that this isn't always true: If $f(n)=3^n$ and $g(n)=2^n$ then we know that $3^n\notin O(2^n)$, but taking logs gives $\log3^n = n\log 3$ and $\log 2^n=n\log 2$ and it's obvious that $n\log 3=O(n\log 2)$.

The reason is also clear: If there exists a $c>0$ such that $\log f(n)\le c\,\log g(n)$ then all we can say is that $f(n)\le (g(n))^c$, which won't necessarily allow one to conclude $f(n)=O(g(n))$. When, though, can we correctly make the inference?

  • $\begingroup$ Just to make sure it's clear, the statement $f(n) = O(g(n))$ is equivalent to the statement $\log f(n) = \log g(n) + O(1)$ because $c_1\cdot e^x = e^{x + \log c_1} = e^{x + c_2}$ for some constant $c_2$. $\endgroup$
    – usul
    Mar 11, 2015 at 3:46

1 Answer 1


It is at least sufficient to have $\log f(n) \in o(\log g(n))$. This gives us that for sufficiently large $N$, we have $\log f(n) \leq \log g(n)$ for all $n > N$.

Hence immediately we have that for $c=1, n > N$, $f(n) \leq c\cdot g(n)$ and ergo $f(n) \in O(g(n))$.

This also suggests the condition that if we have that $\log f(n) \leq c\cdot \log (g(n))$ where $c \leq 1$ for sufficiently large $n$, then we also get $f(n) \in O(g(n))$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.