How find this limit $\lim \limits_{x\to+\infty}e^{-x}\left(1+\frac{1}{x}\right)^{x^2}$ find this limit

$$\lim \limits_{x\to+\infty}e^{-x}\left(1+\dfrac{1}{x}\right)^{x^2}$$

my idea:
$$\lim \limits_{x\to+\infty}e^{-x}\left(1+\dfrac{1}{x}\right)^{x^2}=\lim \limits_{x\to+\infty}e^{-x}\cdot e^x=1$$
But book is answer is not 1? and How about find it? Thank you
 A: Since $\log(1+u)=u-\frac12u^2+o(u^2)$ when $u\to0$,
$$
x^2\log\left(1+\frac1x\right)-x=x^2\left(\frac1x-\frac12\frac1{x^2}+o\left(\frac1{x^2}\right)\right)-x=-\frac12+o(1),
$$
hence the limit you are after is $\mathrm e^{-1/2}$.

Note that your solution would be valid if one had
$$
\lim_{x\to\infty}\frac{\left(1+\frac1x\right)^{x^2}}{\mathrm e^x}=1,
$$
while in fact,
$$
\lim_{x\to\infty}\frac{\left(1+\frac1x\right)^{x^2}}{\mathrm e^{x-1/2}}=1.
$$

Still another take on the subject, using $O$ and $o$ Landau notations: a priori, your approach yields the estimate
$$
\left(1+\frac1x\right)^{x^2}=\mathrm e^{x+o(x)},
$$
which is not even enough to show the ratio you are interested in is bounded. Strengthening a little bit the estimate, one might wish to use
$$
\left(1+\frac1x\right)^{x^2}=\mathrm e^{x+O(1)},
$$
which does imply that the ratio you are interested in is bounded but not that it has a limit. What we did above is to show that
$$
\left(1+\frac1x\right)^{x^2}=\mathrm e^{x-1/2+o(1)},
$$
which does imply that the ratio you are interested in is bounded, and that it has a limit, and which identifies the limit.
A: You guess
$$
\lim \limits_{x\to+\infty}e^{-x}\left(1+\dfrac{1}{x}\right)^{x^2}=\lim \limits_{x\to+\infty}e^{-x}\cdot e^x=1
$$
But you should add  few more steps to see the mistake.  You could try
$$
\lim \limits_{x\to+\infty}e^{-x}\left(1+\dfrac{1}{x}\right)^{x^2}=
\left(\lim \limits_{x\to+\infty}e^{-x} \right)\left(\lim \limits_{x\to+\infty}\left(1+\dfrac{1}{x}\right)^{x^2}\right)
$$
but this has indeterminate form $0 \cdot \infty$, so you cannot just multiply these two factors.
