## Area Under Curves and The Definite Integral

### Project 4 - an extension of Project 3

#### Area Under Curves - Rectangle Approximations

Suppose we would like to find the area under a curve, that is, the area between the x-axis, some function `f(x)`, on an interval from `x = a` to `x = b`. We will begin by approximaing the area, and then move towards a fundamental concept of Calculus called the definite integral.

For example, suppose we would like to approximate the area under
`f(x) = x^2 - 4x + 5` from `x = 0`
to `x = 3`. Graphically, that is
the area of the green regions in the figure below.

We know how to calculate the area of a polygon, but it is not so easy to calculate area of a region with curved sides. One method for approximating the area under a curved region is to approximate the region with rectangles.

We'll divide the interval along the x-axis into subintervals of equal lengths and consider the rectangles whose bases are these subintervals and whose heights are the values of the function at the right-hand endpoints of those subintervals. Then we'll calculate the sum of the areas of the rectangles by the rectangle area formula we all know, `A = base * height`.

For example, let's approximate the area of `f(x) = x^2 - 4x + 5`, from `x = 0` to `x = 3`, by splitting the interval into 6 subintervals, which serve as bases for the rectangles, and we'll take the height of each rectangle at the left enpoint of the subinterval, as pictured. We then approximate the area under the curve by calculating the sum of the areas of the rectangles.

The width of each rectangle is `3/6 = 1/2`, and the heights are:

f(0.5) = 3.25

f(1) = 2

f(1.5) = 1.25

f(2) = 1

f(2.5) = 1.25

endmath

Letting `Delta x` be the width of each rectangle and `f(x_i)` be the height of each rectangle, we have

`sum_(i=0)^5(height)*(width)=sum_(i=0)^5(f(x_i))*Delta x=sum_(i=0)^5f(3/6*i)*3/6=6.875`Now, suppose we take smaller subintervals, i.e., more rectangles, each with a smaller width. For example, let's split the interval from `x = 0` to `x = 3` into 15 subintervals this time.

The width of each rectangle is `3/15 = 1/5`, and the heights are:

f(.2) = 4.24

f(.4) = 3.56

f(.6) = 2.96

f(.8) = 2.44

f(1) = 2

f(1.2) = 1.64

f(1.4) = 1.36

f(1.6) = 1.16

f(1.8) = 1.04

f(2) = 1

f(2.2) = 1.04

f(2.4) = 1.16

f(2.6) = 1.36

f(2.8) = 1.64

endmath

`sum_(i=0)^14(height)*(width)=sum_(i=0)^14(f(x_i))*Delta x=sum_(i=0)^5f(3/15*i)*3/15=6.32`

This is a better approximation than the first, but it could still be better.

Here is an interactive .m file for Matlab that allows you to input the number of rectangles that you would like to approximate the area by.

As you can see, the more rectangles we take, the better the approximation becomes, which begs the question, "What if we take an infinite number of rectangles, each with an infinitely small, equal width?" Then we should be able to calculate the exact area under the curve. To do this we take the limit as `n rarr oo`, where `n` is the number of rectangles taken. For more information about limits, see Additional Information About Limits.

=lim_(n -> oo) sum_(i=0)^n (27/n^3*i^2-36/n^2*i+15/n)

=lim_(n -> oo) (27/n^3 sum_(i=0)^n i^2-36/n^2 sum_(i=0)^n i+15/n sum_(i=0)^n 1)

=lim_(n -> oo) (27/n^3((n(n+1)(2n+1))/6)-36/n^2((n(n+1))/2)+15/n(n))

=lim_(n -> oo) (9/2(2+3/n+1/n^2)-18(1+1/n)+15)

=lim_(n -> oo) (9+27/n+9/(2n^2)-18-18/n+15)

=9-18+15

=6

endmath

Thus, the exact area of under the curve of `f(x) = x^2 - 4x + 5` is `6` `units^2`!

We could have just as well chosen to take the height of each rectangle at the right-hand side, or at the center of each subinterval. As the width of each rectangle approaches zero, it would make no difference.

#### Refining the Limit for Unequal Subinterval Lengths

In the previous examples, we divided the interval into `n` subintervals...

`[x_0, x_1], [x_1, x_2], ..., [x_(n-1), x_n]`

...where each subinterval was equally spaced. This subdivision is a "partition" of the interval `[a, b]`, which we will denote `P`. Recall, the length of the `i^(th)` subinterval was denoted `Delta x_i`.

Now, suppose our partition did not have equally spaced subintervals. We call the length of the longest subinterval "the norm of the partition," denoted `||P||`. That is,

`||P||=max{Delta x_1, Delta x_2, ..., Delta x_n}`

Letting the number of subintervals, `n`, approach infinity will not necessarily
guarantee that the the width of each subinterval approaches zero. But we need
the width of each subinterval to approach zero so that the limit of the summation
gives an accurate value for the area under the curve. So, in the case that each
`Delta x_i` is not necessarily of equal length, we let `||P|| -> 0` instead of
letting `n -> oo`. Letting `x_i^**` be the `x`-point within the subinterval
`Delta x_i` at which the height of the rectangle is taken,
we have a new way to define area under a curve, `A`, along a given subinterval,
`[a, b]` that works if the subintervals are of different widths and
the heights are taken `x_i^**`.

`A = lim_(||P|| -> 0) sum_(i=1)^n f(x_i^**) Delta x_i`

#### The Definite Integral

## Definition of a Definite Integral

If `f` is a function defined on a closed interval `[a, b]`, let `P` be a partition of `[a, b]` with partition points `x_0, x_1, ..., x_n`, where

`a=x_0 < x_1 < x_2 < ... < x_n=b`

Choose points `x_i^**` in `[x_(i-1), x_i]` and let `Delta x_i=x_i-x_(i-1)` and `||P||=max{Delta x_i}`. Then the definite integral of `f` from `a` to `b` is

`int_a^b f(x)dx=lim_(||P|| -> 0) sum_(i=1)^n f(x_i^**) Delta x_i`

if this limit exists. If the limit does exist, then `f` is called called integrable on the interval `[a, b]`.

Related terms:

`f(x)` is the integrand

`a` and `b` are the limits of integration

`a` is the lower limit

`b` is the upper limitThis definition is taken from "Calculus, Early Vectors" by Stewart

In the case where `f(x) > 0`,

`int_a^b f(x) dx=` the area under the graph of `f` from `a` to `b`

If `f(x)` is not positive for all `x` in `[a, b]`, then the definite integral of `f` can be interpreted as a difference of the areas above the x-axis x-axis and below the x-axis. The area above the x-axis will be counted as positive and the area below the x-axis will be counted as negative.

We have not yet taken into consideration the possiblity that `f(x)` is not continuous. In this case, the limit may not exist, meaning `f` may or may not be integrable. In actuality, Stewart states:

If `f` is either continuous, or increasing, or decreasing, on `[a, b]`, then `f` is integrable on `[a, b]`; that is, the definite integral `int_a^b f(x) dx` exists.

#### Definite Integrals - Helpful Theorems and Properties

The limits we have been taking to compute the areas are quite laborious. There are some helpful theorems and properties of integrals that simplify the computational process.

## Theorem

If `f` is integrable on `[a, b]`, then

`int_a^b f(x) dx=lim_(n -> oo) (b-a)/n sum_(i=1)^n f(a+i(b-a)/n)

## Properties

`int_a^b c dx=c(b-a)`

`int_a^b [f(x)+-g(x)] dx=int_a^b f(x) dx +- int_a^b g(x) dx`

`int_a^b c f(x) dx=c int_a^b f(x) dx`, where `c` is any constant.

`int_a^b f(x) dx=int_a^c f(x) dx+int_c^b f(x) dx`

#### The Fundamental Theorem of Calculus

## FTC

If `f` is continuous on `[a, b]`, then

1. If `g(x)=int_a^x f(t) dt`, then `g'(x)=f(x)`

2. `int_a^b f(x) dx=F(b)-F(a)`, where `F` is any antiderivative of `f`, that is, `F'=f`.

Now that we know what a definite integral represents, and some basic properties of definite integrals, we come to the question of how to compute definite integrals. This tutorial assumes knowledge of Derivatives, but we will quickly reivew antiderivatives. For more information on derivatives, see More Information on Derivatives.

#### Antiderivative Reivew

An antiderivative, `F`, of a function, `f` on an interval `I` if `F'(x)=f(x)` for all `x` in `I`.

For review, I'll provide you with the following table of antiderivative formulas. The derivation of these formulas will be skipped in this tutorial, as I am assuming you are already familiar with them.

Function | Antiderivative |
---|---|

`c f(x)` | `c F(x)` |

`f(x)+g(x)` | `F(x)+G(x)` |

`x^n, n!=-1` | `x^(n+1)/(n+1)` |

`x^n, n!=-1` | `x^(n+1)/(n+1)` |

`1/x` | `ln|x|` |

`e^x` | `e^x` |

`cos(x)` | `sin(x)` |

`sin(x)` | `-cos(x)` |

`sec^2(x)` | `tan(x)` |

`1/sqrt(1-x^2)` | `sin^(-1)(x)` |

`1/(1+x^2)` | `tan^(-1)(x)` |

#### Practice Computing Definite Integrals

Now, we have enough information to compute definite integrals! Let's try a few. We'll begin with an example, then you can try some yourself.

#### Interactive Examples

##### Click each button twice to show or hide a step.

###### Example 1

###### Example 2

#### Interactive Quiz

Congratulations! Hopefully you have now successfully computed some definite integrals without approximating. You will still need much more practice before you become an expert, but hopefully you are on the path to understanding area under curves and definite integrals.