TITLE: Value of $\lim_{n\to\infty}{(1+\frac{2n^2+\cos{n}}{n^3+n})^n}$
QUESTION [11 upvotes]: How should one go about computing $$\lim_{n\to\infty}{\left(1+\frac{2n^2+\cos{n}}{n^3+n}\right)^n}\quad?$$ What surprised me about this is that 
$$\lim_{n\to\infty}{\left(1+\frac{2n^2+\cos{n}}{n^3+n}\right)^\frac{n^3+n}{2n^2+\cos{n}}}=1$$(according to wolfram), instead of $e$, which is what I expected. Could someone comment on that also?

REPLY [5 votes]: Lets consider the more general case of an arbitrary function.  Then we have the following theorem:
Theorem: Given a function $g(n)$ such that $g_0=\lim_{n\rightarrow \infty} g(n)$ exists, we have $$\lim_{n\rightarrow \infty }\left(1+\frac{g(n)}{n}\right)^n=e^{g_0}.$$ 
Example: In particular, for your above question, $g(n)=\frac{2n^2+\cos(n)}{n^2+1}$, so that $g_0 =2$, and hence the value of the original limit is $e^2$.
Proof of theorem:  Let $f(n)=\frac{g(n)}{g_0}$ so that  $f(n)=1+o(1)$.  Then since $\lim_{n\rightarrow \infty} \left(1+\frac{a}{n}\right)^n=e^a$ we see that $$\lim_{n\rightarrow \infty} \left(1+\frac{g(n)}{n}\right)^\frac{n}{f(n)}=e^{g_0}.$$  Then, because  $f(n)=1+o(1)$, it follows that $\frac{n}{f(n)}=n+o(n)$.  But, $$\lim_{n\rightarrow \infty} \left(1+\frac{O(1)}{n}\right)^{o(n)}=1,$$ so we conclude that $$\lim_{n\rightarrow \infty }\left(1+\frac{g(n)}{n}\right)^n=e^{g_0}.$$
I hope that helps,