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?

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.
