Riemann Sum for $e^x$ in a generic interval $\newcommand{\e}{\text{e}}$
I want to represent $\displaystyle \int^b_a \e^x dx$ as a Riemann sum. So for $\Delta x$ we have $\frac{b - a}{n}$ and for $x_i$ we have $a + i \Delta x = a + i \frac{b - a}{n}$
Thus we obtain by putting in the value into the formula $\displaystyle \int^b_a f~ dx = \lim_{n \to \infty} \sum^n_{i=0} f(x_i) \Delta x$ that
\begin{align}
\displaystyle \int^b_a \e^x dx & = \lim_{n \to \infty} \sum^n_{i=0} \e^{a + i \frac{b - a}{n}} \frac{b - a}{n}\\
                               & = \lim_{n \to \infty} \sum^n_{i=0} \e^a \cdot \e^{ i \frac{b - a}{n}} \frac{b - a}{n}\\
                               & = \lim_{n \to \infty} \e^a \sum^n_{i=0} \e^{ i \frac{b - a}{n}} \frac{b - a}{n}\\
                               & = \e^a \lim_{n \to \infty}  \frac{b - a}{n} \sum^n_{i=0} \e^{ i \frac{b - a}{n}}\\
                               & = \e^a \lim_{n \to \infty}  \frac{b - a}{n} \sum^n_{i=0} \left(\e^{ {\frac{b - a}{n}}}\right)^i\\
                               & \text{Noticing that this is a geometric series with a common factor of $\e^{ \frac{b - a}{n}}$}\\ &\text{we can rewrite this as}\\
                               & = \e^a \lim_{n \to \infty}  \frac{b - a}{n} \frac{1}{1 - \e^{ \frac{b - a}{n}}}\\
                               & = \e^a \lim_{n \to \infty}  \frac{b - a}{n(1 - \e^{ \frac{b - a}{n}})}\\
                               & = \e^a \lim_{n \to \infty}  \frac{b - a}{n(1 - \e^0)}\\
                               & = \e^a \lim_{n \to \infty}  \frac{b - a}{0}\\ 
\end{align}
Which is of course incorrect. I am not sure of the step where te sum is transformed into the closed form, as the $n$ is both part of the terms summed over as well as the variable of the limit. Other than potentially that I fail to spot an algebraic mistake though, which makes me assume I have a false understanding of how the Riemann Sums needs to be constructed. Is that the case?
 A: Indeed, your major mistake is in transforming the sum into closed form. The sum is finite so you should use the formula for a finite geometric series and then take the limit. Namely,
$$ \frac{b - a}{n} \sum_{i=0}^n \left( e^{\frac{b - a}{n}} \right)^i = \frac{b-a}{n} \frac{\left( e^{\frac{b - a}{n}} \right)^{n+1} - 1}{e^{\frac{b - a}{n}} - 1} = \left( e^{b - a} e^{\frac{b - a}{n}} - 1 \right) \frac{\frac{b - a}{n}}{e^{\frac{b - a}{n}} - 1} \to e^{b - a} - 1 $$
and combining it with the $e^a$ factor you'll get the correct answer. Here, we used the limit
$$ \lim_{x \to 0} \frac{x}{e^x - 1} = 1 $$ 
which can be computed using L'Hôpital.
A: Part of the problem is that $\lim_{n \to \infty} n \left ( 1 - e^{\frac{b-a}{n}} \right )$ is not $0$. This is a $\infty \cdot 0$ indeterminate form. Accordingly, you have two main options for computing it:


*

*Move either $n$ or $1-e^{\frac{b-a}{n}}$ into the denominator, obtaining a $0/0$ or $\infty/\infty$ form respectively. Then use L'Hospital's rule.

*Move $n$ into the denominator, at which point you have $\lim_{n \to \infty} \frac{1-e^{\frac{b-a}{n}}}{\frac{1}{n}}$. Introduce $h=1/n$, then you have $-\lim_{h \to 0} \frac{e^{(b-a)h}-1}{h}$ which is exactly in the form of a derivative.


The two are really the same. I only mention both because some people don't like using L'Hospital's rule in problems that can be easily rearranged into the definition of the derivative (because this leads to logical issues, like circular proofs of $\lim_{x \to 0} \frac{\sin(x)}{x}=1$).
The other main part of the problem is that $\lim_{n \to \infty} \sum_{i=0}^n \left ( e^{\frac{b-a}{n}} \right )^i$ can't be treated using the infinite geometric series formula, because the base depends on $n$ (and, for that matter, is $>1$ for all finite $n$). Accordingly it should really be treated using the finite geometric series formula, at which point you find yourself doing a similar manipulation to what I described above.
A much more minor problem is that all your sums should really end at $n-1$, or else start at $1$.
