Big O notation: ratio of two $O(\cdot)$'s is $O(\cdot)$ of the ratio?

362 Views Asked by At

Is it true that if $f_1=O(g_1)$ and $f_2=O(g_2)$ then $$\frac{f_1}{f_2}=\frac{O(g_{1})}{O(g_{2})}=O\!\left(\frac{g_1}{g_2}\right)$$ ?

2

There are 2 best solutions below

0
On

No, you would need $\Omega(\cdot)$ for $f_2$. Intuitively: you need an upperbound (i.e., $O(\cdot)$) for the numerator, but a lower bound (i.e., $\Omega(\cdot)$) for the numerator to get the "inequality" you want for the fraction (i.e., $O(\cdot)$).

Counterexample: Take $f_1(x)=g_1(x)=g_2(x)=x$, $f_2(x)=1$. Then $\frac{f_1(x)}{f_2(x)} = x = \omega\left(\frac{g_1(x)}{g_2(x)}\right)$, since $\frac{g_1(x)}{g_2(x)}=1$.

1
On

As a comment Clement C.'s solution, this holds if $f_1 = \Theta(g_1)$ and $f_2 = \Theta(g_2)$ or $f_1 \sim g_1$ and $f_2 \sim g_2$. In other words, this example shows the difference and importance of $O(\cdot)$ and $o(\cdot)$.