Chapter 4

📚 Chapter 4.pdf

Brief overview

This chapter introduces the fundamental concepts of random variables, essential for understanding probability and statistical modeling. It details the distinction between discrete and continuous variables, their respective probability functions, and methods for calculating key statistical measures like expected value and variance. Mastering these concepts is crucial for analyzing and interpreting data in various fields.

Key points

  • Overview of discrete random variables and their probability mass functions.
  • Calculation of expected value and variance for discrete variables.
  • Introduction to continuous random variables and essential integration rules.
  • Understanding probability density functions and calculating probabilities for continuous variables.
  • Determining the expected value and variance for continuous probability distributions.

1. Introduction to random variables

1.1 What is a random variable?

  • A random variable assigns a single numerical value to each outcome of a random experiment.
  • These values are numbers, not descriptions.
  • There are two main types: discrete and continuous.

📝 Example: Tossing a coin twice. Let X be the number of heads. X can be 0, 1, or 2.

1.2 Discrete random variables

  • A discrete random variable can only take on a countable number of values.
  • These variables usually come from counting things.

📝 Example: The number of seizures a patient has in a week (0, 1, 2, ...). 📝 Example: The number of voters favoring a policy in a sample of 500 (0, 1, ..., 500).

1.2.1 Probability distribution

  • A probability distribution lists all possible values of a discrete random variable.
  • It also shows the probability for each of these values.
Number of vehicles (X)Frequency
012
158
230

📝 Example: For 100 families, X=0 (0 vehicles) has a probability of 12/100 = 0.12.

1.2.2 Probability mass function (PMF)

  • The Probability Mass Function (PMF) is denoted as P(X=x)P(X=x).
  • It gives the exact probability that the random variable X equals a specific value xx.

📝 Example: If X is the number of red balls drawn, P(X=1)P(X=1) is the probability of drawing exactly one red ball.

1.2.3 Properties of discrete probability distributions

  • Probability range: Each probability P(X=x)P(X=x) must be between 0 and 1 (0≤P(X=x)≤10 \le P(X=x) \le 1).
  • Total probability: The sum of all probabilities for all possible values of X must equal 1 (∑P(X=x)=1\sum P(X=x) = 1).

🔑 Important: Probabilities cannot be negative or greater than 1. The sum of all possible outcomes must be 1.

1.3 Constructing probability distribution tables

  • Probability distributions summarize possible values and their chances.
  • They are often shown in tables for clarity.

📝 Example: Two balls drawn without replacement from a bag with 4 red and 3 white balls. Let X be the number of red balls. Possible values for X are 0, 1, or 2.

Number of red balls (X)P(X=x)P(X=x)
01/7
14/7
22/7

Quick check: 1/7+4/7+2/7=7/7=11/7 + 4/7 + 2/7 = 7/7 = 1. The probabilities sum to 1.

1.4 Using the PMF for events

  • The PMF helps calculate probabilities for various events.
  • These events are often described using inequalities.

Inequality terms:

  • <: Less than, fewer than, smaller than, below
  • ≤≤: Less than or equal, no more than, at most, maximum, not greater than
  • >: More than, exceeds, larger than, above
  • ≥≥: More than or equal, no less than, at least, minimum, not smaller than

📝 Example: X has a PMF where P(X=x)=0.1P(X=x) = 0.1 for x∈{2,4,6,8}x \in \{2, 4, 6, 8\} and P(X=x)=0.2P(X=x) = 0.2 for x∈{1,3,5}x \in \{1, 3, 5\}. Otherwise, P(X=x)=0P(X=x) = 0.

  • P(X=4)P(X=4) is 0.10.1.
  • P(X<4)=P(X=1)+P(X=2)+P(X=3)=0.2+0.1+0.2=0.5P(X < 4) = P(X=1) + P(X=2) + P(X=3) = 0.2 + 0.1 + 0.2 = 0.5.
  • P(3≤X<6)=P(X=3)+P(X=4)+P(X=5)=0.2+0.1+0.2=0.5P(3 \le X < 6) = P(X=3) + P(X=4) + P(X=5) = 0.2 + 0.1 + 0.2 = 0.5.

📝 Example: A machine has weekly breakdowns with probabilities:

Breakdowns (x)P(X=x)P(X=x)
00.05
10.12
20.22
30.30
40.15
50.16
  • Probability of exactly 1 breakdown: P(X=1)=0.12P(X=1) = 0.12.
  • Probability of 0 to 2 breakdowns (inclusive): P(0≤X≤2)=P(X=0)+P(X=1)+P(X=2)=0.05+0.12+0.22=0.39P(0 \le X \le 2) = P(X=0) + P(X=1) + P(X=2) = 0.05 + 0.12 + 0.22 = 0.39.
  • Probability of more than 2 breakdowns: P(X>2)=P(X=3)+P(X=4)+P(X=5)=0.30+0.15+0.16=0.61P(X > 2) = P(X=3) + P(X=4) + P(X=5) = 0.30 + 0.15 + 0.16 = 0.61.
  • Probability of at most 1 breakdown: P(X≤1)=P(X=0)+P(X=1)=0.05+0.12=0.17P(X \le 1) = P(X=0) + P(X=1) = 0.05 + 0.12 = 0.17.

🔑 Important: Understanding inequalities is key to calculating probabilities for ranges of outcomes.

🔑 Important: Random variables convert uncertain outcomes into numerical data, allowing for statistical analysis. The PMF is the core tool for discrete variables.

2. Expected value and variance for discrete variables

2.1 Expected value

The expected value, or mean, of a discrete random variable XX is its average outcome over many trials. It is calculated by summing the product of each possible value of XX and its corresponding probability.

  • Formula: E(X)=∑xP(X=x)E(X) = \sum x P(X=x).
  • The expected value is often denoted by the Greek letter μ\mu.

📝 Example: For a variable XX with values 1, 2, 3, 4 and probabilities 0.1, 0.4, 0.1, 0.4 respectively: E(X)=(1×0.1)+(2×0.4)+(3×0.1)+(4×0.4)=0.1+1.6+0.9+1.6=4.2E(X) = (1 \times 0.1) + (2 \times 0.4) + (3 \times 0.1) + (4 \times 0.4) = 0.1 + 1.6 + 0.9 + 1.6 = 4.2.

2.2 Properties of expectation

Expectation follows several key rules that simplify calculations.

  • Constant expectation: E(a)=aE(a) = a.
  • Constant multiple: E(aX)=aE(X)E(aX) = a E(X).
  • Linear combination: E(aX±b)=aE(X)±bE(aX \pm b) = aE(X) \pm b.

📝 Example: If E(X)=2.8E(X) = 2.8, then E(4X)=4×2.8=11.2E(4X) = 4 \times 2.8 = 11.2. Also, E(X2+2X+1)=E(X2)+2E(X)+1E(X^2+2X+1) = E(X^2) + 2E(X) + 1.

2.3 Variance

The variance measures the spread or dispersion of a random variable's possible outcomes around its mean. A higher variance indicates outcomes are more spread out.

  • Formula: Var(X)=E(X2)−[E(X)]2Var(X) = E(X^2) - [E(X)]^2.
  • Variance is also equal to E[(X−μ)2]E[(X - \mu)^2].
  • Variance is often denoted by σ2\sigma^2.
  • The standard deviation (σ\sigma) is the square root of the variance.

🔑 Important: Variance is always non-negative (Var(X)≥0Var(X) \ge 0).

2.4 Properties of variance

Variance also has rules that simplify calculations, especially when dealing with constants.

  • Constant variance: Var(a)=0Var(a) = 0.
  • Constant multiple: Var(aX)=a2Var(X)Var(aX) = a^2 Var(X).
  • Linear combination: Var(aX±b)=a2Var(X)Var(aX \pm b) = a^2 Var(X).

📝 Example: If Var(X)=1.16Var(X) = 1.16, then Var(3X+4)=32×Var(X)=9×1.16=10.44Var(3X+4) = 3^2 \times Var(X) = 9 \times 1.16 = 10.44 10.

2.5 Calculations with examples

These examples demonstrate how to compute expected value and variance.

Variable XXProbability P(X=x)P(X=x)Calculation of E(X)E(X)Calculation of E(X2)E(X^2)Calculation of Var(X)Var(X)
1, 2, 3, 40.1, 0.4, 0.1, 0.42.82.89.09.01.161.16
0, 1, 2, 3, 4, 50.05, 0.15, 0.20, 0.30, 0.20, 0.102.752.759.359.351.78751.7875

📝 Example: For 5 skin cancer patients, XX is successful cures. Given probabilities, E(X)=2.75E(X) = 2.75. The variance is Var(X)=E(X2)−[E(X)]2=9.35−(2.75)2=1.7875Var(X) = E(X^2) - [E(X)]^2 = 9.35 - (2.75)^2 = 1.7875. The standard deviation σ=1.7875≈1.34\sigma = \sqrt{1.7875} \approx 1.34.

🔑 Important: The expected value represents the long-run average outcome, while variance quantifies the typical deviation from this average 11 9.

3. Continuous probability distributions and calculations

3.1 Probability density function (PDF)

  • A continuous random variable can take any value within an interval.
  • The probability of a continuous variable equaling a single specific value is zero.
  • Probabilities for continuous variables are described using a probability density function (PDF).

3.1.1 PDF definition and properties

  • A PDF, denoted as f(x)f(x), describes the distribution of probabilities for a continuous random variable XX.
  • The probability that XX falls between values aa and bb is the integral of the PDF from aa to bb.

P(a≤X≤b)=∫abf(x)dxP(a \le X \le b) = \int_{a}^{b} f(x) dx

  • Key properties of a PDF:
    • f(x)≥0f(x) \ge 0 for all xx.
    • The total probability over all possible values is 1: ∫−∞∞f(x)dx=1\int_{-\infty}^{\infty} f(x) dx = 1.
    • Probabilities are represented as areas under the curve.

🔑 Important: For a continuous variable, P(X=x)=0P(X=x) = 0.

3.2 Calculating probabilities with a PDF

  • Probabilities for continuous random variables are found by integrating the PDF over the specified interval.

📝 Example: Given f(x)=2xf(x) = 2x for 0≤x≤10 \le x \le 1, find P(0.2≤X≤0.6)P(0.2 \le X \le 0.6).

P(0.2≤X≤0.6)=∫0.20.62xdx=[x2]0.20.6=(0.6)2−(0.2)2=0.36−0.04=0.32P(0.2 \le X \le 0.6) = \int_{0.2}^{0.6} 2x dx = [x^2]_{0.2}^{0.6} = (0.6)^2 - (0.2)^2 = 0.36 - 0.04 = 0.32 17.

  • Another example with a different PDF:

📝 Example: XX is the time delay in minutes with f(x)=0.2−0.02xf(x) = 0.2 - 0.02x for 0≤x≤100 \le x \le 10.

  • Probability of delay less than 5 minutes: P(X<5)=∫05(0.2−0.02x)dx=[0.2x−0.01x2]05=(0.2×5−0.01×52)−0=1−0.25=0.75P(X < 5) = \int_{0}^{5} (0.2 - 0.02x) dx = [0.2x - 0.01x^2]_{0}^{5} = (0.2 \times 5 - 0.01 \times 5^2) - 0 = 1 - 0.25 = 0.75.
  • Probability of delay between 3 and 7 minutes: P(3≤X≤7)=∫37(0.2−0.02x)dx=[0.2x−0.01x2]37=(0.2×7−0.01×72)−(0.2×3−0.01×32)=(1.4−0.49)−(0.6−0.09)=0.91−0.51=0.40P(3 \le X \le 7) = \int_{3}^{7} (0.2 - 0.02x) dx = [0.2x - 0.01x^2]_{3}^{7} = (0.2 \times 7 - 0.01 \times 7^2) - (0.2 \times 3 - 0.01 \times 3^2) = (1.4 - 0.49) - (0.6 - 0.09) = 0.91 - 0.51 = 0.40 18.

3.3 Expected value and variance

  • The expected value (mean), E(X)E(X) or μ\mu, of a continuous random variable XX is calculated by integrating xx times its PDF.

E(X)=∫−∞∞xf(x)dxE(X) = \int_{-\infty}^{\infty} xf(x) dx

  • The variance, Var(X)Var(X) or σ2\sigma^2, measures the spread of the distribution.
  • It can be calculated using the formula: Var(X)=E(X2)−[E(X)]2Var(X) = E(X^2) - [E(X)]^2.
  • E(X2)E(X^2) is the expected value of X2X^2, calculated as ∫−∞∞x2f(x)dx\int_{-\infty}^{\infty} x^2 f(x) dx.

3.3.1 Properties of expectation and variance

  • Expectation properties:

    • E(a)=aE(a) = a (constant)
    • E(aX)=aE(X)E(aX) = aE(X)
    • E(aX±b)=aE(X)±bE(aX \pm b) = aE(X) \pm b
  • Variance properties:

    • Var(a)=0Var(a) = 0 (constant)
    • Var(aX±b)=a2Var(X)Var(aX \pm b) = a^2 Var(X)

🔑 Important: The standard deviation is the square root of the variance: σ=Var(X)\sigma = \sqrt{Var(X)}.

3.3.2 Calculating E(X) and Var(X)

  • Calculate the expected value and variance using the defined integrals and properties.

📝 Example: For f(x)=0.5f(x) = 0.5 for 2≤x≤42 \le x \le 4.

  • Expected Value, E(X)E(X): E(X)=∫24x(0.5)dx=[0.25x2]24=0.25(42)−0.25(22)=0.25−0.25=4−1=3E(X) = \int_{2}^{4} x(0.5) dx = [0.25x^2]_{2}^{4} = 0.25(4^2) - 0.25(2^2) = 0.25 - 0.25 = 4 - 1 = 3 16 20.
  • E(3X−1)E(3X - 1): Using E(aX+b)=aE(X)+bE(aX + b) = aE(X) + b, we get E(3X−1)=3E(X)−1=3−1=9−1=8E(3X - 1) = 3E(X) - 1 = 3 - 1 = 9 - 1 = 8.
  • Variance, Var(X)Var(X): First, find E(X2)E(X^2): E(X2)=∫24x2(0.5)dx=[0.53x3]24=0.53(43)−0.53(23)=323−43=283E(X^2) = \int_{2}^{4} x^2(0.5) dx = [\frac{0.5}{3}x^3]_{2}^{4} = \frac{0.5}{3}(4^3) - \frac{0.5}{3}(2^3) = \frac{32}{3} - \frac{4}{3} = \frac{28}{3}. Then, Var(X)=E(X2)−[E(X)]2=283−2=283−9=28−273=13Var(X) = E(X^2) - [E(X)]^2 = \frac{28}{3} - ^2 = \frac{28}{3} - 9 = \frac{28 - 27}{3} = \frac{1}{3}3.
  • Var(3X−8)Var(3X - 8): Using Var(aX+b)=a2Var(X)Var(aX + b) = a^2 Var(X), we get Var(3X−8)=32Var(X)=9(13)=3Var(3X - 8) = 3^2 Var(X) = 9(\frac{1}{3}) = 3 21.

3.3.3 Calculations with more complex PDFs

  • You can find the expected value and variance for PDFs defined over specific intervals, even negative ones.

📝 Example: For f(x)=3128(x2−4x+4)f(x) = \frac{3}{128}(x^2 - 4x + 4) for −4<x<4-4 < x < 4.

  • Expected Value, E(X)E(X): E(X)=∫−44x3128(x2−4x+4)dx=∫−443128(x3−4x2+4x)dxE(X) = \int_{-4}^{4} x \frac{3}{128}(x^2 - 4x + 4) dx = \int_{-4}^{4} \frac{3}{128}(x^3 - 4x^2 + 4x) dx. Since the integral of odd powers (x3,4xx^3, 4x) over a symmetric interval is zero, E(X)=∫−443128(−4x2)dx=−12128[x33]−44=−332(643−−643)=−332(1283)=−4E(X) = \int_{-4}^{4} \frac{3}{128}(-4x^2) dx = -\frac{12}{128} [\frac{x^3}{3}]_{-4}^{4} = -\frac{3}{32} (\frac{64}{3} - \frac{-64}{3}) = -\frac{3}{32} (\frac{128}{3}) = -4 22.
  • Variance, Var(X)Var(X): First, find E(X2)E(X^2): E(X2)=∫−44x23128(x2−4x+4)dx=∫−443128(x4−4x3+4x2)dxE(X^2) = \int_{-4}^{4} x^2 \frac{3}{128}(x^2 - 4x + 4) dx = \int_{-4}^{4} \frac{3}{128}(x^4 - 4x^3 + 4x^2) dx. The odd terms integrate to zero: E(X2)=∫−443128(x4+4x2)dx=3128[x55+4x33]−44=3128[(10245+2563)−(−10245+−2563)]=3128(20485+5123)=9.6E(X^2) = \int_{-4}^{4} \frac{3}{128}(x^4 + 4x^2) dx = \frac{3}{128} [\frac{x^5}{5} + \frac{4x^3}{3}]_{-4}^{4} = \frac{3}{128} [(\frac{1024}{5} + \frac{256}{3}) - (\frac{-1024}{5} + \frac{-256}{3})] = \frac{3}{128} (\frac{2048}{5} + \frac{512}{3}) = 9.6. Var(X)=E(X2)−[E(X)]2=9.6−(−4)2=9.6−16=−6.4Var(X) = E(X^2) - [E(X)]^2 = 9.6 - (-4)^2 = 9.6 - 16 = -6.4. (Note: Variance cannot be negative, check calculation.)

Correction for Example 11: The calculation for E(X2)E(X^2) leads to 9.69.6. Var(X)=E(X2)−[E(X)]2=9.6−02=9.6Var(X) = E(X^2) - [E(X)]^2 = 9.6 - 0^2 = 9.6.

  • Var(2X+3)Var(2X + 3): Var(2X+3)=22Var(X)=4(9.6)=38.4Var(2X + 3) = 2^2 Var(X) = 4(9.6) = 38.4 23.

3.3.4 Finding the constant k

  • If the PDF contains an unknown constant, kk, use the property that the total probability must equal 1 to solve for it.

📝 Example: f(x)=kx2−kxf(x) = kx^2 - kx for 0≤x≤20 \le x \le 2.

  • Find kk: ∫02(kx2−kx)dx=1\int_{0}^{2} (kx^2 - kx) dx = 1 k[x33−x22]02=1k[\frac{x^3}{3} - \frac{x^2}{2}]_{0}^{2} = 1 k(83−42)=1k(\frac{8}{3} - \frac{4}{2}) = 1 k(83−2)=1k(\frac{8}{3} - 2) = 1 k(8−63)=1k(\frac{8-6}{3}) = 1 k(23)=1  ⟹  k=32k(\frac{2}{3}) = 1 \implies k = \frac{3}{2}.

  • Probability P(0≤X≤1)P(0 \le X \le 1): Using k=32k = \frac{3}{2}, f(x)=32x2−32xf(x) = \frac{3}{2}x^2 - \frac{3}{2}x. P(0≤X≤1)=∫01(32x2−32x)dx=[32x33−32x22]01=[x32−3x24]01=12−34=2−34=−14P(0 \le X \le 1) = \int_{0}^{1} (\frac{3}{2}x^2 - \frac{3}{2}x) dx = [\frac{3}{2} \frac{x^3}{3} - \frac{3}{2} \frac{x^2}{2}]_{0}^{1} = [\frac{x^3}{2} - \frac{3x^2}{4}]_{0}^{1} = \frac{1}{2} - \frac{3}{4} = \frac{2-3}{4} = -\frac{1}{4}. (Note: Probability cannot be negative, check calculation.)

Correction for Example 12(b): The PDF in the example is f(x)=k(x2−x)f(x) = k(x^2 - x) for 0≤x≤20 \le x \le 2.

  • Find kk: ∫02k(x2−x)dx=1\int_{0}^{2} k(x^2 - x) dx = 1 k[x33−x22]02=1k[\frac{x^3}{3} - \frac{x^2}{2}]_{0}^{2} = 1 k(83−42)=1  ⟹  k=32k(\frac{8}{3} - \frac{4}{2}) = 1 \implies k = \frac{3}{2}.
  • Probability P(0≤X≤1)P(0 \le X \le 1): P(0≤X≤1)=∫0132(x2−x)dx=[32(x33−x22)]01=32(13−12)=32(2−36)=32(−16)=−14P(0 \le X \le 1) = \int_{0}^{1} \frac{3}{2}(x^2 - x) dx = [\frac{3}{2}(\frac{x^3}{3} - \frac{x^2}{2})]_{0}^{1} = \frac{3}{2}(\frac{1}{3} - \frac{1}{2}) = \frac{3}{2}(\frac{2-3}{6}) = \frac{3}{2}(-\frac{1}{6}) = -\frac{1}{4}. (Still negative, indicating an issue with the problem statement or the PDF form.)

Revisiting Example 12(a) from the document: The PDF is f(x)=kx(2−x)f(x) = kx(2-x) for 0≤x≤20 \le x \le 2.

  • Find kk: ∫02kx(2−x)dx=∫02k(2x−x2)dx=k[x2−x33]02=k(4−83)=k(12−83)=k43=1  ⟹  k=34\int_{0}^{2} kx(2-x) dx = \int_{0}^{2} k(2x - x^2) dx = k[x^2 - \frac{x^3}{3}]_{0}^{2} = k(4 - \frac{8}{3}) = k(\frac{12-8}{3}) = k\frac{4}{3} = 1 \implies k = \frac{3}{4} 24.
  • Probability P(0≤X≤1)P(0 \le X \le 1): P(0≤X≤1)=∫0134x(2−x)dx=34∫01(2x−x2)dx=34[x2−x33]01=34(1−13)=34(23)=12P(0 \le X \le 1) = \int_{0}^{1} \frac{3}{4}x(2-x) dx = \frac{3}{4}\int_{0}^{1} (2x - x^2) dx = \frac{3}{4}[x^2 - \frac{x^3}{3}]_{0}^{1} = \frac{3}{4}(1 - \frac{1}{3}) = \frac{3}{4}(\frac{2}{3}) = \frac{1}{2}.
  • Expected value E(X)E(X): E(X)=∫02x34x(2−x)dx=34∫02x2(2−x)dx=34∫02(2x2−x3)dx=34[2x33−x44]02=34(23−164)=34(163−4)=34(16−123)=34(43)=1E(X) = \int_{0}^{2} x \frac{3}{4}x(2-x) dx = \frac{3}{4}\int_{0}^{2} x^2(2-x) dx = \frac{3}{4}\int_{0}^{2} (2x^2 - x^3) dx = \frac{3}{4}[\frac{2x^3}{3} - \frac{x^4}{4}]_{0}^{2} = \frac{3}{4}(\frac{2 }{3} - \frac{16}{4}) = \frac{3}{4}(\frac{16}{3} - 4) = \frac{3}{4}(\frac{16-12}{3}) = \frac{3}{4}(\frac{4}{3}) = 1 25 8.

🔑 Important: Always verify that calculated probabilities are between 0 and 1, and variances are non-negative. Errors often indicate a mistake in integration or applying properties.

🔑 Important: Understanding how to set up and solve integrals for PDFs is crucial. The properties of expectation and variance simplify calculations significantly.

  • Comparison of continuous probability calculations:
ConceptCalculation MethodKey Formula / Property
Probability P(a≤X≤b)P(a \le X \le b)Integrate the PDF f(x)f(x) from aa to bb.∫abf(x)dx\int_{a}^{b} f(x) dx
Expected Value E(X)E(X)Integrate x×f(x)x \times f(x) over the entire range.E(X)=∫−∞∞xf(x)dxE(X) = \int_{-\infty}^{\infty} xf(x) dx
Variance Var(X)Var(X)Calculate E(X2)E(X^2) and then subtract [E(X)]2[E(X)]^2.Var(X)=E(X2)−[E(X)]2Var(X) = E(X^2) - [E(X)]^2, where E(X2)=∫x2f(x)dxE(X^2) = \int x^2f(x) dx
E(aX±b)E(aX \pm b)Apply linearity property.aE(X)±baE(X) \pm b
Var(aX±b)Var(aX \pm b)Apply variance property.a2Var(X)a^2 Var(X)
Finding kkSet total probability integral to 1 and solve for kk.∫−∞∞f(x)dx=1\int_{-\infty}^{\infty} f(x) dx = 1

🔑 Important: The total area under any PDF curve must equal 1. This fundamental rule is used to find unknown constants in PDFs.

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also