How is it posible that $f + g \in O(f)$?

100 Views Asked by At

I am confused how to do this question. Intuitively it doesn't even make sense how a function $f$ plus another function is in $O(f)$. How can I approach this question: $$ n\log(n^7)+n^{\frac{7}{2}} \in O(n^{\frac{7}{2}}). $$

We know the fact that $\log n < n$ and I tried factoring out the $n$ but I am stuck. Any hints would be appreciated, Thanks!

2

There are 2 best solutions below

1
On

The easiest way is to take the limit: $\frac{n^{\frac{7}{2}}+7 n \log n}{n^{\frac{7}{2}}} \to_n 1$, hence these two functions are of the same order.

0
On

Actually, this shouldn't be too terribly surprising. Indeed, if $g \in O(f)$, then it is always true that $f + g \in O(f)$. To see this, note that since $g \in O(f)$, there exists $n_0, C > 0$ such that for all $n > n_0$, $g(n) \leq Cf(n)$, by definition. Therefore, for all $n > n_0$, $(f+g)(n) = f(n) + g(n) \leq (C+1)f(n)$, which shows that $f + g \in O(f)$,

Intuitively, this makes sense. If $g$ does not grow faster than $f$ asymptotically, then $f + g$ shouldn't grow any faster than $2f$ asymptotically. But that is a constant multiple of $f$, so it has the same asymptotic order. Note that $C = 2$ isn't the correct constant to use, since $g$ may already be larger than $f$ by some constant, but the idea is the key. You may add any finite number of functions that are $O(f)$ to $f$ without making its asymptotic growth any larger.

For your particular problem, write $n\log(n^7) = 7n\log(n)$ and then note that $7n\log(n) \leq 7n^2 \leq 7n^{7/2}$ using the fact that $\log(n) < n$. Therefore, for all $n > 0$,

$$ n\log(n^7) + n^{7/2} \leq 7n^{7/2} + n^{7/2} = 8n^{7/2}, $$

which shows that $n\log(n^7) + n^{7/2} \in O(n^{7/2}).$