'How to show that f(n)*g(n) = O(f(n)*g(n))

the exact question :

let a(n) = f(n) and b(n) = g(n).

How to prove that a(n)*g(n) = O(f(n)*g(n))

I started by assuming : a(n) = n and b(n) = n , so based on my (hopefully reasonable) assumption i have to prove that n^2 = O(n^2).



Solution 1:[1]

If you assume that a(n) = n, then your proof will only work for that special case, not in general for all functions a(n).

I would motivate it like this: a(n) * b(n) is a function too, let us call it c(n).

We know that for any function, c(n) = O(c(n)).

Therefore it follows that c(n) = O(a(n) * b(n)) = O(f(n) * g(n)).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Berthur