• Practice
  • About 20 min
  • 5 practice questions

Continuous random variables: probability density and distribution functions

Use a probability density function to find probabilities by integration, find unknown constants, build the distribution function F(x) from f(x), and recover f(x) as the derivative of F(x).

If something looks wrong, please tell us.

By the end of this lesson you can

  • State the two conditions for a probability density function (pdf).
  • Find an unknown constant in a pdf and compute P(a ≤ X ≤ b) as an area.
  • Explain why P(X = a) = 0 for a continuous random variable.
  • Find the distribution function from the pdf and the pdf from the distribution function.

Measurements such as the current in a wire or the lifetime of a bulb can take any value in an interval, to any precision. For such continuous random variables a list of probabilities makes no sense; instead probability is spread out along the line like mass along a rod, and it is described by a density. Sums become integrals.

Probability density function

A random variable X taking values in an interval I is continuous if P(X = x) = 0 for every x in I. A non-negative function f(x) is its probability density function (pdf) if, for all a ≤ b, P(a ≤ X ≤ b) = ∫ₐᵇ f(x) dx, the area under the curve y = f(x) between a and b. A function f is a pdf if and only if (i) f(x) ≥ 0 for every x and (ii) ∫₋∞^∞ f(x) dx = 1 (total area 1).

Because P(X = a) = ∫ₐᵃ f(x) dx = 0, a single value has probability zero. So for a continuous variable P(a < X < b) = P(a ≤ X < b) = P(a < X ≤ b) = P(a ≤ X ≤ b): the signs < and ≤ may be swapped freely. Also, f(a) itself is not the probability that X = a; it is a density, and it may even be greater than 1.

Distribution function of a continuous random variable

The distribution function is F(x) = P(X ≤ x) = ∫₋∞ˣ f(u) du for every real x. It has the same properties as in the discrete case (0 ≤ F ≤ 1, non-decreasing, F(−∞) = 0, F(∞) = 1, P(X > x) = 1 − F(x), P(a < X < b) = F(b) − F(a)), and in addition F is continuous everywhere: no jumps. Going the other way, f(x) = dF/dx = F′(x) wherever the derivative exists.

Discrete and continuous side by side

  • Discrete pmf f(x) = P(X = x)
    • Σ f(x) = 1
    • F(x) = Σ f(x_i), x_i ≤ x
    • F is a staircase
    • f(x_k) = jump of F
  • Continuous pdf f(x), a density
    • ∫ f(x) dx = 1
    • F(x) = ∫₋∞ˣ f(u) du
    • F is continuous
    • f(x) = F′(x); P(X = a) = 0

Worked example 1: finding the constant, then probabilities

f(x) = kx² for 0 < x < 3 and 0 otherwise. Total area: ∫₀³ kx² dx = k[x³/3]₀³ = 9k = 1, so k = 1/9. Then P(1 < X < 2) = (1/9)∫₁² x² dx = (1/9)(8 − 1)/3 = 7/27, and P(X > 2) = (1/9)∫₂³ x² dx = (1/9)(27 − 8)/3 = 19/27. The distribution function is F(x) = 0 for x < 0, F(x) = (1/9)(x³/3) = x³/27 for 0 ≤ x < 3, and 1 for x ≥ 3. Check: 1 − F(2) = 1 − 8/27 = 19/27, as before.

Worked example 2: an exponential lifetime

The lifetime X (in thousands of hours) of a component has f(x) = k e^(−3x) for x > 0 and 0 for x ≤ 0. Total area: ∫₀^∞ k e^(−3x) dx = k[−e^(−3x)/3]₀^∞ = k/3 = 1, so k = 3. For x > 0, F(x) = ∫₀ˣ 3e^(−3u) du = 1 − e^(−3x), and F(x) = 0 for x ≤ 0. Then P(X ≤ 1) = 1 − e^(−3), P(X > 1) = e^(−3), and P(X = 1) = 0 because X is continuous.

Worked example 3: pdf from the distribution function

F(x) = 0 for x < 0, F(x) = x²/4 for 0 ≤ x < 2, and F(x) = 1 for x ≥ 2. Differentiating where possible: f(x) = x/2 for 0 < x < 2, and 0 otherwise (the values at the two corner points 0 and 2 do not affect any probability and may be chosen freely). Then P(0.5 ≤ X ≤ 1) = F(1) − F(0.5) = 1/4 − 0.25/4 = 1/4 − 1/16 = 3/16; with the pdf, ∫₀.₅¹ (x/2) dx = [x²/4]₀.₅¹ = 3/16 again.

Worked example 4: a uniform waiting time

Buses leave a stop every 20 minutes and a passenger arrives at a random time, so the waiting time X has f(x) = 1/20 for 0 ≤ x ≤ 20 and 0 otherwise (a constant density, called uniform). Check: area = 20 × 1/20 = 1. F(x) = x/20 for 0 ≤ x ≤ 20. P(X > 15) = 1 − F(15) = 1 − 3/4 = 1/4, and P(5 ≤ X ≤ 12) = (12 − 5)/20 = 7/20.

pdf: f(x) ≥ 0 and ∫₋∞^∞ f(x) dx = 1. P(a ≤ X ≤ b) = ∫ₐᵇ f(x) dx = F(b) − F(a). F(x) = ∫₋∞ˣ f(u) du and f(x) = F′(x). P(X = a) = 0.

— Continuous random variables

Key takeaways: for a continuous random variable, probability is area under the density curve. Use total area 1 to find constants. Single points carry no probability, so < and ≤ give the same answers. Integrate f to get F, differentiate F to get f, and use F(b) − F(a) as a quick route to interval probabilities.

Check your understanding

  1. 1. f(x) = kx for 0 < x < 2 (and 0 otherwise) is a probability density function. What is k?

    1. 2
    2. 1/4
    3. 1
    4. 1/2
    Show answer

    Answer: D. ∫₀² kx dx = k[x²/2]₀² = 2k. Setting 2k = 1 gives k = 1/2.

  2. 2. X is a continuous random variable with pdf f. What is P(X = 3)?

    1. 0
    2. f(3)
    3. F(3)
    4. 1 − F(3)
    Show answer

    Answer: A. For a continuous variable P(X = 3) = ∫₃³ f(x) dx = 0. The value f(3) is a density, not a probability.

  3. 3. X is uniform on [0, 10], with f(x) = 1/10 there. What is P(2 < X < 5)?

    1. 1/2
    2. 3/10
    3. 1/5
    4. 2/5
    Show answer

    Answer: B. P(2 < X < 5) = ∫₂⁵ (1/10) dx = (5 − 2)/10 = 3/10.

  4. 4. The distribution function of X is F(x) = 1 − e^(−2x) for x > 0 and 0 for x ≤ 0. What is the pdf for x > 0?

    1. e^(−2x)
    2. 1 − 2e^(−2x)
    3. 2e^(−2x)
    4. −2e^(−2x)
    Show answer

    Answer: C. f(x) = F′(x) = d/dx(1 − e^(−2x)) = 2e^(−2x) for x > 0.

  5. 5. For the pdf f(x) = x²/9 on (0, 3), the distribution function is F(x) = x³/27 there. What is P(X ≤ 1.5)?

    1. 1/8
    2. 1/2
    3. 1/27
    4. 3/8
    Show answer

    Answer: A. P(X ≤ 1.5) = F(1.5) = (1.5)³/27 = 3.375/27 = 1/8.

Privacy · Terms · Refunds · Delivery