Average Value of a function

If we have a function in some range [a,b] we can ask what the average value of the function is. We are going to do this in a very intuitive way. We split up the curve into n points and take the average of those points, and then ask what happens to that number as we take the number of points to infinity. Let’s consider the curve y=x^2-x^3 between -3 and 3. If we take seven points along the curve (ie. at x=-3,-2,-1,0,1,2,3) We will get the function values: f(x)=36, 12, 2, 0, 0, -4, -18. as can be seen here:

plotsamp
The average value of the function when we take just seven sample points is thus: \frac{36+ 12+ 2+ 0+ 0 -4 -18}{7}=4. The figure below shows what happens when we take more and more points. We see that the mean value converges to a fixed number,in this case 3.

npoints
But there is a better way to do this and again, it involves integration. What we have written down so far is that for n+1 sample points, which have a distance \Delta x in between them, starting at x=a, the mean value of the function is:

 

Mean=\frac{\sum_{i=0}^nf(x_i)}{n}

 

If we multiply and divide this by \Delta x we get:

 

Mean=\Delta x\frac{\sum_{i=0}^nf(x_i)}{n\Delta x}

 

but n\Delta x is just b-a and so we can take the limit of this as a Riemann sum and get:

 

Mean=\frac{\int_a^bf(x)dx}{(b-a)}

 

This makes intuitive sense. Just as the mean of a sample of items is just the sum of the items divided by the number of them, so the mean value of a function is just the integral of the function (the limit of a Riemann sum) divided by the total distance in between the limits. In fact we can think about this in another way. If the mean of the function is M and the interval is b-a then M(b-a) as the area of a rectangle between b and a with height M and this is equal to the total integral of the function – ie. the area under the curve. This says that we can write the area under the curve as the mean value of the function times the interval, which again makes intuitive sense. Taking the example from the figure at the top of the post, we find that the mean value is:

 

Mean=\frac{\int_{-3}^3 x^2-x^3}{6}=\frac{\left.\frac{x^3}{3}-\frac{x^4}{4}\right|_{-3}^3}{6}=3

 

and thus the area under the curve is equal to 3 times the interval (6) 18. In this example you have to be a bit careful because there is both a positive and negative contribution to the area under the curve but you can see from the figure below that the total area under the curve (both the negative and positive contributions added together) equals the area under the mean value line (the red line) which is at y=3.

meanvalue
We can go further than this and make a statement about the mean value itself. This is given by the Mean Value Theorem for integration:

The Mean Value Theorem for integrals:
 
If f is a continuous function on [a,b], then there exists at least one number c in [a,b] such that:

 

\int_{a}^b f(x) dx=f(c)(b-a)

 

This says that the mean value of the function must be a value of the function which is within the upper and lower bounds of f between a and b. In other words, the line y = “Mean Value of f” must intersect the function itself at least once between x=a and b. We can see that this is true in the figure above where the intersection of the red line (the mean line) with the function is at  roughly (-1.175,3). The value c in the mean value theorem is found by saying that, in this case: x^2-x^3=3. This has only one real solution which is at x\approx -1.175.

Let’s look at another example:

If f(x)=\cos^4 x\sin x and we want to know the mean value of this function between 0 and \pi, this is given by:

 

Mean=\frac{\int_0^\pi \cos^4x\sin x dx}{\pi}=\frac{\left.\frac{-\cos^5x}{5}\right|_{0}^\pi}{\pi}=\frac{2}{5\pi}

 

Now we can ask what the value of c is for which:

 

\int_0^\pi \cos^4x\sin x dx=f(c)\pi

 

Which is the same as asking for what value of c is:

 

f(c)=Mean=\frac{2}{5\pi}

 

In fact there are four solutions to this equation for c between 0 and \pi as can be seen in this figure.

foursols

These values are approximately (0.13, 0.88, 2.26, 3.01)

How clear is this post?