Can a function exist that is both $o(g(n))$ and $\omega(g(n))$?

52 Views Asked by At

Can a function exist which is both $o(g(n))$ and $\omega(g(n))$?

Wouldn't this imply $$m |g(n)| \le |f(n)| \le k |g(n)| $$

If $f(n) = g(n)$ then wouldn't an arbitrary integer $m$ be greater than $f(n)$?

If $f(n) \ne g(n)$ wouldn't for $n$ sufficiently large the equality fail?

I want to make sure I'm thinking about this correctly.

2

There are 2 best solutions below

0
On

No. Little-o and Little-omega are strict inequalities. Big-O and Big-Omega are weak inequalities. So if $f(n) \in O(g(n))$ and $f(n) \in \Omega(g(n))$, then $f(n) \in \Theta(g(n))$.

Little-o states that $|f(n)| < c * |g(n)|$ (for some sufficiently large constant $c$, and all $n > n_{0}$). Little-omega is comparable, just use a strict greater-than inequality.

0
On

Use the definitions. Say $f$ and $g$ are positive.

$f$ is $o(g)$ means: for every constant $k>0$, for large enough $n$ we have $f(n) \le k g(n)$.

$f$ is $\omega(g)$ means: for every constant $m>0$, for large enough $n$ we have $f(n) \ge m g(n)$.

Now try $k=1/2, m=2$, for example. For large enough $n$ we have $$ 2 g(n) \le f(n) \le (1/2) g(n) $$ which is impossible for positive $g(n)$.