[Math] Big $O$ notation proof: $f(n) = (n^5)(\log n)$ and I need to prove it is $O(n^7)$

asymptoticscomputational complexity

I'm having trouble wrapping my head around this.
I have a function $f(n) = (n^5)(\log n)$ and I need to prove it is $O(n^7)$

I thought $n^5$ was the most significant term in this function so it should be $O(n^5)$, I don't know where $O(n^7)$ came from, it's not making sense to me.

Can anyone point me in the right direction?

Best Answer

First and foremost, $O$ is about giving an upper bound. Thus if you think it is $O(n^5)$ then it is also $O(n^7)$ and $O(n^6)$ and $O(n^{5.1})$ and $O(n^{2483624})$.

Second, it is not $O(n^5)$ as you cannot just ignore the logarithmic term there.

What you want to show is that there is a $C>0$ such that for all naturals $n$ (or for all sufficiently large $n$ it does not matter that much) you have $$n^5 \log n \le Cn^7.$$ This is true with $C=1$, as $\log n \le n$ for all $n \ge 1$ and thus $$ n^5 \log n \le n^5 n = n^6 \le n^7.$$

As you see the expression would also be $O(n^6)$, so the $n^7$ is indeed a bit arbitrarily chosen but its true. Just like $56$ is less than $60$ and also less than $70$.

Related Question