📘 Session 3.3 - Mean and Variance of Discrete Random Variables

📐 Definitions

The mean is a weighted average. The variance shows how spread out the values are around the mean.

📊 Example 3.7 – Digital Channel: Mean and Variance

Let X be the number of error bits in the next four bits transmitted. X ∈ {0,1,2,3,4} with:

Mean (μ = E[X]):

μ = 0(0.6561) + 1(0.2916) + 2(0.0486) + 3(0.0036) + 4(0.0001) = 0.4

Although X never takes the value 0.4, the expected value (weighted average) is 0.4.

Variance (table method):

xx − 0.4(x − 0.4)²f(x)f(x)(x − 0.4)²
0−0.40.160.65610.104976
10.60.360.29160.104976
21.62.560.04860.124416
32.66.760.00360.024336
43.612.960.00010.001296

Variance (add the last column):

Variance is the weighted average of squared deviations:

V(X) = Σ f(x)·(x − μ)²

From the table, simply add up the last column:

0.104976+0.104976+0.124416+0.024336+0.001296

= 0.36

✔️ Shortcut check: E[X²] − (E[X])² = 0.52 − (0.4)² = 0.36

✔️ Shortcut check (step by step):

The shortcut formula is:
V(X) = E[X²] − (E[X])²

  1. First compute E[X²]:
    E[X²] = 0²·0.6561 + 1²·0.2916 + 2²·0.0486 + 3²·0.0036 + 4²·0.0001
    = 0 + 0.2916 + 0.1944 + 0.0324 + 0.0016
    = 0.52
  2. Next compute (E[X])²:
    We already found E[X] = 0.4, so
    (E[X])² = (0.4)² = 0.16
  3. Now subtract:
    V(X) = 0.52 − 0.16 = 0.36

Final Answer: V(X) = 0.36

❓ Why NOT just average the probabilities?

Averaging probabilities like AVERAGE(0.6561, 0.2916, …) would tell you the mean of a list of five numbers that happen to be probabilities. That has no direct meaning for how many error bits you expect.

We want the average of the outcomes (0,1,2,3,4) over many packets, weighted by how likely each outcome is. That is exactly the definition:
μ = E[X] = Σ x·P(X=x)

Think of a big class experiment: for each 4-bit packet, record the number of error bits (X). After many packets, the class average of those X’s will be close to 0.4. That’s what the 0.4 “means”: on average, 0.4 errors per 4-bit packet.

(These probabilities match a Binomial model with n=4 bits and error probability p=0.1, so E[X] = n·p = 4·0.1 = 0.4.)

🧪 Mini Simulation: Watch the average approach 0.4

Assume each bit flips incorrectly with probability p = 0.1 independently (Binomial(4, 0.1)).

mean ≈ —

As the number of packets grows, the sample mean of X should hover near 0.4.

📊 Example 3.8 – Revenue Decision (Marketing)

Design A: $3 million with P = 1 → E(X) = 3, σ = 0
Design B: $7 million with P = 0.3, $2 million with P = 0.7

📌 Design B has higher expected return, but also higher risk.

🔁 Example 3.9 – Expected Value of a Function

What is E(X²) for the same PMF?

⚠️ Note: E(X²) ≠ [E(X)]²

📏 Linear Transformations of a Random Variable

🧠 Practice Question

Let X have values 1, 2, 3 with probabilities 0.2, 0.5, 0.3. Find μ, σ², σ.

μ = 1×0.2 + 2×0.5 + 3×0.3 = 2.1
E(X²) = 1²×0.2 + 2²×0.5 + 3²×0.3 = 4.9
σ² = E(X²) − μ² = 4.9 − (2.1)² = 0.49
σ = √0.49 = 0.7

📎 Excel Cheat-Sheet (PMF with Weights)

Put your x values in A2:A6 and the matching probabilities in B2:B6 (with SUM(B2:B6)=1).

🧪 Try Your Own PMF

Edit probabilities for x = 0…4 (they’ll auto-normalize). Live results and a micro-check that E[X²] ≠ [E[X]]² are shown below.

xP(X=x)

📏 Linear Transformations — Why variance scales by a²

1) Derivation (short and clear)

Mean:
  U = aX + b
  E[U] = E[aX + b] = a·E[X] + b

Variance:
  V(U) = E[(U − E[U])²]
       = E[(aX + b − (aE[X] + b))²]
       = E[(a(X − E[X]))²]
       = a² · E[(X − E[X])²]
       = a² · V(X)
  

Shift b cancels (doesn’t change spread). Scaling by a stretches distances by |a|, so squared distances scale by .

2) Numeric demonstration (Example 3.7 PMF)

X ∈ {0,1,2,3,4} with probabilities [0.6561, 0.2916, 0.0486, 0.0036, 0.0001]. For X: μX=0.4 and V(X)=0.36.

a = 1.00, b = 0.00 → a² = 1.00
Summary: μX = 0.4, V(X) = 0.36 • μU = 0.4, V(U) = 0.36Check: a²·V(X) = 0.36
x f(x) (x−μX TermX=f(x)(x−μX u = a·x + b μU (u−μU TermU=f(x)(u−μU Ratio TermU/TermX
Sum = V(X) 0.36 Sum = V(U) 0.36 Ratios (when defined) should equal a²

✅ Conclusion — Notice the difference between the two variances

Sanity checks you can try:
  1. Change b only (keep a=1): μ changes; V stays the same.
  2. Change a only (keep b=0): the “Ratio” column becomes everywhere; the bottom sums obey V(U)=a²V(X).
  3. Try a negative a (e.g., a=-2): the ratio is still a²=4 — the sign doesn’t matter for variance.
Common mistakes to avoid: