Continuous Variables

Probability becomes area under a curve.

Counts and measurements

The number of heads in 4 tosses of a coin can only be 0, 1, 2, 3 or 4. A variable like this is discrete: its values can be listed, each has a probability, and the probabilities are drawn as bars that add up to 1.

A waiting time, a mass or a length is different. A wait can be 3 minutes, or 3.2, or 3.217, or any value in between, so the values cannot be listed one by one. A variable that can take any value in a range is continuous. Instead of bars, its distribution is drawn as a curve called a probability density function, or density for short.

The whole area is 1

A bus comes every 10 minutes, and a passenger arrives at a random moment, so the wait T is anywhere from 0 to 10 minutes, with no part of that range more likely than another. Its density is flat: a horizontal line over 0 to 10, and zero outside.

For a density, probability is area under the curve. The whole area must be 1, because the wait is certain to be somewhere from 0 to 10, just as the bars of a discrete variable add up to 1. The region under the flat line is a rectangle 10 wide, so its height must be 1 ÷ 10 = 0.1.

Probability is area over a range

The probability that the wait is between 2 and 5 minutes is the area under the density from 2 to 5. That is a rectangle 3 wide and 0.1 high, so P(2 < T < 5) = 3 × 0.1 = 0.3.

t

The density of the wait is 0.1 from 0 to 10 minutes, so the whole rectangle has area 10 × 0.1 = 1. The shaded part, from 2 to 5, has area 3 × 0.1 = 0.3, the probability of a wait between 2 and 5 minutes.

One exact value has probability 0

What is the probability that the wait is exactly 5 minutes? Take a narrow strip round 5. From 4.9 to 5.1 the strip is 0.2 wide, so its area is 0.2 × 0.1 = 0.02. From 4.99 to 5.01 it is 0.02 wide, with area 0.002. Each time the strip narrows, its area shrinks with it, and the single value 5 is a strip of width 0. So P(T = 5) = 0.

The height of the curve at 5 does not change this. A strip of width 0 has area 0 under any curve, tall or short. And 1 is the area under the whole curve, every possible wait together, not the probability of one of them.

Probability 0 does not mean impossible here: every wait is some exact value, and each exact value has probability 0. That is why questions about a continuous variable always ask about a range.

t

The strip from 4.9 to 5.1 has area 0.2 × 0.1 = 0.02. Narrow it toward the single value 5 and its area goes to 0.

Less than or at most

Since a single value has probability 0, including an end point or leaving it out changes nothing: P(T ≤ 5) = P(T < 5) = 5 × 0.1 = 0.5. For a discrete variable the two are different. If X is the number of heads, P(X ≤ 2) includes P(X = 2) and P(X < 2) does not.

A reading given to the nearest minute is a range too. "The wait was 5 minutes" means it was between 4.5 and 5.5 minutes, and that has probability 1 × 0.1 = 0.1.

The height is not a probability

The height of a density can be more than 1. Measure the same kind of wait in hours, from 0 to ½ an hour: the rectangle is ½ wide, so its height is 2, since ½ × 2 = 1. A height is probability per unit of the measurement, and only an area is a probability.

Other shapes

Most densities are not flat. Many measurements cluster near a middle value, with a density shaped like a bell. The rule is the same for every shape: the whole area under the curve is 1, and the probability of a range is the area over that range.

xy

A bell-shaped density with its center at 5. The shaded area, from 6 to 10, is the probability that the variable is more than 6, here about a quarter of the whole area.

Worked example: Waiting Time at a Walk-In Clinic with a Triangular Density, a Long Wait and the Median Wait

Question The time W minutes that a patient waits at a walk-in clinic has probability density f(w) = k(10 − w) for 0 ≤ w ≤ 10, and f(w) = 0 otherwise. (a) Find k, and the probability that a patient waits more than 6 minutes. (b) Find the median waiting time.

  1. 1.The graph of f is a triangle with base 10 and height f(0) = 10k. The total area is 1: 12 × 10 × 10k = 50k = 1, so k = 150 = 0.02.

    f(w)w10k010area = 1/2 × 10 × 10k = 50k = 1k = 1/50 = 0.02
    f(w)w10k010area = 1/2 × 10 × 10k = 50k = 1k = 1/50 = 0.02
    The density is a triangle of base 10 and height 10k, and its area must be 1: k = 0.02.
  2. 2.A wait of more than 6 minutes is the small triangle from w = 6 to w = 10. Its height is f(6) = 0.02 × 4 = 0.08, so its area is 12 × 4 × 0.08 = 0.16.

    f(w)w0.201060.08height at 6: 0.02 × 4 = 0.08area = 1/2 × 4 × 0.08 = 0.16
    f(w)w0.201060.08height at 6: 0.02 × 4 = 0.08area = 1/2 × 4 × 0.08 = 0.16
    A wait of more than 6 minutes is the small shaded triangle: 12 × 4 × 0.08 = 0.16.
  3. 3.(a) k = 0.02 and P(W > 6) = 0.16.

    f(w)w0.201060.08k = 0.02, P(W > 6) = 0.16
    f(w)w0.201060.08k = 0.02, P(W > 6) = 0.16
    (a) k = 0.02 and P(W > 6) = 0.16.
  4. 4.The area to the right of the median m is a triangle with base 10 − m and height 0.02(10 − m), and it must be 0.5: 12 × 0.02(10 − m)2 = 0.5, so (10 − m)2 = 50.

    f(w)w0.2010marea 0.51/2 × 0.02 × (10 − m)(10 − m) = 0.5(10 − m)(10 − m) = 50
    f(w)w0.2010marea 0.51/2 × 0.02 × (10 − m)(10 − m) = 0.5(10 − m)(10 − m) = 50
    The median m leaves an area of 0.5 to its right: 12 × 0.02(10 − m)2 = 0.5, so (10 − m)2 = 50.
  5. 5.Then 10 − m = √50 = 7.071, so m = 2.929; the negative root would give m = 17.07, outside 0 ≤ w ≤ 10, and is rejected. (b) The median wait is 2.93 minutes, below 5 because short waits are the most likely. Check: 0.01 × 7.0712 = 0.500.

    f(w)w0.2010m = 2.93area 0.510 − m = √50 = 7.071m = 2.93 minutes
    f(w)w0.2010m = 2.93area 0.510 − m = √50 = 7.071m = 2.93 minutes
    (b) m = 10 − √50 = 2.93 minutes, well below 5, because short waits are the most likely.

Answer: (a) k = 0.02 and P(W > 6) = 0.16; (b) 2.93 minutes

Common mistakes

  • Setting the height f(0) = 1, which gives k = 0.1. The height of a density is not a probability; it is the area under the graph that must equal 1.
  • Taking the median as 5 minutes, the middle of the range. The density is highest for short waits, so half of the area is used up well before 5 minutes.

More probability distributions problems, worked step by step →

Practice Continuous Variables in the app