Asymptotic notation (big O)

765 Views Asked by At

Asymptotic notations are a little vague for me at the moment. Here I have a problem that asks me if two equations are equal to each other, and it involves the big O notation. I wrote my question in the image in magenta color.

enter image description here

3

There are 3 best solutions below

4
On

The answer to your first question is in the definition of $O$-notation.
In fact, given $f,g$ functions, $f:=O(g)\Leftrightarrow \exists C\gt0$ such that $f(x) \le Cg(x)$ definitively.

In your case $2^{n+1}=2\cdot 2^n$, so take $C\ge2$ and by the definition written above you have $2^{n+1}=O(2^n)$.

For the second question, yes it is $\omega$-notation, and $4^n$ became $\omega(2^n)$ because the exercise asks you to see the asymptotic relation between $2^{2n}$ and $2^n$.

The definition of $\omega$-notation is: given two functions $f,g$, then $f:=\omega(g)\Leftrightarrow \lim_{n \to \infty}\frac fg = \infty$.
Note that $\lim_{n \to \infty}\frac {4^n} {2^n} = \infty$, so this is the answer to your second question.

0
On

You need to go to the definitions to understand what you are having trouble with.

The big O notation $f(n) \equiv 2^{n+1} = \mbox{ O}\left( 2^n \right)$ says "There is some real positive $C$ and natural number $n_0$ such that whenever $n>n_0$, $$|f(n)| < |C\cdot 2^n|$$ (Some definitions use $\leq$ instead of $<$; it makes no difference.)

For $f(n) \equiv 2^{n+1}$, we could use, for example, $n_0 = 1$ and $C = 3$ because
$$ 2^{n+1} = 2\cdot 2^n < 3 \cdot 2^n $$

For your second part, you need the definition of $\omega(f(n))$, which is nowhere near as standard and common as the big O notation. (The big omega notation, $\Omega(f(n))$, which says "There is some real positive $C$ and natural number $n_0$ such that whenever $n>n_0$, $|f(n)| > |C\cdot 2^n|$ is somewhat more common and familiar.)

From the context of the problem, the definition of the little omega notation is something like "$f(n) = \omega(g(n))$ iff there is some real positive $C$ and natural number $n_0$ and power $p > 1$ such that whenever $n>n_0$, $$|f(n)| < |C\cdot [g(n)]|^p$$

SO the last line is basically saming that $2^{2n}$ is $\omega(2^n)$ with $p=2$ in that definition.

0
On

Let's clear up the definition first. A function $f(n)$ defined on the positive integers $n$ is said to be $O(g(n))$, where for simplicity we assume $g(n)$ is nonzero, if $$ \left|{f(n) \over g(n)}\right| \leq \mbox{(some nonzero constant) $\quad$ for all $n$ starting with some specific $n_{0}$}. $$

That's the definition. Note that the value of the constant is unimportant: any positive constant will do.

If we first try $f(n) = 2^{n+1}$ and $g(n) = 2^{n}$, the above inequality is met for all $n \geq 1$.

Now, for $f(n) = 2^{2^{n}}$ and keeping $g(n) = 2^{n}$ we have: $$ {2^{2^{n}} \over 2^{n}} = {4^{n} \over 2^n}, $$ a ratio which is not bounded by a constant. So, $f(n)$ is not $O(g(n))$.

Note: $O(g(n))$ is not a specific function, but is a class of functions; namely, of those functions that grow "principally no faster than $g(n)$ does as $n \rightarrow \infty$."