Say we have some function $f(n)=\Theta(\log n)$ and another function $g(n)=\Theta(n+\log n)$. Is it valid to substitute $f(n)$ for $\log n$, giving us $g(n) = \Theta(n + f(n))$? This seems obvious to me but I'm not sure if there is a weird edge case where this isn't true.
Asked
Active
Viewed 63 times
1 Answers
0
Bit $\Theta$ gives big possibilities. Let's write down what we have, assuming appropriate conditions on constants and infinity neighbourhood: $$f(n)=\Theta(\log n) \Leftrightarrow a_1 \log n \leqslant f \leqslant a_2 \log n$$ $$g(n)=\Theta(n+\log n) \Leftrightarrow b_1 (n+\log n) \leqslant g \leqslant b_2 (n+\log n)$$ Now we combine from above inequalities $$ c_1 (n+f) \leqslant b_1n+\frac{b_1}{a_2}f\leqslant g \leqslant b_2 n + \frac{b_2}{a_1}f \leqslant c_2 (n+f) $$ which gives $g(n) = \Theta(n + f(n))$.

zkutch
- 2,364
- 1
- 7
- 14