xaktly | Integral calculus

Average value of
f(x) on [a, b]



The average value of a function over an interval


Once in a while we'd like to know the average value of a function over some interval. The average value of a horizontal-line function, say $f(x) = 4,$ is easy; it's just 4. But what about the average value of the function $f(x) = -x^2 + 4x$ between its roots, 0 and 4? That's not quite so intuitive, but with the integral we can figure it out.

The answer is shown in the graph on the right. The average value of the function on the interval [0, 4] is $\frac{8}{3}.$ Let's see how we can figure that out.


Derivation


To calculate the average value of a function on some interval, we might begin by just dividing it into equal parts, calculating values of the function at those points and averaging those values. Of course, with integration we ought to be able to do that exactly. Here's how:

Here is a function over an interval [x0, xn]. Let's divide the interval into N pieces, labeling the intervals with $x_0, \, x_1, \, x_2, \, \dots \, x_N.$ If we calculate the value of the function at each of those points and average them, we get:

$$ \begin{align} \overline{f(x)} &= \frac{1}{n} \left[ f(x_0) + f(x_1) + \dots + f(x_N) \right] \\[5pt] &= \frac{1}{N} \sum_{i = 0}^N f(x_i) \phantom{00000000} (\color{#E90F89}{\bf{*}}) \end{align}$$

Now compare our example to finding the area under the same curve using a right Riemann sum, in which we divide the area into rectangles with their upper right corners pinned to the curve.

The total area of the rectangles is

$$\frac{x_N - x_0}{N} \left[ f(x_1) + f(x_2) + \dots + f(x_N) \right],$$

where $\frac{x_N - x_0}{N}$ is just the width of each equally-spaced rectangle.

In summation notation, that's just

$$A = \frac{x_N - x_0}{N}{N} \, \sum_{i=1}^n \, f(x_i)$$

Now notice that the area is just our average of line heights from the starred equation above, but divided by the difference between the endpoints of our interval, $f(x_N) - f(x_0).$ The right Riemann sum form of the area under the curve converts to an integral:

$$A = \int_a^b f(x) \, dx,$$

where $a$ and $b$ are shorthand notation for $f(x_0)$ and $f(x_1).$ We can use that model to write an integral for the average value of a function:

$$\overline{f(x)} = \frac{1}{b - a} \int_{x_0}^{x_N} f(x) \, dx$$

Average value of a function

If $f(x)$ is a continuous function on the interval $[a, b],$ then the average value of $f(x)$ on that interval is

$$\overline{f(x)} = \frac{1}{b - a} \int_a^b f(x) dx$$

Geometric interpretation

Geometrically, the average value of a function is located by the height of a rectangle with width equal to the width of the interval of integration, and height equal to the average value. The area of the rectangle is equal to the area under the curve from a to b, as shown:

Example 1

Calculate the average value of $f(x) = sin(x)$ on the intervals $[0, \pi]$ and $[0, 2\pi].$


Solution: On the interval $[0, \pi],$ the average value is

$$ \begin{align} \overline{f} &= \frac{1}{\pi - 0} \int_0^{\pi} sin(x) \, dx \\[5pt] &= \frac{1}{\pi} \left[ -cos(x) \right]_0^{\pi} \\[5pt] &= -\frac{1}{\pi} [cos(\pi) - cos(0)] \\[5pt] &= -\frac{1}{\pi} [-1 - 1] = \color{#E90F89}{\frac{2}{\pi}} \end{align}$$

Here's a graphical representation. The sin(x) curve is graphed between 0 and π. We expect the average value of the function on this interval to be positive, because all values of the function are positive on it.

If we draw a box spanning x = 0 to x = π and y = 0 to y = π/2, the area of that box is the same as the area under the curve over the same domain.

On the interval $[0, 2\pi],$ the average value is

$$ \begin{align} \overline{f} &= \frac{1}{\pi - 0} \int_0^{2\pi} sin(x) \, dx \\[5pt] &= \frac{1}{\pi} \left[ -cos(x) \right]_0^{2\pi} \\[5pt] &= -\frac{1}{\pi} [cos(2\pi) - cos(0)] \\[5pt] &= -\frac{1}{\pi} [1 - 1] = \color{#E90F89}{0} \end{align}$$

This time, the average is zero. The graph below shows why: half of all of the values of sin(x) on this interval are positive, and each has a negative counterpart on the second half (π to 2π).

Example 2

Calculate the average value of $f(x) = \frac{1}{x^2 + 1}$ on the interval $[-1, 1].$


Solution: The average value is

$$\overline{f(x)} = \frac{1}{1 - -1} \int_{-1}^1 \frac{1}{x^2 + 1} \, dx$$

Recall that

$$\frac{d}{dx} tan^{-1}(x) = \frac{1}{x^2 + 1},$$

So our integral is

$$ \begin{align} \overline{f(x)} &= \frac{1}{2} tan^{-1}(x) \bigg|_{-1}^1 \\[5pt] &= \frac{1}{2} \left[ tan^{-1}(1) - tan^{-1}(-1)\right] \\[5pt] &= \frac{1}{2} \left[ \frac{\pi}{4} - \frac{-\pi}{4} \right] \\[5pt] &= \frac{1}{2} \frac{\pi}{2} = \color{#E90F89}{\frac{\pi}{4}} \end{align}$$

Notice that this function is symmetric about the y-axis (it's an even function in which $f(-x) = f(x)$), so we could have written the integral as

$$\overline{f(x)} = \frac{1}{2} \cdot 2 \int_0^1 \frac{1}{x^2 + 1} \, dx.$$

Here's a graph of the function with its average value (black line):

Pro tip:

When you can take advantage of the symmetry of the problem like we did in example 2 above, you'll often get a simpler definite integral. When one of the limits of integration is zero, it makes for a much simpler integral to evaluate.


Practice problems

Find the average value of each of these functions on the interval given:

1.

$$f(x) = cos(x), \phantom{000} \left[0, \, \frac{\pi}{4} \right]$$

Solution

$$ \begin{align} \overline{f(x)} &= \frac{1}{\pi/4} \int_0^{\frac{\pi}{4}} cos(x) \, dx \\[5pt] &= \frac{4}{\pi} sin(x) \bigg|_0^{\frac{\pi}{4}} \\[5pt] &= \frac{4}{\pi} \left[ sin\left( \frac{\pi}{4} \right) - sin(0) \right] \\[5pt] &= \frac{4}{\pi} \frac{\sqrt{2}}{2} = \frac{2 \sqrt{2}}{\pi} \end{align}$$

2.

$$f(x) = 4x^3 - 3x^2 \phantom{000} [-1, 2]$$

Solution

$$ \begin{align} \overline{f(x)} &= \frac{1}{3} \int_{-1}^2 4x^3 - 3x^2 \, dx \\[5pt] &= \frac{1}{3} \left[ x^4 - x^3 \right]_{-1}^2 \\[5pt] &= \frac{1}{3} \left[ 16 - 8 - (1 + 1) \right] \\[5pt] &= \frac{1}{3} (8 - 2) = \frac{1}{3} \cdot 6 = 2 \end{align}$$

3.

$$f(x) = 10 e^{-3x} \phantom{000} [0, 5]$$

Solution

$$\overline{f(x)} = \frac{1}{5} \int_0^5 10 e^{-3x} \, dx$$

Let $u = -3x,$ then $du = -3 dx.$

$$ \begin{align} -\frac{1}{15} &\int_0^{-15} 10 e^u \, du \\[5pt] &= -\frac{2}{3} e^u \bigg|_0^{-15} \\[5pt] &= -\frac{2}{3} \left[ e^{-15} - e^0 \right] \\[5pt] &= -\frac{2}{3} \left[ \frac{1}{e^{15}} - 1 \right] \end{align}$$

4.

$$f(x) = x^3, \phantom{000} [-1, 1]$$


Solution

$$ \begin{align} \frac{1}{2} &\int_{-1}^{1} x^3 \, dx \\[5pt] &= \frac{1}{2} \frac{x^4}{4} \bigg|_{-1}^{1} \\[5pt] &= \frac{1}{8} x^4 \bigg|_{-1}^1 \\[5pt] &= \frac{1}{8} (1 - 1) = 0 \end{align}$$

This is an integral of an odd function $(f(-x) = -f(x))$ over a symmetric integral, so its value has to be zero. Compare the average value of this function to part 1 of example 1.

5.

$$f(x) = x^3, \phantom{000} [0, 2]$$

Solution

$$ \begin{align} \frac{1}{2} &\int_0^2 x^3 \, dx \\[5pt] &= \frac{1}{2} \frac{x^4}{4} \bigg|_0^2 \\[5pt] &= \frac{1}{8} x^4 \bigg|_0^2 \\[5pt] &= \frac{1}{8} (16 - 0) = \frac{16}{8} = 2 \end{align}$$

Compare this integral to that in problem 4.

6.

$$f(x) = \frac{1}{x^2}, \phantom{000} [2, 4]$$

Solution

$$ \begin{align} \frac{1}{2} &\int_2^4 x^{-2} \, dx \\[5pt] &= \frac{1}{2} (-x^{-1}) \bigg|_2^4 \\[5pt] &= -\frac{1}{2x} x^4 \bigg|_2^4 \\[5pt] &= -\frac{1}{8} + \frac{1}{4} = \frac{1}{8} \end{align}$$

7.

The temperature in a cooler (in ˚F) varies over time according to the function $T(t) = 18.5 + 9 cos \left(\frac{\pi}{8} t \right),$ where t is in hours after midnight. Calculate the average temperature in the cooler between 6:00 AM and 5:00 PM.

Solution

First, our interval will be 6 hours (6:00 AM) to 17 hours (5:00 PM). Then the average over that time is

$$ \begin{align} \overline{T} &= \frac{1}{17-6} \int_6^{17} \left[ 18.5 + 9 \, cos \left( \frac{\pi t}{8} \right) \right] \, dt \\[5pt] &= \frac{1}{9} \left[ 18.5 t + \frac{8}{\pi} 9 \, sin \left( \frac{\pi t}{8} \right) \right]_6^{17} \\[5pt] &= \frac{1}{9}18.5(17 - 6) + \frac{8}{\pi} \left[ sin \left( \frac{17 \pi}{8} \right) - sin \left( \frac{3 \pi}{4} \right)\right] \\[5pt] &= 18.5 - 0.826 = 17.67˚F \end{align}$$

8.

The average acceleration of an object is given by the function $a(t) = 50 t - 2 t^3 \: m/s^2.$ Calculate the average acceleration and the average speed of the object in the time interval $[1, \, 4].$ Assume that the initial speed (t = 0) of the object is zero.

Solution

The average acceleration is just the average value of the acceleration function over the interval.

$$ \begin{align} \overline{a} &= \frac{1}{3} \int_1^4 50t - 2 t^3 \, dt \\[5pt] &= \frac{1}{3} \left[ 25t^2 - \frac{1}{2} t^4 \right]_1^4 \\[5pt] &= \frac{1}{3} \left[ 400 - 128 - 25 + \frac{1}{8} \right] \\[5pt] &= \frac{1}{3} \left[ 247 + \frac{1}{8} \right] \\[5pt] &\approx 62 \, \frac{m}{s^2} \end{align}$$

Now the velocity is the integral of the acceleration, plus a constant. We did that above,

$$v = 25 t^2 - \frac{1}{2} t^4 + C$$

We can find the constant by recalling that v(0) = 0, so we have

$$ \begin{align} v(0) &= 25(0) - \frac{1}{2} (0) + C = 0 \\[5pt] C &= 0 \end{align}$$

Now we just find the average of this velocity function over the interval [1, 4]:

$$ \begin{align} \overline{v} &= \frac{1}{3} \int_1^4 25 t^2 - \frac{1}{2} t^4 \, dt \\[5pt] &= \frac{1}{3} \left[ \frac{1}{12} t^3 - \frac{1}{10} t^5 \right]_1^4 \\[5pt] &= \frac{1}{36} \left( 4^3 - 1^3 \right) - \frac{1}{30} \left( 4^5 - 1^5 \right) \\[5pt] &= \frac{1}{36} \cdot 63 - \frac{1}{30} \cdot 1023 \\[5pt] &= -32.35 \, \frac{m}{s} \end{align}$$

Creative Commons License   optimized for firefox
xaktly.com by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to jeff.cruzan@verizon.net.