Show that this sequence of functions converges uniformly to $e^{-x}$ Define
$$
f_n(x)=
\begin{cases}
\left(1-\frac xn\right)^n & 0\le x<n \\
0 & x\ge n
\end{cases}
$$
I am able to show that $f_n(x)\to e^{-x}$ pointwise on $[0,+\infty)$, and I wonder if my justification for uniform convergence is valid:
By properties of logarithm, I transformed the sequence into
$$
\left(1-\frac xn\right)^n=\exp\left\{n\log\left(1-\frac xn\right)\right\}
$$
Employing the fact that for sufficiently large $n$
$$
\left|n\log\left(1-\frac xn\right)+x\right|=\left|n\left[-\frac xn+\mathcal O\left(1\over n^2\right)\right]+x\right|=\mathcal O\left(\frac1n\right)
$$
we have $n\log\left(1-\frac xn\right)\to-x$ uniformly, hence for each $\delta>0$ there exists an $N$ such that for all $n>N$:
$$
|\log f_n(x)+x|<\delta
$$
By the uniform continuity of the exponential function, for all $\varepsilon>0,x>0,y>0$, we have $|e^{-x}-e^{-y}|<\varepsilon$ whenever $|x-y|<\delta$. As a result let $y$ be $-\log f_n(x)$, so  for all $\varepsilon>0,x>0$ there exists an $N$ such that for all $n>N$
$$
|f_n(x)-e^{-x}|<\varepsilon
$$
I wonder if this proof is correct or please point out my mistake. Thank you all!
 A: Your proof is not valid. Your estimates are valid only for fixed $x$ and there is no uniformity. In particular $n \log (1-\frac x n) $ does not tend to $-x$ uniformly: If $|n log (1-\frac x n) +x| <\epsilon $ for $n \geq n_0$ and for all $x <n$ you get a contradiction by letting $x \to n$.
Hint for  a valid proof: Choose $T$ such that $x>T$ implies $e^{-x} <\epsilon$. Note that $0 \leq f_n(x)\leq e^{-x} <\epsilon$ for all $n$ if $x>T$. So it is enough to consider $\sup_{x \leq T} |f_n(x)-e^{-x}|$ and here your approach can be used.
A: I think you need to look closer at what's going on in the Taylor series. You can clean up the argument that $f_n(x):=n\log\left(1-\frac{x}{n}\right) \to -x$ uniformly, but this only works if $x\leq M$ for some $M>0$. To see this:
By Taylor's theorem, we know
$$
f_n(x/n)=n\underbrace{f_n(0)}_{=0}+\underbrace{f_n'(0)}_{=-1}x+\frac{f_n''(c)}{2}\left(\frac{x^2}{n}\right)
$$
for some $c$ between $0$ and $x/n$. Hence,
\begin{align}
|f_n(x/n)+x|\leq \left|\frac{f_n''(c)}{2}\right|\left(\frac{|x|^2}{n}\right)\leq \left|\frac{f_n''(c)}{2}\right|\left(\frac{M^2}{n}\right).
\end{align}
An easy calculation shows $f_n'(x)=\frac{-n}{1-\frac{x}{n}},\, f_n''(x)=\frac{-1}{(1-\frac{x}{n})^2}$. Now if $x$ is not demanded to be bounded above by some $M>0$ independent of $n$,  then clearly $f_n''(c)$ is unbounded. However, with this demand, we have
$$
|f_n''(c)|\leq \frac{1}{(1-\frac{M}{n})^2}\leq C<\infty
$$
From here, your argument about the exponential being uniformly continuous allows you to assert that $e^{f_n(x)} \to e^{-x}$ uniformly on $[0,M]$.
Finally, given $\epsilon>0$, pick $M$, such that $e^{-x}<\epsilon$ for all $x>M$. Then for sufficiently large $n$, it is obvious that we have uniform convergence.
