Welcome to Calculus. I'm Professor Ghrist. We're about to begin Lecture 39 on averages. What's an average? An average is something that's in the middle. That doesn't sound very mathematical. But that intuition will help you as we consider what it means to take the average of a function. Averages are both ubiquitous and intuitive. If someone were to ask say, what is the average unemployment rate? Well, you might get out the graph and well, eyeball it. Try to pick a number that's sort of in the middle. That's the way it feels like it ought to be. But, of course, an average depends on a couple of factors. First of all, it depends on the interval over which you are looking. If, in the case of unemployment, you change your time interval then you might have very, very different results. And in fact the function that you're trying to average might look very, very different. And as the variation of that function increases, it becomes harder to see what we actually mean when we say average. And so we need a definition. Now our intuition says that the average of a function f, over an interval from a to b, should be the constant value where the area above and the area below balance out or are equal. Let's say about there. We would denote that average by the symbol f bar. The bar over the top, meaning the average. We can write out an integral form for this intuitive definition, namely that the integral as x goes from a to b of f minus f bar dx = 0. Now let us solve this equation for f bar. Integration is linear, so we can move the integral of f bar over to the right hand side, but by definition, f bar is supposed to be a constant, just a number, so we can pull it outside of the integral. And now solving for f bar, we get the integral of f dx over the integral of dx, both integrals running from a to b. Now you've probably seen what comes next. Namely, we evaluate the denominator to be x evaluated from a to b. That is b minus a. And then so one typically writes f bar = 1 over b- a times the integral from a to b of f dx. That is a great definition. It's fine, but it's not optimal. The better definition is in terms of the ratio of the integral of f to the integral of one. And why is this so much better? Well, instead of your integration domain being the interval from a to b, we could consider an arbitrary integration domain, D, and still have a nice definition for the average, f bar. For example, if D is a discrete set, and your f is really just a sequence of values, like say test scores, then you know the classical formula for the average. In this case it's the sum of these f values divided by n, the number of scores. But of course we could rewrite that as the sum of the f values divided by the sum of 1. As you're going from 1 to n, t hat's giving you your denominator. And this really fits into the same category of definition since a sum is really just an integral for a discrete set. Now let's look at a few examples. Let's compute the average over the interval from 0 to T of three classical functions, monomials, exponentials and logarithms. For the monomial, for x to the n, what we have to do is integrate x to the n dx, from 0 to T, and then divide by T. This is simple. You can really do it in your head. What do you get? You get T to the n, that is the function evaluated at the right hand endpoint, divided by n+1. That's the average value of x to the n over this interval. What about the exponential? e to the x goes beyond polynomial growth. Well this too is an integral that we can do in our head. But notice what you get, you get the right-hand end point, e to the T- 1, divided not by any n, but by T. So it's as if all the growth that happens in the exponential function happens right at the end. Now lastly, for the logarithm, we're gonna have to change our lower integration value to 1, rather than 0. But notice what happens. When we integrate ln x, we get x ln x- x, through integration by parts if you'd like. When we evaluate this, we see that the average value for ln x on the interval from 1 to T is exactly ln T, minus a little bit. This is, again, telling you how slowly ln x grows. Its average value is almost equal to the right hand end point. That's pretty cool. Let's do another example. What is the density of the earth? By which I mean, the average density, since it changes. Recall, we know a little something about the volumetric density function, rho is a function of r, radial distance. Now you might be tempted to look at this graph and try to eyeball it and figure out the average density there. But be careful. We have to use this integral formulation. rho bar is not the integral of rho(r) dr over the integral of dr. That is not what it is, because of course rho is a volumetric density, and so our integration must be done with respect to the volume form. rho bar is the integral of rho dV over the integral of one times dV. Now rho dV, as we recall, is really just the mass element. And so in retrospect it's really kind of obvious that what we would do to compute the average density is compute the mass, the integral of dM over the volume, the integral of dV. And you can write that out more explicitly if you wish. Let's turn to another example. This time involving blood flow through a tubular vessel. There is something called, Poiseuille's Law that tells you how the velocity of the fluid varies with respect to location in the cylindrical vessel. If we look at a cross section that is going be a disk of radius capital R, there's some maximal velocity, but the velocity is going to be a function of the radial distance, little r. This is going to be a quadratic function. Poiseuille's Law says that the velocity, v, as a function of radial distance, R, is P over 4 mu l times quantity (big R squared- little r squared). In this case, P is a pressure, mu is a viscosity, l is the length of the vessel. But don't worry about all that stuff, it's just constants in this case. What we are gonna worry about is the average velocity, v bar. Now in this case, what do we integrate with respect to? It's got to be with respect to the area element, since we're taking a cross-sectional area. v bar is the integral of v dA over the integral of dA. In this case, dA is an annular strip with constant little r, that is 2 pi r dr. Now plugging in our formula for v, well what do we get? Well, first of all the denominator gives a pi R squared, that we know. And so, what we have left is the numerator. That is the integral as little r goes from 0 to big R of this constant P over 4 mu l times quantity, (big R squared- little r squared) times the area element 2 pi r dr. And we can simplify that integral quite a bit. Pulling out the P over 4 mu l constant, canceling the pis, pulling the 2 outside. And then what do we have left? Well, some big constant times a simple integral. We have to integrate big R squared times little r, dr. That gives big R squared, little r squared over 2 and then we have to subtract off the interval of little r cubed, that's little r to the 4th over 4. Evaluate from zero to big R, and what do we get? Well, we get something that looks a little complicated at first, but is not so bad. Some of the big Rs and the coefficients cancel. And we're left with P over 4 mu l times big R squared over 2. If we consider our initial velocity profile, we see that this is really just one-half times the maximal velocity at the center of the tube. That's a nice result. For our last example consider what happens when you plug something into the wall. With alternating currents, the voltage is going to be sinusoidal. The voltage as a function of time is going to be some constant Vp times sine (omega t). This constant, Vp, is the amplitude or peak voltage. Omega is giving you some sort of frequency of oscillation. The period is going to be defined as 2pi over omega. Now the question is, what is the average voltage? Well the problem is, over every period, if we compute the average, we wind up integrating the sine function over an entire period from 0 to 2 pi, as it were. I'll let you do the computation to see, but the average voltage is 0. That is totally useless for our purposes. So, what we do is define a different type of average. This is called the root mean square in some circles. Sometimes it's called the quadratic mean. The root mean square is defined as follows, square your function f, take the average of the square and then take the square root of that. So this square root, the average of the square, will give us something that is non zero because that squaring makes all of the negative terms positive. In the case that we looked at before, the root mean square voltage, VRMS, is what? We square the voltage. Vp squared times sine squared (omega t), then we average that, taking the integral from 0 to 2 pi over omega and dividing by that length, 2 pi over omega, then square rooting. Now this integral is not so bad. We can use the double angle formula. And take advantage of the fact that we're integrating over full period, so that that cosine term integrates to 0. Then, we're left with the square root of omega over 2 pi times Vp squared times one-half t, as t goes from 0 to 2 pi over omega. Well, that evaluates simply enough and wonderful to say, cancels the period, and we're left with Vp over the square root of 2. Now, in practice that works out to about 71% of the peak voltage. That's what the root mean square is, so if you see something that is labeled at 120 volts, what you're really getting is that root mean square voltage. The peak voltage is actually bigger, at almost 170 volts. This lesson should lead you to wonder what other kinds of things can be averaged. Can you average locations, or points on a map? What happens when birds fly in a flock? They seem to do so with a great deal of coordination. What they are often doing is simply averaging the orientations or the directions of their neighbors. Fish do similar things. What other kinds of things can be averaged? Can we average things like faces? Can we take a collection of human faces and compute an average? In what way would that be like an integral? These are all excellent questions that, with enough mathematics, you can answer. We now know how to average a function over a domain, and we've seen hints that there are more interesting types of averages out there. In our next lesson we'll look at what it means to average a collection of locations or positions. Some of the integrals involved are going to be a bit intricate. You might wanna take a look at the Lecture 31 bonus material before beginning.