Quiz 2

Week 3.2: Variance & Standard Deviation

552 words
3 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Week 3.2: Variance & Standard Deviation > **Prerequisites:** Expected Value ([Week 3.1: Expected Value](/notes/01-foundation-bsma1004-stats-2-week03-08-expectation)) > **Cross-links:** BSMA3012 (Linear Stat Models) — residual variance > **Core question:** How spread out is a random variable around its mean? * * *...

Week 3.2: Variance & Standard Deviation

Prerequisites: Expected Value (Week 3.1: Expected Value) Cross-links: BSMA3012 (Linear Stat Models) — residual variance Core question: How spread out is a random variable around its mean?

1. Intuition: Beyond the Average

Expected value tells us the centre, but two RVs can have the same mean yet behave very differently:
  • X10X \equiv 10 (constant) → mean 1010, no spread
  • Y{9,11}Y \in \{9,11\} equally → mean 1010, small spread
  • Z{0,20}Z \in \{0,20\} equally → mean 1010, large spread We need a measure of dispersion or spread. The variance quantifies how far values typically fall from the mean.

2. Formal Definition

Definition (Variance & Standard Deviation) The variance of XX is:
>Var(X)=E[(Xμ)2],where μ=E[X].>> \operatorname{Var}(X) = \mathbb{E}\left[(X - \mu)^2\right], \quad \text{where } \mu = \mathbb{E}[X]. >
The standard deviation is SD(X)=Var(X)\operatorname{SD}(X) = \sqrt{\operatorname{Var}(X)}. Alternative formula (easier for computation):
Var(X)=E[X2](E[X])2.\operatorname{Var}(X) = \mathbb{E}[X^2] - (\mathbb{E}[X])^2.
Proof:
Var(X)=E[(Xμ)2]=E[X22μX+μ2]=E[X2]2μE[X]+μ2=E[X2]2μ2+μ2=E[X2]μ2.\begin{aligned} \operatorname{Var}(X) &= \mathbb{E}[(X-\mu)^2] = \mathbb{E}[X^2 - 2\mu X + \mu^2] \\ &= \mathbb{E}[X^2] - 2\mu\mathbb{E}[X] + \mu^2 = \mathbb{E}[X^2] - 2\mu^2 + \mu^2 = \mathbb{E}[X^2] - \mu^2. \end{aligned}

3. Properties

  1. Var(c)=0\operatorname{Var}(c) = 0 for a constant cc
  2. Var(aX+b)=a2Var(X)\operatorname{Var}(aX + b) = a^2 \operatorname{Var}(X) (scaling changes variance, shifting does not)
  3. SD(aX+b)=aSD(X)\operatorname{SD}(aX + b) = |a| \operatorname{SD}(X)
  4. If XX and YY are independent: Var(X+Y)=Var(X)+Var(Y)\operatorname{Var}(X+Y) = \operatorname{Var}(X) + \operatorname{Var}(Y)

4. Variance of Common Distributions

DistributionPMFE[X]\mathbb{E}[X]Var(X)\operatorname{Var}(X)
Bernoulli( pp )px(1p)1xp^x(1-p)^{1-x}ppp(1p)p(1-p)
Binomial( n,pn,p )(nx)px(1p)nx\binom{n}{x}p^x(1-p)^{n-x}npnpnp(1p)np(1-p)
Geometric( pp )(1p)x1p(1-p)^{x-1}p1/p1/p(1p)/p2(1-p)/p^2
Poisson( λ\lambda )eλλx/x!e^{-\lambda}\lambda^x/x!λ\lambdaλ\lambda
Uniform {1,,n}\{1,\dots,n\}1/n1/n(n+1)/2(n+1)/2(n21)/12(n^2-1)/12

5. Standardised Random Variables

Definition XX is standardised if E[X]=0\mathbb{E}[X] = 0 and Var(X)=1\operatorname{Var}(X) = 1. For any XX with finite mean and variance:
Z=XμσZ = \frac{X - \mu}{\sigma}
is standardised. This Z-score expresses values in "standard deviation units".

6. Practice Questions

Q1 (Easy)

XX has PMF: fX(2)=0.1f_X(-2)=0.1, fX(0)=0.6f_X(0)=0.6, fX(2)=0.3f_X(2)=0.3. Find Var(X)\operatorname{Var}(X).
Full Solution
μ=(2)(0.1)+0(0.6)+2(0.3)=0.2+0+0.6=0.4\mu = (-2)(0.1) + 0(0.6) + 2(0.3) = -0.2 + 0 + 0.6 = 0.4.
E[X2]=4(0.1)+0(0.6)+4(0.3)=0.4+0+1.2=1.6\mathbb{E}[X^2] = 4(0.1) + 0(0.6) + 4(0.3) = 0.4 + 0 + 1.2 = 1.6.
Var(X)=1.6(0.4)2=1.60.16=1.44\operatorname{Var}(X) = 1.6 - (0.4)^2 = 1.6 - 0.16 = 1.44.

Q2 (Medium)

XBinomial(100,0.3)X \sim \text{Binomial}(100, 0.3). Find E[X]\mathbb{E}[X] and Var(X)\operatorname{Var}(X).
Full Solution
E[X]=np=100×0.3=30\mathbb{E}[X] = np = 100 \times 0.3 = 30. Var(X)=np(1p)=100×0.3×0.7=21\operatorname{Var}(X) = np(1-p) = 100 \times 0.3 \times 0.7 = 21. SD(X)=214.58\operatorname{SD}(X) = \sqrt{21} \approx 4.58.

Q3 (Hard)

XPoisson(5)X \sim \text{Poisson}(5). Find E[X2]\mathbb{E}[X^2] and Var(X)\operatorname{Var}(X).
Full Solution
For Poisson(λ\lambda): μ=λ\mu = \lambda, Var(X)=λ=5\operatorname{Var}(X) = \lambda = 5.
Var(X)=E[X2]μ2    E[X2]=Var(X)+μ2=5+25=30\operatorname{Var}(X) = \mathbb{E}[X^2] - \mu^2 \implies \mathbb{E}[X^2] = \operatorname{Var}(X) + \mu^2 = 5 + 25 = 30.

Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.