Show that $\lim_{n \to \infty} \left(1+\frac{a_n}{n}\right)^n= e^a$ when $a_n \to a$ I have seen a proof that shows
$$\lim_{n\to\infty} \left(1+\frac{x}{n}\right)^n = e^x$$
by looking at the Taylor series expansion of $\ln(1+x)$ at $x=0$.
To prove a theorem, my textbook uses the fact
$$\lim_{n \to \infty} \left(1+\frac{a_n}{n}\right)^n = e^a$$
when $a_n \to a$.
How can I prove this?
 A: We assume the facts

*

*$\lim_{n\rightarrow\infty}(1+\frac{x}{n})^{n}=e^{x}$ for any $x\in\mathbb{R}$.


*Exponential function $x\mapsto e^x$ is continuuous.

Suppose that $a_{n}\rightarrow a$. Let $\varepsilon>0$ be given.
Since the exponential function $x \mapsto e^x$ is continuous at $a$,
there exists $\delta>0$ such that $\left|e^{a}-e^{x}\right|<\varepsilon$
whenever $x\in(a-\delta,a+\delta)$. Since $a_{n}\rightarrow a$,
there exists $N_{1}\in\mathbb{N}$ such that $\left|a_{n}-a\right|<\frac{\delta}{2}$
whenever $n\geq N_{1}$. Choose $N_{2}\in\mathbb{N}$ such that $1+\frac{a-\delta/2}{n}>0$
whenever $n\geq N_{2}$. (This is possible because $1+\frac{a-\delta/2}{n}\rightarrow 1$
as $n\rightarrow\infty$.)
Choose $N_{3}\in\mathbb{N}$ such that $\left|\left(1+\frac{a+\delta/2}{n}\right)^{n}-e^{a+\delta/2}\right|<\varepsilon$
whenever $n\geq N_{3}$. Choose $N_{4}\in\mathbb{N}$ such that $\left|\left(1+\frac{a-\delta/2}{n}\right)^{n}-e^{a-\delta/2}\right|<\varepsilon$
whenever $n\geq N_{4}$. Let $N=\max(N_{1},N_{2},N_{3},N_{4})$. Let
$n\geq N$ be arbitrary, then we have
$$
a-\frac{\delta}{2}<a_{n}<a+\frac{\delta}{2},
$$
so
$$
0<1+\frac{a-\frac{\delta}{2}}{n}<1+\frac{a_{n}}{n}<1+\frac{a+\frac{\delta}{2}}{n}.
$$
Raising to the $n$-th power, we further have
$$
(e^{a}-\varepsilon)-\varepsilon<e^{a-\frac{\delta}{2}}-\varepsilon<\left(1+\frac{a-\frac{\delta}{2}}{n}\right)^{n}<\left(1+\frac{a_{n}}{n}\right)^{n}<\left(1+\frac{a+\frac{\delta}{2}}{n}\right)^{n}<e^{a+\delta/2}+\varepsilon<(e^{a}+\varepsilon)+\varepsilon.
$$
Hence, $\left|\left(1+\frac{a_{n}}{n}\right)^{n}-e^{a}\right|<2\varepsilon$.
This shows that $\left(1+\frac{a_{n}}{n}\right)^{n}\rightarrow e^{a}.$
A: You can try the following:
\begin{align*}
\lim_{n\to \infty}\left( 1+\frac{a_n}{n} \right)^n &= \lim_{n\to \infty}\left( 1+\frac{a}{n} + \frac{a_n-a}{n} \right)^n \newline
&= \lim_{n\to \infty}\left( 1+\frac{a}{n} \right)^n + \lim_{n\to \infty}\frac{a_n-a}{n}(\textit{something with finite limit}) \newline
&= e^a + 0 \newline
&= e^a
\end{align*}
To formalize this second line you can use Binomial Expansion.
A: Write$\left(1+\cfrac{a_n}{n}\right)^n$ as
$\left(\left(1+\cfrac{a_n}{n}\right)^{\cfrac{n}{a_n}}\right)^{\large{a_n}}$.
We know $\lim_{u\to \infty}\left(1+\dfrac1u\right)^u=e$. therefor $\lim_{n\to \infty}\left(1+\cfrac{a_n}{n}\right)^{\dfrac{n}{a_n}}=e$. and the original limit equal to $e^a$
Edit: As @DannyPak-KeungChan mentioned it is possible that value of $a$ be equal to $0$. in this case we should plug in this value in the original limit to get $\lim_{n \to \infty} \left(1+\frac{0}{n}\right)^n = 1=e^0$.
A: Sketch of proof:
Note that $|f_n(a_n) - f(a)| \leqslant |f_n(a_n) - f(a_n)| + |f(a_n) - f(a)|.$
Then use that $f_n(x) = \left(1+\frac{x}{n}\right)^n \to f(x) =e^x $  uniformly on any compact set (proved here) and the exponential function is continuous.
A: An approach that only uses binomial theorem and infinite geometric series.
Lemma: If $b_n$ is a sequence such that $nb_n\to 0,$ then $(1+b_n)^n\to 1.$
Proof: Since $nb_n\to 0,$ we can find $N$ so that $|nb_n|<1$ for $n>N.$
Then $(1+b_n)^n=\sum_{k=0}^{n}\binom{n}{k}b_n^k.$
So since $\binom nk\leq {n^k},$
We have for $n>N,$ $$|g_n^n-1| \leq \sum_{k=1}^n|nb_n|^k \leq \sum_{k=1}^\infty|nb_n|^k =\frac{|nb_n|}{1-|nb_n|}.$$
The right side goes to $0$ as $n\to\infty,$ so the Lemma is done.

Now, let:
$$b_n=\frac{1+\frac{a_n}n}{1+\frac an}-1=\frac{a_n-a}{n+a}.$$
Then $nb_n\to 0,$ since $\frac{n}{n+a}\to 1$ and $a_n-a\to 0.$
So, by the lemma: $$(1+b_n)^n=\left(\frac{1+\frac{a_n}n}{1+\frac an}\right)^n\to1$$
But this means $$\lim_{n\to\infty}\left(1+\frac{a_n}n\right)^n=\lim_{n\to\infty} \left(1+\frac{a}n\right)^n=e^a$$

Essentially, the lemma is the case $a=0.$ Then $b_n=a_n/n.$
This is a rewrite of an old answer of mine, which also shows how you can use this lemma to prove $e^{i\theta}=\cos(\theta)+i\sin(\theta).$
