Riemann Sums

Riemann sums provide the general procedure for handling definite integrals. We start with some curve, an area beneat the curve, and some increments. We call each of the increments Δx.{\Delta x.} If there are n{n} pieces, then:

Δx=ban \Delta x = \dfrac{b-a}{n}

With this information, we pick a height of f(ci){f(c_i)} in each interval. In other words, within each of the Δx,{\Delta x,} pick some point ci.{c_i.} Then, plugging ci{c_i} into f{f}f(ci){f(c_i)} — we get the height of the rectangle we want. This sets the dimensions for each of our rectangles.

With the rectangle's dimensions set, we can add all of the areas of the rectangles:

i=1nf(ci)heightΔxbase \sum\limits_{i=1}^{n} \underbrace{f(c_i)}_{height} \overbrace{\Delta x}^{base}

This summation is called a Riemann sum. The complicated example we saw earlier involving pyramids is an in-depth examination of how the Riemann sum works. Applying the limit to the Riemann sum — as Δx{\Delta x} tends towards 0,{0,} i.e., as the rectangles get very thin — is a good use case for Leibniz notation:

limΔx0i=1nf(ci)Δxabf(x) dx \lim\limits_{\Delta x \to 0} \sum\limits_{i=1}^{n} f(c_i) \Delta x \nc \int_a^b f(x)~dx

The Riemann sum demonstrates another way to interpret integrals: They're cumulative sums. Suppose t{t} is a variable for time, measured in years, and the function f(t){f(t)} is a borrowing rate, measured in dollars per year. Suppose our friend Bernard borrows money every day. This means that:

Δt=1365 \Delta t = \dfrac{1}{365}

Now let's say the rate varies over the year. Sometimes Bernard needs more money, other times he needs less. Question: How much has Bernard borrowed so far? Well, if Bernard has borrowed up to day 45,{45,} then:

t=45365 t = \dfrac{45}{365}

The amount borrowed then is:

f(45365)Δt=f(45365)1365 f \left( \dfrac{45}{365} \right) \cdot \Delta t = f \left( \dfrac{45}{365} \right) \cdot \dfrac{1}{365}

Notice that the units work out:

[f(45365)]$yr[1365] yr \left[ f \left( \dfrac{45}{365} \right) \right] \dfrac{\text{\$}}{\cancel{\text{yr}}} \cdot \left[ \dfrac{1}{365} \right]~\cancel{\text{yr}}

This means that if we want to add up how much we've borrowed for an entire year, we would get the sum:

total borrowed=i=1365f(i365)Δt=01f(t) dt \begin{aligned} \text{total borrowed} &= \sum\limits_{i=1}^{365} f \left( \dfrac{i}{365} \right) \Delta t \\[1em] &= \int_0^1 f(t)~dt \end{aligned}

This gives us how much Bernard's borrowed, but there's still the question of how much Bernard owes the bank at the end of the year. Let's say the interest rate r{r} is compounded continously. If we start out with P{P} as the principal, then after time T,{T,} Bernard owes:

amount owed=PerT \text{amount owed} = P \cdot e^{rT}

We know that the principal is:

P=f(i365)Δt P = f \left( \dfrac{i}{365} \right) \Delta t

Then, we know that the time left in the year is given by:

T=1i365 T = 1 - \dfrac{i}{365}

This tells us that amount Bernard owes is:

amount owed=i=1365(f(i365)Δt)er(1i365)=01er(1t)f(t) dt \begin{aligned} \text{amount owed} &= \sum\limits_{i=1}^{365} \left( f \left( \dfrac{i}{365} \right) \Delta t \right) e^{r(1 - \frac{i}{365})} \\[1em] &= \int_0^1 e^{r(1-t)} f(t)~dt \end{aligned}

This example illustrates why we append the symbol dx{dx} to integrals — it allows us to be consistent with units and develop meaningful, consistent formulas.