### Slides: Applications of integration: area under a curve

Use the arrow keys to change slides.

#### Video

#### Talk transcript

One of the classical applications of integration is using it to determine the area underneath the graph of a function, often referred to as finding the area under a curve.

For example, let's say we wanted to find the area underneath the graph of the function $f(x)$ equals $x$ plus $e$ to the $2x$, between the values $x=-1$ and $x=2$. The area we want to determine is the shaded region in this graph.

Finding the area of such a curved region is tricky. What is a lot simpler is finding areas of rectangles. To that end, let's divide the interval $[-1,2]$ into two sub-intervals and approximate the function as being constant in both sub-intervals. Here we calculate a left-handed estimate, so we approximate the function as being the value at the left side of each sub-interval. We imagine the function is equal 6.39 in the first half, because $f(-1)$ is $6.39$, and imagine it is equal to 0.87 in the second half, because $f(0.5)$ is 0.87. For this piecewise constant function shown by the two blue line segments, it's easy to calculate the area underneath it. The area is just the sum of two rectangles. The width of the total interval from $-1$ to $2$ is 3, so the rectangle widths are exactly half that, which is $\Delta x=1.5$. We multiply the two heights by 1.5 to get the two areas: 9.58 for the first rectangle and 1.3 for the second rectangle. When we sum up those two areas, we calculate the total area as 10.89. Well, I actually get 10.88 when adding these two numbers, but the computer is doing a more accurate job by not rounding until the end, and it gets 10.89.

We could do a similar calculation by approximating the height of the function in each sub-interval by its height at the right of the interval, obtaining a right-handed estimate. In this case, the rectangle heights are 0.87 and 2.02, their areas are 1.3 and 3.03, for a total area of 4.33. These two estimates of 10.89 for the left-handed estimate and 4.33 for the right-handed estimate are pretty far from each other, and not too close to the actual area under the function. To improve the accuracy, we can increase the number of subintervals. For 10 subintervals, we obtain estimates for the area of 5.95 for the left-handed estimate and 4.64 for the right-handed estimate.

The sum used calculate the area of the rectangles is exactly the Riemann sum we used to define the definite integral. For the left-handed estimate, we get the left Riemann sum, which is the sum from $i=1$ to $10$ of $f(t_{i-1})$, which is the height of the left side of each sub-interval, times the width of the rectangle $\Delta x$. For the right Riemann sum, the only thing that changes is that we use the height of right side, $f(t_i)$, for the rectangle height. We can increase the number of rectangles to improve the estimate of the area. To get the actual area under the curve, we need to take the limit as the number of rectangles, $n$, goes to infinity. This limit is exactly the definition of the definite integral. The area under the function $f(x)$ for $x$ between $-1$ and $2$ is therefore the integral from $-1$ to $2$ of $f(x)dx$, which, since our function $f(x)$ is $x$ plus $e$ to the $2x$, is the integral from $-1$ to $2$ of $x$ plus $e$ to the $2x$ $dx$.

We can now jettison our Riemann sums and instead use the Fundamental Theorem of Calculus to calculate the area given by the definite integral. To start, we calculate the indefinite integral, or anti-derivative. Let's separate the integral into its two terms. To make the second integral easier, we multiplied and divided by $-2$. We take the integral of $x$ to get $1/2$ $x^2$. The integral of $-2$ times the exponential is the exponential itself, so the second term is $-1/2$ times the exponential. This function is our anti-derivative big $F(x)$. We didn't need to add an arbitrary constant $C$ here because we are computing a definite integral.

By the Fundamental Theorem of Calculus, the definite integral defining the area under the curve is simply this indefinite integral $F(x)$ evaluated at $x=2$ minus the same $F(x)$ evaluated at $x=-1$. We plug in those numbers to find that the area under the curve is approximately 5.185. How does this actual area compare to our estimates with the rectangles? When we have 100 rectangles, the left Riemann sum gives us 5.25 and the right Riemann sum gives us 5.12. The answers were converging to the correct answer of 5.185. We would need a lot more than 100 rectangles to gives us three correct digits. Thankfully, we can avoid calculating a huge Riemann sum and just calculate the integral directly.

Let's do another example. Let's calculate the area between the graph of the function $1/x$ and the $x$-axis over the interval of $x$ from $-2$ to $-1$. We begin by calculating the integral from $-2$ to $-1$ of $1/x$ $dx$. The anti-derivative of $1/x$ is the logarithm of the absolute value of $x$, so by the Fundamental Theorem of Calculus, we evaluate that logarithm at $x=-1$ and then subtract the logarithm at $x=-2$. The absolute value eliminates the negative signs, so we have the logarithm of one minus the logarithm of two. The logarithm of one is zero and the logarithm of two is 0.693. We calculate that the area is $-0.693$.

Uh, wait a minute, that doesn't make sense. It doesn't make sense to have negative area. Something must have gone wrong here. Let's take a look of the graph of the function to determine what happened. Since $x$ is negative, the function $1/x$ is also negative. When trying to calculate the area, we are getting negative heights, so it makes sense that we end up with a negative number. If a function is negative, the definite integral doesn't gives us area; it gives minus the area. This problem is easily fixed. The distance from the $x$-axis to the function will always be the absolute value of the function, which gets rid of the negative sign if the function is negative. To get the area, we need to integrate the absolute value of $1/x$. When $x$ is negative, what is the absolute value of $1/x$? Since $1/x$ is negative, we simply need to multiply by $-1$ to make it positive. The area is the integral from $-2$ to $-1$ of $-1/x$ $dx$. We just need to take our previous answer of $-0.693$ and multiply it by $-1$ to determine that the area is $0.693$.

Let's look at one final example. If we take the integral from $-2$ to $1$ of the function $4x^3-16x$, we will get a number, since it is a definite integral. In terms of area, what does that number represent? For starters, let's go ahead and compute the integral. The anti-derivative is $x^4-8x^2$. We evaluate it at $1$ and $-2$ and take the difference. The number we get for our answer is 9.

To see what this 9 represents in terms of area, let's plot the graph of the function. In between $-2$ and $1$, the function is both positive and negative. It is positive from $-2$ to $0$ and then negative from $0$ until the end of our integral at $1$. This means that we are adding up positive numbers for the area from $-2$ to $0$ and then combining that with negative numbers for the area from $0$ to $1$. What are are doing is calculating the area above the $x$-axis and then subtracting the area below the $x$-axis. We call this result “signed area.” If we don't take an absolute value, the integral of $f(x)$ is the signed area between the graph of the function and the $x$-axis. It is the area above the $x$-axis minus the area below the $x$-axis.

To demonstrate this result more clearly, let's compute the positive and negative portions of the integral separately. If we compute the integral from $-2$ to $0$, which is where the function is positive, we get $16$. The area under the curve for $x$ between $-2$ and $0$ is $16$. If we compute the integral from $0$ to $1$, where the function is negative, we get $-7$. This means that the area between the curve and the $x$-axis is $7$, but it comes out $-7$ because the graph is below the $x$-axis. The signed area is the sum of these two terms, which is why we get $9$.

If we want to calculate the actual area, we have to take the absolute value. The absolute value doesn't change the integral from $-2$ to $0$, as the function is positive there. However, it multiplies the function by $-1$ for $x$ between $0$ and $1$, changing the $-7$ to $7$. The actual area under the curve is $16 + 7$, which is $23$.

In summary, the definite integral of a function $f(x)$ will give you the signed area between the graph of the function and the $x$-axis, subtracting area below the $x$-axis from the area above the $x$-axis. If you want the actual area between the graph of the function and the $x$-axis, you need to take the absolute value. That complicates the calculation a little bit, because you have to find out where the function is negative and multiply it by $-1$ just in those intervals. Even so, using a definite integral is a pretty nifty way to determine the area under a curve.