TITLE: How to solve this limit: $\lim\limits_{x \to 0}\left(\frac{(1+2x)^\frac1x}{e^2 +x}\right)^\frac1x$
QUESTION [7 upvotes]: $$\lim\limits_{x \to 0}\left(\frac{(1+2x)^\frac{1}{x}}{e^2 +x}\right)^\frac{1}{x}=~?$$
Can not solve this limit, already tried with logarithm but this is where i run out of ideas. Thanks.

REPLY [2 votes]: All such limits can be mechanically computed easily using asymptotic expansions. One should not use L'Hopital unless it is obvious that it works well.
$
\def\lfrac#1#2{{\large\frac{#1}{#2}}}
\def\wi{\subseteq}
$
The complete solution produced by the mechanical computation is as follows.

As $x \to 0$:
 
 $\Big(\lfrac{(1+2x)^{1/x}}{e^2+x}\Big)^{1/x}$
 $= \Big(\lfrac{\exp(\lfrac1x\ln(1+2x))}{e^2+x}\Big)^{1/x}$
 $\in \Big(\lfrac{\exp(\lfrac1x(2x-2x^2+O(x^3)))}{e^2+x}\Big)^{1/x}$
 
 $= \Big(\lfrac{\exp(2-2x+O(x^2))}{e^2+x}\Big)^{1/x}$
 $= e^{-2} \Big(\lfrac{\exp(O(x^2))}{1+e^{-2}x}\Big)^{1/x}$
 $\wi e^{-2} \Big(\lfrac{1+O(x^2)}{1+e^{-2}x}\Big)^{1/x}$
 
 $\wi e^{-2} \Big((1+O(x^2))(1-e^{-2}x)\Big)^{1/x}$
 $\wi e^{-2} \Big(1-e^{-2}x+O(x^2)\Big)^{1/x}$
 
 $= e^{-2} \exp\!\Big(\lfrac1x\ln(1-e^{-2}x+O(x^2))\Big)$
 $\wi e^{-2} \exp\!\Big(\lfrac1x(-e^{-2}x+O(x^2))\Big)$
 
 $= e^{-2} \exp(-e^{-2}+O(x))$
 $= e^{-2-e^{-2}} \exp(O(x))$
 $\wi e^{-2-e^{-2}}(1+O(x))$
 
 $= e^{-2-e^{-2}}+O(x)$.

The two asymptotic expansions used in the above solution are:

$\exp(x) \in 1+O(x)$ if $x \in o(1)$.
$\ln(1+x) \in x+\lfrac1{2}x^2+O(x^3)$ if $x \in o(1)$.

One question is how I know how many terms of the asymptotic expansions to use. The answer is I do not know in advance. I just start with using the first two terms, and if at some point I cannot simplify due to the terms cancelling and leaving only asymptotic classes, then I trace where those remaining terms arose from and increase the number of terms in previous asymptotic expansions where needed. This is a mechanical process and is actually used in computer algebra systems to find such limits.