Computing $\int_0^\pi \sin(x) \; dx$ using the definition. A colleague of mine and I, in the course of teaching integral calculus for the umpteenth time, were wondering if we could expand the class of examples that our students are exposed to when computing Riemann integrals from the definition. Most such examples involve polynomial functions, and they work nicely because we have some well-known formulas, like
$\displaystyle\sum_{i=1}^n 1 = n$,
$\displaystyle\sum_{i=1}^n i = \frac{n(n+1)}{2}$,
and $\displaystyle\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}$. (And certainly, there are others.)
But we wanted to expand the class of examples beyond polynomial functions, and started to think about trig functions. We came up with a computation for $\int_0^\pi \sin(x)\;dx$ using the definition of the Reimann integral, which I provide below.
Question: Is the computation below in the literature somewhere? If so, where?
Computation:
Using a Riemann sum with right endpoints, we have
$$\int_{0}^\pi \sin(x)\; dx = \lim_{n \to \infty}\sum_{i=1}^n \sin(x_i) \Delta x$$
where $\Delta x = \frac{\pi}{n}$ and $x_i = i\Delta x$.
The trick is to rewrite the Riemann sum $\sum_{i=1}^n \sin(x_i) \Delta x$ as a telescoping sum using the difference of cosines identity:
$$\cos(b) - \cos(a) = 2 \sin\left(\frac{a+b}{2}\right)\sin\left(\frac{a-b}{2}\right)$$
Setting $a = \frac{2i+1}{2}\Delta x$ and $b = \frac{2i-1}{2}\Delta x$ yields
$$\cos\left(\frac{2i-1}{2}\Delta x\right) - \cos\left(\frac{2i+1}{2}\Delta x\right) = 2 \sin\left(i \Delta x\right) \sin\left(\frac{\Delta x}{2}\right)$$
Solving for $\sin(i \Delta x)$ gives
$$\sin(i \Delta x) = \frac{\cos\left(\frac{2i-1}{2}\Delta x\right) - \cos\left(\frac{2i+1}{2}\Delta x\right)}{2 \sin\left(\frac{\Delta x}{2}\right)}$$
The Riemann sum now is
$$\sum_{i=1}^n \sin(i \Delta x) \Delta x = \frac{\frac{\Delta x}{2}}{\sin\left(\frac{\Delta x}{2}\right)} \sum_{i=1}^n \left[\cos\left(\frac{2i-1}{2}\Delta x\right) - \cos\left(\frac{2i+1}{2}\Delta x\right)\right]$$
The latter sum is telescoping, and so
$$\sum_{i=1}^n \sin(i \Delta x) \Delta x = \frac{\frac{\Delta x}{2}}{\sin\left(\frac{\Delta x}{2}\right)}\left[ \cos\left(\frac{\Delta x}{2}\right) - \cos\left(\frac{2n+1}{2}\Delta x\right)\right]$$
Now recalling that $\displaystyle \Delta x = \frac{\pi}{n}$ and taking $n \to \infty$ we have
$\begin{align} \int_0^\pi \sin(x)\;dx &= \lim_{n \to \infty} \frac{\frac{\Delta x}{2}}{\sin\left(\frac{\Delta x}{2}\right)}\left[ \cos\left(\frac{\Delta x}{2}\right) - \cos\left(\frac{2n+1}{2}\Delta x\right)\right]\\
& =  1 \cdot \left[ \cos(0)-\cos(\pi)\right]\\
& = 2
\end{align}$
One nice thing about this computation is that you can replace $\pi$ with an arbitrary upper limit of integration $c$ and compute that $\int_0^c \sin(x) \;dx = 1 - \cos(c)$.
From there, one can easily compute
$$\int_a^b \sin(x) \; dx = \int_0^b \sin(x) \; dx - \int_0^a \sin(x) \; dx = -\cos(b) + \cos(a)$$
(as predicted by FTC).
Question: Is the computation above in the literature somewhere? If so, where?
 A: I suspect Tom Apostol's calculus textbook has this (i.e., finds $\int_0^\pi\sin x\,dx$ by using limits of Riemann sums without the fundamental theorem).
I question the place of Riemann sums in the curriculum.  Rigorous definitions are unsuitable for a calculus-for-liberal-education course unless the students are unusual.  Such a course should acquaint students with the reason why calculus is important in the course of human events over recent and coming centuries, and with the fact that it overcame difficulties like how to define $\text{rate} = \dfrac{\text{distance}}{\text{time}}$ when the distance and the time are both $0$, and how to to find $$\sum\text{force}\times\text{distance}$$ when there are infinitely many infinitely small distances, each with its own value of "force".  The conventional calculus course is a watered-down version of a course for students who come in with a prior desire or a pre-identified need to understand calculus, rather than for students who are there in order to pay a price in homework for a grade to impress employers, and whom one should be trying to seduce into another course of action.
If you expect students to marvel at the fact that it's possible to find this integral by using limits of Riemann sums, I expect the way they will think of it and remember it is "We did some technical stuff and turned it in and got graded", and if you have them plod through finding the integral by antidifferentiating and substituting endpoint values, then the way they will think of it and remember it is "We did some technical stuff and turned it in and got graded", and they won't know the difference.  (I'm hoping for a malpractice suit against every university that knowingly encourages unqualified students to take calculus, to the point where those are 99.9% of the ones who show up.  They bring in tuition money.)
Another occasion for Riemann sums is numerical integration, but that doesn't seem to be your purpose.
A: Alternatively, you can use $e^{i \theta} = \cos(\theta) + i \sin(\theta)$ and the partial sum formula for Geometric series. Using left endpoint approximation instead, the  sum we want to evaluate is
$$ \sum_{k=0}^{n-1} \sin(k \, \Delta x)\,\Delta x$$
where $\Delta x = \frac{\pi}{n}$. Note that $\sum_{k=0}^{n-1} \sin(k \,\Delta x)$ is the imaginary part of $\sum_{k=0}^{n-1} e^{i k \,\Delta x}$, that is $\sum_{k=0}^{n-1} z^k$ where $z = e^{i \,\Delta x}$. This last sum has the closed form $\frac{1-z^n}{1-z} = \frac{2}{1-z}$ using $z^n = e^{i \pi} = -1$. We get
$$ \sum_{k=0}^{n-1} \sin(k \,\Delta x)\,\Delta x =\mathrm{Im}\left( \frac{2}{1-e^{i\, \Delta x}} \right) \,\Delta x =  \mathrm{Im}\left( \frac{2\,\Delta x}{1-e^{i \,\Delta x}} \right).$$
Finally, letting $n \to \infty$ so that $\Delta x \to 0$ we get
$$\lim_{\Delta x \to 0} \frac{2\,\Delta x}{1-e^{i \,\Delta x}} = -2\left( \lim_{\Delta x \to 0 } \frac{e^{i \,\Delta x} - 1}{\Delta x} \right)^{-1} = -2\left( \frac{d}{dt} e^{it} \big|_{t=0} \right)^{-1} = -2i^{-1} = 2i$$
so that
$$ \lim_{n \to \infty} \sum_{k=0}^{n-1} \sin(k \,\Delta x)\,\Delta x = \operatorname{Im}(2i) = 2.$$
