# Motivating the Riemann Sum

### A motivating problem...

Suppose the upward velocity of a piston t seconds after it starts to move is given by $v(t) = \sin(t)$ m/s. If the piston is 3 meters high when it starts to move, how high will it be 4 seconds later?

### A possible strategy...

Suppose we attempted to approximate the answer to the question above. We might recall that

distance = rate $\times$ time

but that is only true when the rate is a constant velocity - and clearly the velocity in the problem above is changing over time. (Note: sometimes, the piston even moves backwards!)

However, if the time interval was just shorter... the velocity wouldn't be changing by as much, right? Consider the difference in velocity at the following two times:

$$v(1) \doteq 0.84147 \quad v(1.0001) \doteq 0.84152$$

So maybe, for just that brief interval of time, distance = rate $\times$ time could give a decent approximation of the small change in position during that tiny time interval...

$$\textrm{distance} \doteq 0.8415 \times (1.0001 - 1)$$

Note, in the interest of getting an even better approximation, we tried to split the difference here with regard to the rate used - something between 0.84147 and 0.84152. There is more to say about this - but for now, recall that we are at least assurred (by intermediate value theorem, in this case) that at some $x^*$ we have $v(x^*) = 0.8415$...

Consequently, if we denote the small change in position that happens over this tiny time interval by $\Delta s$, and if we denote the change in time (i.e., time elapsed) from the start to the end of that tiny time interval by $\Delta t$, then we can say

$$\Delta s \doteq v(x^*) \times \Delta t$$

Now, to approximate the total change in position from $t=0$ to $t=4$, we could find all of these "little-changes-in-position" and just add them up! (Keep in mind, some of these could be negative, indicating a distance traveled backwards.)

Consider the following possible way to cut up the time from $t=0$ to $t=2$ into nine tiny intervals no longer than 0.6 seconds -- and this is just one of many, many ways to do this...

$$\begin{array}{cccc} i & i^{th} \textrm{ time interval } & \textrm{ range of v(t) values } & \Delta t\\ 1 & (0,0.4) & 0 \textrm{ to } 0.39 & 0.4\\ 2 & (0.4,1) & 0.39 \textrm{ to } 0.84 & 0.6\\ 3 & (1,1.3) & 0.84 \textrm{ to } 0.96 & 0.3\\ 4 & (1.3,1.9) & 0.96 \textrm{ to } 1 & 0.6\\ 5 & (1.9, 2.4) & 0.67 \textrm{ to } 0.95 & 0.5\\ 6 & (2.4,2.6) & 0.51 \textrm{ to } 0.67 & 0.2\\ 7 & (2.6,3.15) & -0.01 \textrm{ to } 0.51 & 0.55\\ 8 & (3.15, 3.55) & -0.4 \textrm{ to } -0.01 & 0.4\\ 9 & (3.55,4) & -0.75 \textrm{ to } -0.4 & 0.45 \end{array}$$

Now, which $v(x^*)$ value we should use for each little tiny time interval could be debated. We might want to use the minimum value of the function in each range, thereby ensuring we do not over-estimate how high the piston will be. We might instead want to use the maximum value of the function in each range, so that we don't under-estimate the piston's height. Alternatively, we might decide to split the difference and use some $v(x^*)$ value between the two of these. While the choice at this point will affect our approximation, this becomes less and less of a concern as our time intervals become more and more narrow (i.e., there will be a smaller and smaller range of $v(x^*)$ values from which to choose). For the purposes of simply making a decision about such things for this example, let us suppose we use the value $f\,(x^*)$ where $x^*$ is chosen to be the right endpoint of each time interval.

So, based on the above intervals and the choice of $v(x^*)$ values just described, an approximation for the total change in position the piston experiences from $t=0$ to $t=2$ is given by

$$\begin{array}{lll} \textrm{Total change } & = & (0.39)(0.4) + (0.84)(0.6) + (0.96)(0.3) +\\ \textrm{in position} & & (0.94)(0.6) + (0.67)(0.5) + (0.51)(0.2) +\\ & & (-0.01)(0.55) + (-0.4)(0.4) + (-0.75)(0.45) \end{array}$$

A couple of comments about the construction of the above sum are in order:

1. The $4^{th}$ term above, (0.94)(0.6), does indeed correspond to the product of the height of the function at the right endpoint of the time interval in question $v(1.9) \doteq 0.94$ and the width of that time interval, 0.6. This may, however, not be apparent in the table, as $v(t)$ attains a maximum value of 1 within this time interval;

2. Also note that $v(t)$ starts decreasing after $\pi \ /\ 2 \doteq 1.57$, so the height of the function at the right endpoint of each time interval to the right of 1.57 will represent its minimum value in that interval.

Importantly, notice that this sum takes the form

$$\sum_{i=1}^{n} v(x_i^*) \Delta t_i$$

where $n=9$, and even the biggest $\Delta t_i$ is fairly small (i.e., no more than 0.6) -- and this sum generally represents a better and better approximation to the true change in position for our piston as we shrink the size of these individual time intervals (i.e., as the maximum $\Delta t_i$ gets small).

With this in mind, we make the following definitions:

A partition of a given interval $[a,b]$ is a set of subintervals $[x_{i-1},x_i]$ where

$$a = x_0 \lt x_1 \lt x_2 \lt \cdots \lt x_{n-1} \lt x_n = b$$

(Just like we cut up the time into many little intervals from $t=0$ to $t=2$ in the piston problem.)

$\Delta x_i$ is the length of the $i^{th}$ subinterval, given by $\Delta x_i = x_i - x_{i-1}$

(Just like the length of our tiny time intervals, $\Delta t_i$, in the piston problem)

We call the length of the longest subinterval of a partition the norm of the partition, and denote it by $||\Delta||$.

(Recall, for the purposes of getting a good approximation, we want the longest subinterval in our partition to be very small in length itself, thereby forcing all of the subintervals of our partition to be very small in length.)

Suppose for each $i$, $x_i^*$ is some chosen value in the $i^{th}$ subinterval, $[x_{i-1},x_i]$.

Then we call any sum of the following form a Riemann sum,

$$\sum_{i=1}^{n} \ f\,(x_i^*)\Delta x_i$$

(For the piston problem, this represented an approximation to the total change in position of the piston.)

Finally, let us call the limit of a Riemann sum as the norm goes to zero (forcing all of the $\Delta x_i$'s to become very small), provided it exists, the definite integral of $f\,(x)$ from $a$ to $b$, denoted by

$$\int_a^b \ f\,(x) \ dx = \lim_{||\Delta|| \rightarrow 0} \ \sum_{i=1}^{n} \ f\,(x_i^*) \Delta x_i$$

(This represents, in a sense, the "best" approximation -- the limiting case. In the piston problem, this gives us the actual change in position over that time interval.)

Note the notation for the definite integral was chosen very deliberately:

We have traded the uppercase sigma ($\Sigma$ is the greek version of the letter "S") for a $\int$, an elongated latin "S" - but both indicate a "sum" is being taken.

We have traded an uppercase delta ($\Delta$ is the greek version of an uppercase "D") for an italic lowercase "d" -- but both indicate a change or "difference" in $x$ (the latter being a "small" difference).

Finally, as the definite integral tells us something about the behavior of the function over an interval $[a,b]$ and that information gets somewhat lost in the limit of the Riemann sum through the consideration of the partition used and the norm of that partition - we make the connection more prominant by putting the $a$ and $b$ (which are called the lower and upper limits of integration, respectively) right next to the $\int$ symbol.

Oftentimes, to evaluate a definite integral directly from its limit of a Riemann sum definition, we choose a convenient partition, one in which all of the $\Delta x_i$'s are the same size (which we denote by $\Delta x$). This is called a regular partition. In this case, we can be assured that the norm of the partition $||\Delta||$ goes to zero if we require that the number of subintervals goes to infinity. In such circumstances, we can rewrite things in the algebraically simpler form:

$$\int_a^b \ f\,(x) \ dx = \lim_{n \rightarrow \infty} \ \sum_{i=1}^{n} \ f\,(x_i^*) \Delta x$$

Note that in a regular partition, the sequence of $x_i$'s forms an arithmetic progression.

In the case where the subintervals are not all the same length, we say we have a non-regular partition. There are many such partitions, but a frequently algebraically useful one is where the $x_i$'s form a geometric progression.