Calculating a limit with trigonometric and quadratic function 
$$\lim_{n->\infty}\left(1+{1\over{n^2+\cos n}}\right)^{n^2+n}$$

I vaguely get the idea that since $\cos n$ and $n$ dont really matter compared to $n^2$, this must evaluate to $e$. But not sure how to prove this. Further do all the limits of form $$\lim_{n->\infty}\left(1+{1\over{n^2+f(n)}}\right)^{n^2+g(n)}$$
evaluate to e given that $f'(x),g'(x)<2x;\forall x>0$?
 A: $$\lim_{n->\infty}\left(1+{1\over{n^2+\cos n}}\right)^{n^2+n}=\lim_{n->\infty}\left[\left(1+{1\over{n^2+\cos n}}\right)^{n^2+\cos n}\right]^{\frac{n^2+n}{n^2+\cos n}}$$
and
$$\frac{n^2}{n^2+1}\le\frac{n^2+n}{n^2+\cos n}\le\frac{n^2+n}{n^2-1}$$
A: Note that
$$\left(1+{1\over{n^2+\cos n}}\right)^{n^2+n}=\left[\left(1+{1\over{n^2+\cos n}}\right)^{n^2+\cos n}\right]^{\frac{n^2+n}{n^2+\cos n}}$$
For the general case, with the same argument we have that
$$\lim_{n->\infty}\left(1+{1\over{n^2+f(n)}}\right)^{n^2+g(n)}=e$$
when


*

*$n^2+f(n)\to \infty$

*$\frac{n^2+g(n)}{n^2+f(n)}\to1$

A: Taking $\log$ and using a well-known equivalence:
$$
\log\lim_{n\to\infty}\left(1 + {1\over{n^2 + \cos n}}\right)^{n^2+n} =
\lim_{n\to\infty}\log\left(1 + {1\over{n^2 + \cos n}}\right)^{n^2+n} =
$$
$$
\lim_{n\to\infty}(n^2 + n)\log\left(1 + {1\over{n^2 + \cos n}}\right) =
\lim_{n\to\infty}\frac{n^2 + n}{n^2 + \cos n} =
\lim_{n\to\infty}\frac{1 + 1/n}{1 + (\cos n)/n^2} = 1,
$$
so
$$\lim_{n\to\infty}\left(1 + {1\over{n^2 + \cos n}}\right)^{n^2+n} = e.
$$
