# Estimating the error for \$e-(1+frac 1n)^n\$

I would like to estimate the error \$e-(1+frac 1n)^n\$, for arbitrary \$n ge 0\$. I think I have found a way to do it, but it does not really seem optimal to me. Here is what I did:

I considered the function \$f : [0,frac 1n]\$, \$f(0) = (1+frac 1n)^n\$ and \$f(x) = e^{nx}+(1+frac 1n)^n-(1+x)^{frac 1 x} \$

This function is continuous and I have \$exists theta in left(0,frac 1 nright ): \$

\$\$ e-(1+frac 1n)^n=f left (frac 1nright ) – f(0) = frac 1 n f'(theta) \$\$

by the mean value theorem. However, \$f'(theta)\$ seems a bit too complicated. I tried simplifying it and bounding it from above, involving \$n\$, but it does not simplify a lot.

Any hints on maybe choosing another function that allows a smoother estimation? Help would be greatly appreciated!

## Answer

Let \$x=frac{1}{n}\$. Then \$(1+frac{1}{n})^n=(1+x)^{frac{1}{x}}\$. Take the logarithm to get

\$\$lnleft[(1+x)^{frac{1}{x}}right]=frac{ln(1+x)}{x}=1-frac{x}{2}+frac{x^2}{3}-cdots+frac{(-x)^n}{n+1}+cdots.\$\$

Exponentiate back to get

begin{align}
left(1+frac{1}{n}right)^n&=eexpleft(-frac{x}{2}+frac{x^2}{3}-cdots+frac{(-x)^n}{n+1}+cdotsright)\
&=eleft(1-frac{1}{2n}+frac{11}{24n^2}-frac{7}{16n^3}+cdotsright),quad
ngg 1.
end{align}