I saw this in this lecture : Asymptotic Notation at the 15 minute mark. But I don't understand it. And also why does $f_{2}(n) = 2n^3 + 3n + 79 \in\theta(n^3)$? I don't understand the proof.
-
Are you comfortable with limits? – Mark Schultz-Wu Aug 17 '16 at 05:13
-
@jimpix The title isn't supposed to be used as the first line of your question. – Git Gud Aug 17 '16 at 05:16
-
Can you find positive $k_1,k_2,N$ such that $k_1\cdot n^3 \leq 10n^3+5n^2+17\leq k_2\cdot n^3$ for all $n\geq N$? We don't care about finding the smallest or tightest... we can be very relaxed about it. How about $k_1=1$ and $k_2=32$ and $N=1$? Does that work? What does that imply? – JMoravitz Aug 17 '16 at 05:17
-
Out of curiousity, the lecturer already does a good job of explaining the definition of $\Theta$-assymptotic notation. What specifically don't you understand about his explanation? If you don't specify that, all answers you are likely to receive will be essentially the same as the one you already have available (and are probably going to be less detailed). – JMoravitz Aug 17 '16 at 05:25
1 Answers
Until you specify what exactly you don't understand from the video's explanation, I will recap the definitions here.
We say that a function $f(n)$ is assymptotically bounded both above and below by a function $g(n)$ if and only if there exist positive real numbers $k_1,k_2$ and $N$ such that for all $n\geq N$ we have $$k_1\cdot g(n)\leq f(n)\leq k_2\cdot g(n)$$
If so, then we write it with symbols as $f(n)=\Theta(g(n))$
Informally, we can think of it as though the functions $f$ and $g$ both "grow at the same speed" relatively speaking. A function like $n^2$ grows much faster than a function like $n$, but they are both dwarfed by a function like $n^3$. On the other hand, a function like $2^n$ grows much faster than the others so far, but that is childs play compared to $3^n$ which is itself nothing compared to $3^{(3^n)}$ which is itself nothing compared to $\underbrace{n^{n^{.^{.^{.^{n}}}}}}_{n~\text{times}}$. Even bigger and bigger functions can be made. So, when two "act pretty much the same" we like to know it and label it as such.
In the examples, we wish to show that $\color{purple}{10n^3+5n^2+17} = \Theta(\color{green}{n^3})$. That is to say, we want to know if there is some point at which $\color{green}{n^3}$ times some positive constant $\color{red}{k_1}$ will always be smaller than $\color{purple}{10n^3+5n^2+17}$, and we also want to know if there is some point at which $\color{green}{n^3}$ times some positive constant $\color{blue}{k_2}$ will always be bigger than $\color{purple}{10n^3+5n^2+17}$.
We see that for all positive $n$ (i.e. for all $n\geq 1$) one has:
$$\color{red}{1}\cdot \color{green}{n^3}\leq 10n^3\leq \color{purple}{10n^3+5n^2+17}\leq 10n^3+5n^3+17n^3\leq \color{blue}{32}\cdot\color{green}{n^3}$$
Indeed, the inequality holds (it doesn't even require induction to prove). Letting $k_1=1, k_2=32,$ and $N=1$, this shows that $10n^3+5n^2+17$ satisfies the definition given above for $10n^3+5n^2+17=\Theta(n^3)$.
Very informally, this should be immediately apparent as the "biggest part" of $10n^3+5n^2+17$ is a constant multiple of $n^3$. In general, if you have several things being added, you can ignore all of them except the "fastest growing piece" and compare that way. For example, I know without having to check formally that $34n^7+10n^2-5+\frac{1}{n}$ is in fact asymptotically bounded above and below by $n^7$. Similarly I know that $34n^7+10n^2-5+\frac{1}{n}$ is not asymptotically bounded above and below by $n^2$ (since the $34n^7$ piece grows much faster than $n^2$ ever could).
-
-
1@jimpix then please very specifically tell me what you don't understand about it and I can try to help you understand. Do you understand that $n^3\leq 10n^3$? Do you understand that $10n^3\leq 10n^3+5n^2+17$? Do you understand that $5n^2\leq 5n^3$? Do you understand that $17\leq 17n^3$? Do you understand that $10n^3+5n^2+17\leq 10n^3+5n^3+17n^3$? Do you understand that $10n^3+5n^3+17n^3=32n^3$? – JMoravitz Aug 17 '16 at 11:09
-
@jimpix If you are confused as to why I chose the numbers $1$ and $32$ for $k_1$ and $k_2$ respectively, the answer is that I didn't have to. I could have chosen literally any number so long as $k_1$ was less than or equal to $10$ and $k_2$ was strictly more than $10$. I would have to use more careful analysis in order to figure out what $N$ would have to be in those cases. $1$ and $32$ happened to be very convenient because I could use very common tricks to compare the totals (ignoring terms and changing terms to larger order). Just saying you don't understand doesn't help us teach. – JMoravitz Aug 17 '16 at 11:12