BetaFree coursewareRewritten from MIT OpenCourseWareCC BY-NC-SA 4.0
Open CosmologyPhysics & cosmology, from high school to a graduate year

Average value, weighted averages and probability

The average of a function over an interval is its integral divided by the length of the interval: the continuous version of adding n numbers and dividing by n. An average depends on the variable you average over, and a weighted average divides by the total weight. Probability is a weighted average too: the part divided by the whole. The Gaussian integral, worth √π, is found by computing one volume in two ways.

You need this first

Full reading path (18 pages)
  1. The derivative: slope of the tangent line and rate of change (18.01)
  2. Limits and continuity (18.01)
  3. Derivatives of sine and cosine, and the product and quotient rules (18.01)
  4. The chain rule and higher derivatives (18.01)
  5. Implicit differentiation and the derivatives of inverse functions (18.01)
  6. Exponentials and logarithms: the number e and its derivatives (18.01)
  7. Linear and quadratic approximations (18.01)
  8. Curve sketching with the first and second derivative (18.01)
  9. Sketching strategy and maximum–minimum problems (18.01)
  10. More max–min, and related rates (18.01)
  11. A ring on a string, and Newton's method (18.01)
  12. The mean value theorem and inequalities (18.01)
  13. Differentials and antiderivatives (18.01)
  14. Definite integrals and Riemann sums (18.01)
  15. The first fundamental theorem of calculus (18.01)
  16. The second fundamental theorem of calculus (18.01)
  17. The logarithm from an integral, and areas between curves (18.01)
  18. Volumes by disks and shells (18.01)
On this page · 6 sections
  1. The average value of a function
  2. The average depends on the variable
  3. Weighted averages
  4. Probability: the part over the whole
  5. Darts and the Gaussian integral
  6. Summary

Despite its title on OCW, this lecture has no work in the physicist's sense. It puts off boiling the witches' cauldron for a moment to take up one of the most important uses of integrals: averages (transcript, p. 1). The cauldron then returns as an example of a weighted average, and averages lead straight to probability.

The average value of a function#

Sample ff at equally spaced points x1,…,xnx_1, \dots, x_n in [a,b][a, b], with spacing Δx=(b−a)/n\Delta x = (b - a)/n, and average the values yi=f(xi)y_i = f(x_i) (transcript, p. 1; notes, p. 1). The Riemann sum (y1+⋯+yn)Δx(y_1 + \cdots + y_n)\Delta x tends to the integral; dividing both by b−ab - a, and noting Δx/(b−a)=1/n\Delta x/(b - a) = 1/n:

Continuous average
lim⁡n→∞y1+⋯+ynn=1b−a∫abf(x) dx\lim_{n\to\infty}\frac{y_1 + \cdots + y_n}{n} = \frac{1}{b - a}\int_a^b f(x)\,dx
In words

the limit as n goes to infinity of the quantity y one plus and so on plus y sub n, all over n equals 1 over the quantity b minus a, times the integral from a to b of f(x) d x

The average and the integral differ only by the division by the length of the interval (p. 1). That factor is exactly what makes the average of a constant equal to the constant: 1b−a∫abc dx=c\frac{1}{b - a}\int_a^b c\,dx = c (p. 2; notes, p. 2).

The average depends on the variable#

Average height of a point on the upper unit semicircle, y=1−x2y = \sqrt{1 - x^2}, with respect to xx (transcript, p. 2; notes, p. 2): the integral is the area of the half-disk, π/2\pi/2, so

Average height, with respect to x
12∫−111−x2 dx=12⋅π2=π4\frac{1}{2}\int_{-1}^{1}\sqrt{1 - x^2}\,dx = \frac12\cdot\frac{\pi}{2} = \frac{\pi}{4}
In words

one half the integral from minus 1 to 1 of the square root of 1 minus x squared, end of root, d x equals one half times pi over 2 equals pi over 4

Now average the height with respect to arc length, the angle θ\theta from 0 to π\pi, where the height is sin⁡θ\sin\theta (pp. 3–4; notes, p. 3):

Average height, with respect to θ
1π∫0πsin⁡θ dθ=1π[−cos⁡θ]0π=2π\frac{1}{\pi}\int_0^\pi \sin\theta\,d\theta = \frac{1}{\pi}\Big[-\cos\theta\Big]_0^\pi = \frac{2}{\pi}
In words

1 over pi, times the integral from 0 to pi of sine theta d theta equals 1 over pi ( minus cos theta ) sub 0 superscript pi equals 2 over pi

A different answer, and smaller, since π2>8\pi^2 > 8. Near the ends of the semicircle a short step in xx is a long step along the arc, so averaging over θ\theta gives more weight to the low parts (pp. 3–5). "The average" means nothing until you say what you average over: picking xx at random or picking a point on the arc at random are different experiments (p. 4).

Weighted averages#

More flexible, and closer to real problems, is the weighted average (transcript, pp. 5–6):

Weighted average
∫abf(x) w(x) dx∫abw(x) dx\frac{\int_a^b f(x)\,w(x)\,dx}{\int_a^b w(x)\,dx}
In words

the integral from a to b of f(x) w(x) d x over the quantity the integral from a to b of w(x) d x

Divide by the total weight, so that again the average of a constant cc is cc (p. 5). The discrete version: shares bought at 10, 20 and 30 dollars in different amounts; the average price is the total spent divided by the total number of shares (p. 6). Unlike a constant, a general ff cannot be pulled out, so a weighted average needs two integrals (p. 6).

The cauldron. Heat the 1 m cauldron y=x2y = x^2 to a final temperature T=100−30yT = 100 - 30y °C (transcript, pp. 6–9; notes, p. 3). TT is constant on horizontal layers, so slice into disks of volume πx2 dy=πy dy\pi x^2\,dy = \pi y\,dy. The total heat, in degrees × cubic metres, is ∫01(100−30y) πy dy=40π\int_0^1 (100 - 30y)\,\pi y\,dy = 40\pi, about 500 candy bars' worth, as in Lecture 22 (pp. 7–8). The average final temperature is a weighted average with weight πy\pi y, the volume at each height (pp. 8–9):

Average temperature of the cauldron
Tˉ=∫01T πy dy∫01πy dy=40ππ/2=80∘C\bar T = \frac{\int_0^1 T\,\pi y\,dy}{\int_0^1 \pi y\,dy} = \frac{40\pi}{\pi/2} = 80^\circ\text{C}
In words

T bar equals the integral from 0 to 1 of T pi y d y over the quantity the integral from 0 to 1 of pi y d y, equals 40 pi over the quantity pi over 2, equals 80 degrees coulombs

That is lower than the plain average of the hottest and coolest water, (100+70)/2=85(100 + 70)/2 = 85 °C, because the cauldron is widest at the top, where the water is cooler (p. 9; notes, pp. 3–4).

Worked example

A weighted average price

You buy 100 shares at 12 dollars each, then 50 at 18 dollars and 50 at 30 dollars. What did you pay per share on average? Compare with the average of the three prices.

Weighted

100×12+50×18+50×30100+50+50=3600200=18.00\dfrac{100 \times 12 + 50 \times 18 + 50 \times 30}{100 + 50 + 50} = \dfrac{3600}{200} = 18.00 dollars.

Unweighted

(12+18+30)/3=20(12 + 18 + 30)/3 = 20 dollars: too high, because more shares were bought at the lowest price.

Probability: the part over the whole#

Probability is a special weighted average, where the "function" is 1 on the part you care about and 0 elsewhere (transcript, pp. 9–11). Pick a point at random, uniformly by area, under y=1−x2y = 1 - x^2 for −1≤x≤1-1 \le x \le 1. The probability that x>12x > \tfrac12 is the part divided by the whole (p. 10):

A probability as a ratio of areas
P(x>12)=∫1/21(1−x2) dx∫−11(1−x2) dx=5/244/3=532P\left(x > \tfrac12\right) = \frac{\int_{1/2}^{1}(1 - x^2)\,dx}{\int_{-1}^{1}(1 - x^2)\,dx} = \frac{5/24}{4/3} = \frac{5}{32}
In words

P (x greater than one half ) equals the integral from one half to 1 of the quantity 1 minus x squared, d x over the quantity the integral from minus 1 to 1 of the quantity 1 minus x squared, d x, equals the quantity 5 over 24, all over the quantity four thirds, equals 5 over 32

(The lecture quotes 518\tfrac{5}{18}, then doubts it, since the answer should be less than 14\tfrac14; it is 532≈0.16\tfrac{5}{32} \approx 0.16, pp. 10–11.) In general, for a point chosen with weight ww on [a,b][a, b] (p. 11):

Probability with a weight
P(x1<x<x2)=∫x1x2w(x) dx∫abw(x) dxP(x_1 < x < x_2) = \frac{\int_{x_1}^{x_2} w(x)\,dx}{\int_a^b w(x)\,dx}
In words

P( x one less than x less than x two ) equals the integral from x one to x two of w(x) d x over the quantity the integral from a to b of w(x) d x

Worked example

A random point in a triangle

A point is chosen at random, uniformly by area, in the triangle under y=xy = x, 0≤x≤10 \le x \le 1. Find the probability that x>12x > \tfrac12.

Part over whole

∫1/21x dx∫01x dx=1/2−1/81/2=3/81/2=34\dfrac{\int_{1/2}^{1} x\,dx}{\int_0^1 x\,dx} = \dfrac{1/2 - 1/8}{1/2} = \dfrac{3/8}{1/2} = \dfrac34.

Why not one half?

Half the xx-range, but three quarters of the area: the triangle is taller on the right, so points there are more likely.

Darts and the Gaussian integral#

The lecture ends by announcing a darts problem; the notes work it out (notes, pp. 4–10). Darts land at distance rr from the centre with weight c e−r2c\,e^{-r^2} per unit area, so a thin ring of radius rr and width drdr has weight c e−r2 2πr drc\,e^{-r^2}\,2\pi r\,dr, the shells of the last lecture. Someone standing in a sixth of the ring 2r1<r<3r12r_1 < r < 3r_1, for a player who hits the board (r<r1r < r_1) half the time, gets hit by about 1% of the darts (notes, pp. 5–6).

The notes then compute one of the most important integrals of all (notes, pp. 7–10). Let Q=∫−∞∞e−x2 dxQ = \int_{-\infty}^{\infty} e^{-x^2}\,dx. The volume under the surface e−r2e^{-r^2}, with r2=x2+y2r^2 = x^2 + y^2, is ∫0∞e−r2 2πr dr=π\int_0^\infty e^{-r^2}\,2\pi r\,dr = \pi by shells. By slices at fixed yy, each cross-section has area e−y2Qe^{-y^2}Q, so the volume is Q2Q^2. Hence

The Gaussian integral
∫−∞∞e−x2 dx=π\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt\pi
In words

the integral from minus infinity to infinity of e to the power minus x squared d x equals the square root of pi

which gives the limit π/2\sqrt\pi/2 promised in Lecture 21 and the normalization of the normal distribution 12π σe−x2/2σ2\frac{1}{\sqrt{2\pi}\,\sigma}e^{-x^2/2\sigma^2} of statistics (notes, p. 10).

Summary#

  • Average of ff on [a,b][a, b]: 1b−a∫abf dx\frac{1}{b - a}\int_a^b f\,dx. The average of a constant is the constant.
  • The average depends on the variable: the semicircle's height averages π/4\pi/4 over xx but 2/π2/\pi over the arc.
  • Weighted average: ∫fw dx/∫w dx\int f w\,dx \big/ \int w\,dx; the cauldron's water averages 80 °C, not 85 °C.
  • Probability: part over whole, ∫x1x2w dx/∫abw dx\int_{x_1}^{x_2} w\,dx \big/ \int_a^b w\,dx.
  • ∫−∞∞e−x2dx=π\int_{-\infty}^{\infty} e^{-x^2}dx = \sqrt\pi, by computing one volume with shells and with slices.

Symbols on this page

Show the 40 symbols used here
δ\delta delta.
In the cosmology note, the density contrast of a region (δ_c: the value needed to collapse). Say it: “delta”.
Δ\Delta capital delta.
A change or difference in a quantity, e.g. Δx = x₂ − x₁. Say it: “capital delta”.
θ\theta theta.
An angle. Say it: “theta” (sounds like “thay-ta or thee-ta”).
π\pi pi.
The ratio of a circle's circumference to its diameter, π ≈ 3.14159. Say it: “pi”.
σ\sigma sigma.
The standard deviation of a normal distribution (in the cosmology note, of the density contrast). Say it: “sigma”.
∞\infty infinity.
Infinity: larger than any number. Say it: “infinity”.
∘\circ degree.
Degrees Celsius of temperature (°C). Say it: “degrees”.
≈\approx approximately equal.
Is approximately equal to. Say it: “is approximately”.
≤\le less than or equal.
Is less than or equal to. Say it: “is less than or equal to”.
→\to arrow.
Goes to (tends to), or becomes. Say it: “goes to”.
×\times times.
Times (multiplication). Between two vectors: the cross product. Say it: “times”.
⋅\cdot dot.
Times (multiplication). Between two vectors: the dot product. Say it: “times”.
∫\int integral.
Integral: the sum of infinitely many small pieces, such as the area under a curve. Say it: “the integral of”.
lim⁡\lim limit.
Limit: the value approached as the variable written below approaches its target. Say it: “the limit”.
sin⁡\sin sine.
Sine of an angle. Say it: “sine”.
cos⁡\cos cosine.
Cosine of an angle. Say it: “cos”.
ρˉ\bar\rho bar.
A mean (average) value, such as ρ̄; in 8.902 also a smoothed field (δ̄). Say it: “bar”.
aa a.
The left end of the interval a ≤ x ≤ b (in the probability formula, the start of the whole range). Say it: “a”.
cc c.
A constant (the dartboard's density constant c). Say it: “c”.
TT T.
The temperature of the water at height y in the cauldron. Unit: °C. Say it: “T”.
δc\delta_{c} collapse threshold.
The critical linear density contrast: a region has collapsed when linear theory gives it δ ≈ 1.69. Say it: “delta c”.
xx x.
The variable of integration (for the semicircle, the horizontal coordinate). Say it: “x”.
yy y.
Height: on the semicircle, y = √(1 − x²); in the cauldron, height above the bottom (in metres). In the Gaussian volume, the second horizontal coordinate (r² = x² + y²). Say it: “y”.
dd d.
As in dx, dy, dθ and dr: the variable of integration. Say it: “d”.
nn n.
The number of sample points. Say it: “n”.
ee e.
Euler's number, e ≈ 2.718. Say it: “e”.
ff f.
The function being averaged. Say it: “f”.
rr r.
The distance of a dart from the centre of the board (r² = x² + y² in the Gaussian volume). Say it: “r”.
PP P.
A probability (a number between 0 and 1). Say it: “P”.
QQ Q.
The Gaussian integral ∫ e^(−x²) dx over all x, which equals √π. Say it: “Q”.
bb b.
The right end of the interval. Say it: “b”.
r1r_{1} r one.
The radius of the dartboard. Say it: “r one”.
ww w.
A weight: the relative importance of each value of x. Say it: “w”.
x1x_{1} x 1.
The lower end of the range whose probability is wanted (x₁ is also the first sample point). Say it: “x one”.
x2x_{2} x 2.
The upper end of the range whose probability is wanted. Say it: “x two”.
y1y_{1} y 1.
The first sampled value, f(x₁). Say it: “y one”.
xnx_{n} x n.
The last sample point, x_n = b. Say it: “x sub n”.
xix_{i} x i.
The i-th equally spaced sample point. Say it: “x sub i”.
yiy_{i} y i.
The i-th sampled value, f(xᵢ). Say it: “y initial”.
yny_{n} y n.
The last sampled value, f(x_n). Say it: “y sub n”.

Tap or click a symbol in a formula to see the same explanation. All symbols: symbols and notation.

Words on this page

Show the 24 words used here

New here

with respect to.
Taking that variable as the one that changes: a derivative with respect to t measures change as t changes, others held fixed.
weight.
How much one value counts in a weighted average or sum, compared with the others.

Also used

OCW.
OpenCourseWare: MIT's free website of course materials, the source of every MIT lesson on this site.
integral.
A sum of very many very small pieces, such as the area under a graph; it undoes taking a derivative. Explained in Rates of change and area under a graph.
p..
Page, in a reference to a source; pp. means pages, as in pp. 3–5.
weighted average.
An average in which some values count more: each is multiplied by its weight, and the total divided by the sum of the weights. Explained in Centre of mass and its motion.
Riemann sum.
An estimate of an integral: cut the interval into strips, multiply each strip's width by a value of the function in it, and add. Explained in Definite integrals and Riemann sums.
interval.
A stretch between two values or two moments; in maths, all the numbers between two end points. Explained in Time dilation, length contraction and the interval.
arc length.
The length of a curve measured along the curve itself, as a piece of string laid along it would show. Explained in Derivatives of sine and cosine, and the product and quotient rules.
uniform.
The same at every point, or unchanging in time: a uniform rod has the same density all along it. Explained in The electric field.
cross section.
The flat shape or area obtained by cutting through a solid, usually at right angles to its length. Explained in More max–min, and related rates.
limit.
The value a quantity gets closer and closer to, as near as we like, as its input approaches some value, without having to reach it. Explained in Rates of change and area under a graph.
normal distribution.
The bell-shaped probability curve, highest at the average and falling off equally on both sides; it describes many sums of random effects. Explained in Differential equations and separation of variables.
statistics.
The mathematics of data and chance, or the averages, spreads and other numbers that describe how a random quantity behaves. Explained in Measuring structure: the power spectrum and the correlation function.
density.
How much of something (mass, charge, energy, particles or probability) there is in each unit of volume, area, length or other variable. Explained in Density and pressure.
fluctuation.
A departure of a quantity from its average value, usually small and random, from moment to moment or from place to place. Explained in Zero-point energy, fluctuations and surprises.
inflation.
A proposed burst of enormously fast expansion in the first tiny fraction of a second, which made the universe smooth and flat. Explained in Inflation.
Gaussian.
The bell-shaped curve e to the minus x squared, or a quantity spread out with that shape; also called a normal distribution. Explained in Probability: sums of random variables and the central limit theorem.
density contrast.
How much denser or thinner than average a region is, as a fraction of the average density. Explained in How small ripples grow: linear perturbation theory.
halo.
A large, roughly round cloud of dark matter, held together by its own gravity, inside which a galaxy or a cluster of galaxies sits. Explained in When ripples collapse: the spherical collapse model.
Press–Schechter.
A simple method for predicting how many dark matter halos of each mass exist, from the statistics of the smoothed early density ripples. Explained in How many halos? The Press–Schechter mass function.

Academic

transcript.
A written record of exactly what was said in a recorded lecture, word for word.
hence.
For this reason; as a result of what was just said.
approximation.
Close to, but not exactly, the true value; an approximation is such a value or formula, chosen because it is simpler.

Tap or click a word, here or in the text, for its meaning in this lesson. All words: the glossary. How many words are marked in the text: Reading options (the “Aa” button).

Where this leads

In cosmology

Pages that build on this

Practise

Check your understanding

  1. The average value of ff on [a,b][a, b] is…
  2. The average height of the upper unit semicircle is π/4≈0.785\pi/4 \approx 0.785 with respect to xx. With respect to the angle θ\theta it is…
  3. You buy 100 shares at 12 dollars, then 50 at 18 dollars and 50 at 30 dollars. The average price per share is…
  4. A point is picked at random (uniformly by area) in the triangle under y=xy = x, 0≤x≤10 \le x \le 1. The probability that x>1/2x > 1/2 is…
0 of 4 answered

Flashcards

1 / 4