Approximation error of $e - (1+1/x)^x$. It is well known that $e = \lim_{x \rightarrow +\infty} (1+1/x)^x$, which means $\forall \epsilon > 0$, $\exists M>0$ such as $x > M \Rightarrow |(1+1/x)^x - e| < \epsilon$.
I would like to know what would be $M$ in function of $\epsilon$. I've made some attempts and it seems that $M = e/\epsilon$ works fine, but I could not prove it.
In other words, I'm interested in, given the maximum error tolerance $\epsilon$, after which point $M$, I can use $e$ instead of $(1+x)^x$.
 A: $\begin{array}\\
x\ln(1+1/x)
&=x(1/x-1/(2x^2)+1/(3x^3)+O(1/x^4))\\
&=1-1/(2x)+1/(3x^2)+O(1/x^3)\\
\text{so}\\
x\ln(1+1/x)-1
&=-1/(2x)+1/(3x^2)+O(1/x^3)\\
\text{so}\\
(1+1/x)^x/e
&=e^{x\ln(1+1/x)-1}\\
&=e^{-1/(2x)+1/(3x^2)+O(1/x^3)}\\
&=e^{-1/(2x)}e^{1/(3x^2)}e^{O(1/x^3)}\\
&=(1-1/(2x)+1/(8x^2)+O(1/x^3))(1+1/(3x^2)+O(1/x^4))(1+O(1/x^3))\\
&=1-1/(2x)+(1/8+1/3)/x^2+O(1/x^3)\\
&=1-1/(2x)+(11/24)/x^2+O(1/x^3)\\
\text{so}\\
(1+1/x)^x
&=e-e/(2x)+(11e/24)/x^2+O(1/x^3)\\
\text{so}\\
(1+1/x)^x-e
&=-e/(2x)+(11e/24)/x^2+O(1/x^3)\\
\end{array}
$
Note:
as is often the case
in my answers,
nothing original here.
Note 2:
Wolfy agrees and says that
$(1+1/x)^x-e
=-e/(2 x) + (11 e)/(24 x^2) - (7 e)/(16 x^3) + (2447 e)/(5760 x^4) + O((1/x)^5)
$.
A: Finally, I did it.
Let's use the classical inequality $\frac{x}{1+x} < \log(1+x) < x$ for $x > -1$. So, $\frac{1/x}{1+1/x} < \log(1+x) < 1/x$. Simplifying, $\frac{1/x}{1+1/x} = 1/(1+x)$.  Thus, $1/(1+x) < \log(1+1/x) < 1/x \Rightarrow x/(1+x) < x \log(1 + 1/x) < 1$.
As $\log(1 + \frac{1}{M}) > 0$, $1 < 1 + \log(1 + \frac{1}{M})$.
$x > M \Rightarrow 1/x < 1/M \Rightarrow 1+1/x < 1+1/M \Rightarrow 1/(1+1/x) > 1/(1+1/M) \Rightarrow x/(1+x) > M/(1+M)$.
Again, $\log(1+x) < x \Rightarrow \log(1-1/M) < -1/M \Rightarrow 1 + \log(1-1/M) < (M-1)/M < M/(1+M)$, since $(x-1)/x < x/(x+1)$.
Hence, $1 + \log(1-1/M) < M/(1+M) < x/(1+x) < x\log(1+1/x)$, and $x\log(1+1/x) < 1 < 1 + \log(1 + \frac{1}{M})$.
Finally,
\begin{align*}
        1 + \log(1-1/M) &< x\log(1+1/x) < 1 + \log(1 + \frac{1}{M}) \\
        e^{1 + \log(1-1/M)} &< e^{x\log(1+1/x)} < e^{1 + \log(1 + \frac{1}{M})} \\
        e \cdot e^{\log(1-1/M)} &< e^{\log((1+1/x)^x)} < e \cdot e^{\log(1 + \frac{1}{M})} \\
        e(1-1/M) &< (1+1/x)^x < e(1 + \frac{1}{M}) \\
        e-e/M &< (1+1/x)^x < e + e/M \\
        -e/M &< (1+1/x)^x - e < e/M \\
    \end{align*}
Therefore, $|(1+1/x)^x - e| < e/M$.
