<s>[INST] Error analysis of exponential function By definition: $$ e^x = \lim_{n \rightarrow \infty} ( 1 + \frac{x}{n} ) ^ n$$
I am interesting in calculating the error $$\left | e^x - \left( 1 + \frac{x}{n} \right) ^ n \right|$$ for some fixed $n \in \mathbb{N}$.
What I've done so far:
First note:
$$e^x = \sum_{k = 0}^\infty \frac{x^k}{k!} = 1 + x + \frac{x^2}{2!} + \dots \frac{x^n}{n!} + O\left(\frac{1}{(n+1)^{(n+1)}}\right)$$ and  
$$\left( 1 + \frac{x}{n} \right) ^ n  = \sum_{k = 0}^n {n \choose k} \frac{x^k}{n^k} = 1 + x + \frac{x^2}{2!}\left(1 - \frac{1}{n} \right) + \dots + \frac{x^n}{n!}\left(1 - \frac{1}{n} \right) \dots \left(1 - \frac{n-1}{n} \right)$$
Subtracting term by term yields $$\frac{x^2}{2!}\left(\frac{1}{n} \right) + \frac{x^3}{3!}\left(\frac{3}{n} - \frac{2}{n^2}\right) + \frac{x^4}{3!}\left(\frac{6}{n} - \frac{11}{n^2} + \frac{6}{n^3}\right) + \dots + O\left (\frac{1}{(n+1)^{(n+1)}}\right)$$
Where can I got from here? I want to be able to calculate the exact difference, and I don't think the expression above is good enough for that task.
Any help would be highly appreciated.    
 [/INST] I take a simple-minded approach: whenever practical, write the Taylor formula with Lagrange form of remainder. Since $(1+x/n)^n=\exp(n \ln(1+x/n))$, I begin with the logarithm:
$$
\ln(1+x/n) = \frac{x}{n}+\frac{(x/n)^2}{2}\frac{-1}{(1+\xi)^2} 
\tag{1}$$
where $\xi$ is between $0$ and $x/n$. Formula (1) is      Taylor's formula applied to $t\mapsto \ln(1+t)$. 
So, 
$$
(1+x/n)^n = e^x \exp\left(-\frac{x^2}{2n} \frac{1}{(1+\xi)^2}\right)
\tag{2}$$
which is already a reasonable error estimate. When $x>0$, it can be brought into the form you seek without too much sweat. Since $\xi>0$  in (2), we have 
$$
0<e^x-(1+x/n)^n < e^x(1-e^{-x^2/(2n)})   
\tag{3}$$
Use the Mean Value theorem (i.e., the simplest form of the   Lagrange  remainder formula): 
$$
1-e^{-x^2/(2n)} = \frac{x^2}{2n} e^{-\zeta},\quad 
0<\zeta<\frac{x^2}{2n}
\tag{4}$$
Hence, the conclusion: for $x>0$, 
$$
0<e^x-(1+x/n)^n < \frac{x^2}{2n}e^x
\tag{5}$$
Of course, (5) is not telling us anything new when $x^2>2n$. But it correctly shows that $x^2/n$ is what determines the quality of approximation. This quadratic relation is visible on the spreadsheet below, where I calculated the difference $e^x-(1+x/n)^n$ and colored the cells where the difference is at least $1$.

</s>