Suppose I have a variable $x$ such that
$$x=\text{constant}+O(\log y) + O(\log z)$$
Does that mean I can write
$$x=\text{constant}+O(\log yz)$$?
Suppose I have a variable $x$ such that
$$x=\text{constant}+O(\log y) + O(\log z)$$
Does that mean I can write
$$x=\text{constant}+O(\log yz)$$?
Copyright © 2021 JogjaFile Inc.
In that case,yes, you can write it. The $O(f(x))$ notation simply means that $$lim_{x\rightarrow0}\frac{O(f(x))}{f(x)} = 0$$ So you just need to calculate if : $\frac{O(log(y)) + O(log(z))} {log(yz)} $ approaches $0$ when $y,z \rightarrow 0$. $$0\leq|\frac{O(log(y)) + O(log(z))} {log(yz)} | = |\frac{O(log(y)) + O(log(z))} {log(y)+log(z)}|\leq |\frac{O(log(y))} {log(y)+log(z)}| + |\frac{O(log(z))} {log(y)+log(z)} | $$ $$\leq |\frac{O(log(y))} {log(y)}|+|\frac{O(log(z))} {log(z)}| \rightarrow 0 + 0 = 0$$ The last transition is true because for $y,z <1$ the $log's$ are both smaller than $0$. so the term in the denominator is getting smaller, and with the absolute value, it gets bigger. In conclousion, that stamement is correct but not trivial al all.