Big O - arithmetic rules

335 Views Asked by At

I need to prove the following statement: $O(f(n)g(n))=f(n)O(g(n))$ At first I thought the statement is false but apparently it is true. How can I prove it?

1

There are 1 best solutions below

8
On BEST ANSWER

All you want to show is that if $h\in \mathcal O(g)$ then $\tilde h$ defined by $$\tilde h(n) = f(n)\cdot h(n)$$ is an element of $\mathcal O(fg)$.
The converse needs a case distinction for $f(n) \ne0$ and $f(n) = 0$ to go through.