Summation of two asymptotic functions

294 Views Asked by At

Suppose we have $f_1(x) = O(g_1(x))$ and $f_2(x) = O(g_2(x))$, then what is $(f_1(x) + f_2(x))$?

What I know is asymptomatic notations are closed under summation. So, $(f_1(x) + f_2(x)) = O((g_1(x) + g_2(x))$

But now my question is first am I right?

If so, then why the answer cannot be $O(\max(g_1(x),g_2(x)))$ ? For example, $O(n + \log(n)) = O(\max(n, \log(n))) = O(n)$

Thanks in advance.