Prove $f_1(n) * f_2(n) = O (g_1(n)*g_2(n))$

370 Views Asked by At

Prove $$f_1(n) * f_2(n) = O (g_1(n)*g_2(n))$$

Given: $f_1(n) = O(g_1(n)) , f_2(n) = O(g_2(n))$

So I started by saying:

$\exists n_0,c_1 , \forall n \gt n_0 : f_1(n) \le c_1\cdot g1(n)$

$\exists n_1,c_2 , \forall n \gt n_1 :f_2(n) \le c_2\cdot g2(n)$

Then,

$\forall n \gt max\{n_0,n_1\}: f_1(n)\cdot f_2(n) \le c_1\cdot g_1(n) \cdot c_2\cdot g_2(n) \le c_1c_2 \cdot max\{g_1(n),g_2(n)\}$

From $max\{n_0,n_1\}$ I take $n_0$ for example, and $c = c_1c_2$

Does this proof works?

Taken from Introduction to Algorithms 2nd book.

Answer: (After fix)

$\forall n \gt max\{n_0,n_1\}: f_1(n)\cdot f_2(n) \le c_1\cdot g_1(n) \cdot c_2\cdot g_2(n) \le c_1c_2 \cdot max\{g_1(n) \cdot g_2(n)\}$