In one of my exercise sheets I have the following question;
Let $f,g: \mathbb{N}\longrightarrow\mathbb{R}$ be positive functions with $f(n) \in O(g(n))$. Prove or disprove; $\ln(f(n)) \in O(\ln(g(n))$.
I first thought this would be the case since ln is a monotonically increasing function ( derivative is positive ) the asymptotic ordering of these functions wouldn't be affected. But then there was an example stuck in my mind and which I have later on seen on the internet as well.
Let $f(n) = 2^n,g(n)=3^n$. Since $f(n) \in O(g(n))$ given $\lim_{n\to \infty} \frac{3^n}{2^n}=\infty$. Then $\ln(f(n))=n*\ln 2$ and $\ln(g(n))=n*\ln 3$ which leads to $ 0< \lim_{n\to \infty} \frac{n*\ln 3}{n*\ln 2} < \infty$ which implies $\ln (f(n)) \in \Theta(\ln(g(n)))$. The growth rates have changed yes but since $\Theta(f) = O(f) \cap\Omega(f)$ isn't, technically speaking, $\ln(f(n)) \in O(ln(g(n)))$ ? I am a bit confused as going by my own steps the initial assumption seems right but I am not entirely convinced for either possibility. Because if this is correct I feel like I can extend the same idea for exponentiation as well maybe.
Anything to prove or disprove the statement with an explanation would be really welcome as I am a bit lost at the moment.
In this answer, I'll denote by $\log$ the natural logarithm, which is equivalent to the $\ln$ notation you use (this is just a personal preference).
The claim is not true in general. Define $f,g:\mathbb{N} \to \mathbb{R}$ by $f(n) = 1 + 1/n$ and $g(n) = 1 + e^{-n}$. We can first note that each of the four functions $f(n), g(n), \log f(n), \log g(n)$ are positive for all natural $n$. We also note that $f(n) \in O(g(n))$, since $\lim_{n \to \infty} \frac{f(n)}{g(n)} = 1$. On the other hand, since $\log f(n) = \log(1 + 1/n) \sim 1/n$ and $\log g(n) = \log(1 + e^{-n}) \sim e^{-n}$ as $n \to \infty$, we have that $$\lim_{n \to \infty} \frac{\log f(n)}{\log g(n)} = \lim_{n \to \infty} \frac{1/n}{e^{-n}} =\lim_{n \to \infty} \frac{e^n}{n} = \infty $$ so that $\log f(n) \notin O(\log g(n))$.
The claim does hold if $\alpha = \liminf_{n \to \infty} g(n) > 1$ and $f(n) \geq 1$ for all but finitely many $n$. In this case, if $f(n) \in O(g(n))$ then for some constant $C>0$, we have that $f(n) \leq Cg(n)$ for large $n$. Hence $$\limsup_{n \to \infty} \frac{\log f(n)}{\log g(n)} \leq \limsup_{n \to \infty} \frac{\log Cg(n)}{\log g(n)} = \limsup_{n \to \infty} \frac{\log C + \log g(n)}{\log g(n)} = 1 + \limsup_{n \to \infty} \left(\frac{\log C}{\log g(n)}\right)$$ $$\leq 1 + \frac{\log C}{\log \alpha} < \infty$$
so that $\log f(n) \in O(\log g(n))$.
In particular, this means that if $f(n), g(n) \xrightarrow[n \to \infty]{} + \infty$, then indeed the implication $f \in O(g) \rightarrow \log f \in O(\log g)$ holds, and this is most likely what we will encounter in practice (e.g., in computer science when analyzing algorithms, say).