Calculating a limit with trigonometric and quadratic function

$$\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}$$


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$