Unit 5, lesson 72

Integration in Probability Theory

How a probability density turns probabilities into areas, and how integrals give the distribution function, the mean, the variance and the standard deviation, when they exist.

  • Theory part 143
  • Practice part 144
  • Applications of Integration

How long will a light bulb last? The answer could be any positive number, so asking for the chance of exactly 10001000 hours makes little sense. The useful question is the chance that it lasts between 900900 and 11001100 hours. For quantities like this, probability becomes area under a curve, and integrals do the work.

Key terms

Continuous random variable

Definition A random variable XX is continuous if there is a nonnegative function ff, integrable on every bounded interval and called its density, such that for all real numbers a≤ba \le b

P(a≤X≤b)=∫abf(x) dx.P(a \le X \le b) = \int_a^b f(x) \, dx.

It follows that every single value aa has probability

P(X=a)=∫aaf(x) dx=0,P(X = a) = \int_a^a f(x) \, dx = 0,

so it does not matter whether the endpoints are included.

In plain words A continuous random variable can take any value in an interval, like a time, a length or a weight. Single values have probability zero, and only ranges of values carry probability.

Example If a bus arrives at a random time between 00 and 1010 minutes from now, with every moment equally likely, the waiting time XX has density f(x)=110f(x) = \frac{1}{10} on [0,10][0, 10] and 00 elsewhere. Then

P(2≤X≤5)=∫25110 dx=0.3.P(2 \le X \le 5) = \int_2^5 \frac{1}{10} \, dx = 0.3.

Probability density

Definition A probability density function is a function ff with f(x)≥0f(x) \ge 0 for all xx, integrable on every bounded interval, such that

∫−∞∞f(x) dx=1.\int_{-\infty}^{\infty} f(x) \, dx = 1.

The value f(x)f(x) is not itself a probability. When ff is continuous at xx and Δx>0\Delta x > 0 is small,

P(x≤X≤x+Δx)≈f(x) Δx.P(x \le X \le x + \Delta x) \approx f(x) \, \Delta x.

In plain words The density shows where the values tend to fall. Probabilities are areas under its graph, and the total area is one.

Example The lifetime XX in years of a part has density f(x)=2e−2xf(x) = 2e^{-2x} for x≥0x \ge 0 and f(x)=0f(x) = 0 for x<0x < 0. The chance it fails within a year is

P(0≤X≤1)=∫012e−2x dx=1−e−2≈0.865.P(0 \le X \le 1) = \int_0^1 2e^{-2x} \, dx = 1 - e^{-2} \approx 0.865.

Normalization

Definition Let g(x)≥0g(x) \ge 0 for all xx, with gg integrable on every bounded interval and

0<I=∫−∞∞g(x) dx<∞.0 < I = \int_{-\infty}^{\infty} g(x) \, dx < \infty.

Then f=g/If = g / I is a probability density. Choosing the constant cc so that cgc g has total integral 11 is called normalization.

In plain words You often know the shape of a density but not its height. Scale it so the total area is exactly one.

Example Find cc so that f(x)=c x(2−x)f(x) = c\,x(2 - x) on [0,2][0, 2], and 00 elsewhere, is a density. Since

∫02x(2−x) dx=4−83=43,\int_0^2 x(2 - x) \, dx = 4 - \frac{8}{3} = \frac{4}{3},

we need c=34c = \frac{3}{4}.

Cumulative distribution function

Definition The cumulative distribution function of XX is

F(x)=P(X≤x)=∫−∞xf(t) dt.F(x) = P(X \le x) = \int_{-\infty}^{x} f(t) \, dt.

It is continuous and nondecreasing, lim⁡x→−∞F(x)=0\lim_{x \to -\infty} F(x) = 0, lim⁡x→∞F(x)=1\lim_{x \to \infty} F(x) = 1, and P(a<X≤b)=F(b)−F(a)P(a < X \le b) = F(b) - F(a). By the fundamental theorem of calculus, F′(x)=f(x)F'(x) = f(x) at every xx where ff is continuous.

In plain words The value F(x)F(x) is the area under the density to the left of xx. It climbs from 00 to 11.

Example For the lifetime density 2e−2x2e^{-2x} above, F(x)=0F(x) = 0 for x<0x < 0 and F(x)=1−e−2xF(x) = 1 - e^{-2x} for x≥0x \ge 0. So

P(0.5<X≤1)=F(1)−F(0.5)=e−1−e−2≈0.233.P(0.5 < X \le 1) = F(1) - F(0.5) = e^{-1} - e^{-2} \approx 0.233.

Expected value

Definition The expected value, or mean, of XX with density ff is

μ=E[X]=∫−∞∞xf(x) dx,\mu = E[X] = \int_{-\infty}^{\infty} x f(x) \, dx,

defined only when

∫−∞∞∣x∣f(x) dx<∞.\int_{-\infty}^{\infty} \lvert x \rvert f(x) \, dx < \infty.

In plain words The mean is the balance point of the density. If you cut its graph out of cardboard, it would balance on a pin at μ\mu.

Example For f(x)=34x(2−x)f(x) = \frac{3}{4} x(2 - x) on [0,2][0, 2],

E[X]=34∫02(2x2−x3) dx=34(163−4)=1.E[X] = \frac{3}{4} \int_0^2 (2x^2 - x^3) \, dx = \frac{3}{4} \left( \frac{16}{3} - 4 \right) = 1.

That fits the picture, since the graph is symmetric about x=1x = 1.

Variance

Definition Suppose the second moment

E[X2]=∫−∞∞x2f(x) dxE[X^2] = \int_{-\infty}^{\infty} x^2 f(x) \, dx

is finite. Then the mean μ\mu exists, and the variance of XX is

Var⁡(X)=∫−∞∞(x−μ)2f(x) dx=E[X2]−μ2.\operatorname{Var}(X) = \int_{-\infty}^{\infty} (x - \mu)^2 f(x) \, dx = E[X^2] - \mu^2.

In plain words Variance measures how far values typically fall from the mean, using squared distances.

Example For the same density

E[X2]=34∫02(2x3−x4) dx=34(8−325)=65,E[X^2] = \frac{3}{4} \int_0^2 (2x^3 - x^4) \, dx = \frac{3}{4} \left( 8 - \frac{32}{5} \right) = \frac{6}{5},

so Var⁡(X)=65−1=15\operatorname{Var}(X) = \frac{6}{5} - 1 = \frac{1}{5}.

Standard deviation

Definition The standard deviation of XX is σ=Var⁡(X)\sigma = \sqrt{\operatorname{Var}(X)}, defined whenever the variance is.

In plain words Taking the square root brings the spread back to the same units as XX, so it can be compared with the values themselves.

Example The density 34x(2−x)\frac{3}{4} x(2 - x) has σ=1/5≈0.447\sigma = \sqrt{1/5} \approx 0.447. For the lifetime density 2e−2x2e^{-2x} a similar calculation gives mean 12\frac{1}{2} and standard deviation 12\frac{1}{2} year.

Normal distribution

Definition For a real number μ\mu and σ>0\sigma > 0, the normal distribution with mean μ\mu and standard deviation σ\sigma has density

f(x)=1σ2π e−(x−μ)2/(2σ2),−∞<x<∞.f(x) = \frac{1}{\sigma \sqrt{2\pi}} \, e^{-(x - \mu)^2 / (2\sigma^2)}, \qquad -\infty < x < \infty.

That it is normalized follows from the Gaussian integral

∫−∞∞e−x2 dx=π.\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}.

Its antiderivative is not an elementary function, so probabilities are found from tables or numerically.

In plain words This is the bell curve, centered at μ\mu, wider when σ\sigma is larger. Many measured quantities are close to normally distributed.

Example Suppose heights are normal with μ=170\mu = 170 cm and σ=8\sigma = 8 cm. About 68.3%68.3\% of values lie within one standard deviation of the mean and about 95.4%95.4\% within two, so

P(162≤X≤178)≈0.683,P(154≤X≤186)≈0.954.P(162 \le X \le 178) \approx 0.683, \qquad P(154 \le X \le 186) \approx 0.954.

Existence of moments

Definition For a positive integer nn, the nnth moment of XX is

E[Xn]=∫−∞∞xnf(x) dx.E[X^n] = \int_{-\infty}^{\infty} x^n f(x) \, dx.

It is said to exist when the integral converges absolutely, that is, when

∫−∞∞∣x∣nf(x) dx<∞.\int_{-\infty}^{\infty} \lvert x \rvert^n f(x) \, dx < \infty.

If the nnth moment exists, then so does every lower moment.

In plain words Mean and variance are improper integrals, and those can diverge. A density with a heavy tail may have no mean or no variance at all.

Example Let f(x)=2x3f(x) = \frac{2}{x^3} for x≥1x \ge 1 and 00 otherwise. It is a density, since f≥0f \ge 0 and ∫1∞2x−3 dx=1\int_1^\infty 2x^{-3} \, dx = 1. The mean is

∫1∞x⋅2x3 dx=∫1∞2x2 dx=2,\int_1^\infty x \cdot \frac{2}{x^3} \, dx = \int_1^\infty \frac{2}{x^2} \, dx = 2,

but the second moment is

∫1∞x2⋅2x3 dx=∫1∞2x dx=∞,\int_1^\infty x^2 \cdot \frac{2}{x^3} \, dx = \int_1^\infty \frac{2}{x} \, dx = \infty,

so XX has no variance.

Check yourself

  1. Find kk so that f(x)=kx2f(x) = kx^2 on [0,3][0, 3], and 00 elsewhere, is a density. Then find P(X≤1)P(X \le 1).
Show the answer

The total area is ∫03kx2 dx=9k\int_0^3 kx^2 \, dx = 9k, and setting it equal to 11 gives k=19k = \frac{1}{9}. Then

P(X≤1)=∫01x29 dx=127.P(X \le 1) = \int_0^1 \frac{x^2}{9} \, dx = \frac{1}{27}.
  1. A random variable is uniform on [2,6][2, 6], with density 14\frac{1}{4} there. Find its mean and variance.
Show the answer

The mean and second moment are

E[X]=∫26x4 dx=4,E[X2]=∫26x24 dx=523,E[X] = \int_2^6 \frac{x}{4} \, dx = 4, \qquad E[X^2] = \int_2^6 \frac{x^2}{4} \, dx = \frac{52}{3},

so Var⁡(X)=523−16=43\operatorname{Var}(X) = \frac{52}{3} - 16 = \frac{4}{3}.

  1. A waiting time has density 0.5e−0.5x0.5e^{-0.5x} for x≥0x \ge 0. What is the chance it exceeds 44?
Show the answer

The chance is

P(X>4)=∫4∞0.5e−0.5x dx=e−2≈0.135.P(X > 4) = \int_4^\infty 0.5e^{-0.5x} \, dx = e^{-2} \approx 0.135.

How this lesson connects

It also uses probability densities.