4.9.4Probability Theory & Statistics

Expected value, variance, standard deviation — properties

1,824 words8 min readdifficulty · medium2 backlinks

1. Expected Value — WHAT, WHY, HOW

WHY this formula? Think of probability as mass. Put mass pip_i at position xix_i on a number line. The balance point (center of mass) of that mass distribution is exactly xipi\sum x_i p_i. That's why E[X]\mathbb{E}[X] is called the mean — it's the point where the distribution would balance on a knife edge.

HOW we use it (the most important tool): the Law of the Unconscious Statistician (LOTUS). To average a function of XX, you do not need the distribution of g(X)g(X): E[g(X)]=ig(xi)piorg(x)f(x)dx\mathbb{E}[g(X)] = \sum_i g(x_i)\, p_i \qquad\text{or}\qquad \int g(x) f(x)\,dx

Linearity of expectation (the workhorse)

Derivation of E[aX+b]\mathbb{E}[aX+b] from scratch (discrete): E[aX+b]=i(axi+b)pi=aixipi+bipi=aE[X]+b1.\mathbb{E}[aX+b] = \sum_i (a x_i + b)p_i = a\sum_i x_i p_i + b\sum_i p_i = a\,\mathbb{E}[X] + b\cdot 1. Why each step? First we used LOTUS with g(x)=ax+bg(x)=ax+b. Then split the sum (sums are linear). Then pulled constants out, and used ipi=1\sum_i p_i = 1 (probabilities sum to one). Done.


2. Variance — measuring spread

WHY squared, not just Xμ|X-\mu|? If we averaged XμX-\mu directly we'd get 00 (positives cancel negatives — that's literally what the mean is). Squaring makes everything positive, punishes big deviations more, and gives clean algebra (it's differentiable, unlike |\cdot|).

Derivation from first principles:

Var(X)=E[(Xμ)2]=E[X22μX+μ2]\operatorname{Var}(X)=\mathbb{E}[(X-\mu)^2]=\mathbb{E}[X^2 - 2\mu X + \mu^2] =E[X2]2μE[X]+μ2(linearity)= \mathbb{E}[X^2] - 2\mu\,\mathbb{E}[X] + \mu^2 \quad(\text{linearity}) =E[X2]2μμ+μ2=E[X2]μ2.= \mathbb{E}[X^2] - 2\mu\cdot\mu + \mu^2 = \mathbb{E}[X^2] - \mu^2.

Why each step? Expand the square (algebra). Apply linearity — note μ\mu is a constant, so it pulls out. Then substitute E[X]=μ\mathbb{E}[X]=\mu. The two middle terms collapse to μ2-\mu^2.

Standard deviation


3. How Variance behaves under scaling & shifting

Derivation. Let Y=aX+bY=aX+b. Then E[Y]=aμ+b\mathbb{E}[Y]=a\mu+b. So

Var(Y)=E[(YE[Y])2]=E[(aX+baμb)2]=E[a2(Xμ)2]=a2Var(X).\operatorname{Var}(Y)=\mathbb{E}\big[(Y-\mathbb{E}[Y])^2\big]=\mathbb{E}\big[(aX+b-a\mu-b)^2\big]=\mathbb{E}\big[a^2(X-\mu)^2\big]=a^2\operatorname{Var}(X).

Why? The +b+b cancels — shifting the whole distribution doesn't change its spread. The aa factors out and gets squared because variance lives in squared units. Taking the root gives a|a| (absolute value, because SD ≥ 0).

Figure — Expected value, variance, standard deviation — properties

4. Variance of a sum (where independence matters)

Derivation sketch. Let μX,μY\mu_X,\mu_Y be the means.

Var(X+Y)=E[((XμX)+(YμY))2]\operatorname{Var}(X+Y)=\mathbb{E}\big[((X-\mu_X)+(Y-\mu_Y))^2\big] =E[(XμX)2]+E[(YμY)2]+2E[(XμX)(YμY)].=\mathbb{E}[(X-\mu_X)^2]+\mathbb{E}[(Y-\mu_Y)^2]+2\,\mathbb{E}[(X-\mu_X)(Y-\mu_Y)].

The first two terms are the variances; the last is 2Cov(X,Y)2\operatorname{Cov}(X,Y). Why does independence kill it? Because for independent variables E[XY]=E[X]E[Y]\mathbb{E}[XY]=\mathbb{E}[X]\mathbb{E}[Y], making covariance 00.


5. Worked examples


6. Common mistakes (Steel-manned)


7. Active recall

Recall Self-test (hide and answer)
  1. State the computational formula for variance and derive it.
  2. What is Var(aX+b)\operatorname{Var}(aX+b) and why does bb vanish?
  3. When is Var(X+Y)=Var(X)+Var(Y)\operatorname{Var}(X+Y)=\operatorname{Var}(X)+\operatorname{Var}(Y)?
  4. Why do we take a square root to get SD?
  5. Is linearity of expectation true for dependent variables?
Recall Feynman: explain to a 12-year-old

Imagine throwing darts at a number line. The average spot you hit is the expected value — the middle of your cluster. The variance asks: how scattered are my darts around that middle? We measure each dart's distance to the middle, square it (so left and right misses both count as "bad"), and average those. The standard deviation is just that scatter measured back in normal distance units. If you slide the whole target sideways, your scatter doesn't change — but if you zoom the target picture to be twice as wide, your scatter doubles (and the squared scatter, variance, quadruples).


Flashcards

What is the definition of expected value for a discrete RV?
E[X]=ixipi\mathbb{E}[X]=\sum_i x_i p_i — the probability-weighted average (center of mass).
State the computational formula for variance.
Var(X)=E[X2](E[X])2\operatorname{Var}(X)=\mathbb{E}[X^2]-(\mathbb{E}[X])^2.
Why do we square deviations in variance?
To avoid cancellation of ++ and - deviations (they'd sum to 0) and to get clean differentiable algebra.
What is Var(aX+b)\operatorname{Var}(aX+b)?
a2Var(X)a^2\operatorname{Var}(X) — the bb cancels (shift), the aa is squared.
What is SD(aX+b)\operatorname{SD}(aX+b)?
aSD(X)|a|\operatorname{SD}(X).
Is E[X+Y]=E[X]+E[Y]\mathbb{E}[X+Y]=\mathbb{E}[X]+\mathbb{E}[Y] always true?
Yes — linearity of expectation holds even for dependent variables.
When does Var(X+Y)=Var(X)+Var(Y)\operatorname{Var}(X+Y)=\operatorname{Var}(X)+\operatorname{Var}(Y)?
When Cov(X,Y)=0\operatorname{Cov}(X,Y)=0 (e.g. X,YX,Y independent).
General formula for Var(X+Y)\operatorname{Var}(X+Y)?
Var(X)+Var(Y)+2Cov(X,Y)\operatorname{Var}(X)+\operatorname{Var}(Y)+2\operatorname{Cov}(X,Y).
Define covariance.
Cov(X,Y)=E[XY]E[X]E[Y]\operatorname{Cov}(X,Y)=\mathbb{E}[XY]-\mathbb{E}[X]\mathbb{E}[Y].
Variance of a fair die?
9163.52=35122.917\frac{91}{6}-3.5^2=\frac{35}{12}\approx 2.917.
Variance of a Bernoulli(pp)?
p(1p)p(1-p), maximal at p=0.5p=0.5.
Why is E[X2](E[X])2\mathbb{E}[X^2]\ge(\mathbb{E}[X])^2?
Their difference is Var(X)0\operatorname{Var}(X)\ge 0 (Jensen's inequality for convex x2x^2).
What is LOTUS?
E[g(X)]=ig(xi)pi\mathbb{E}[g(X)]=\sum_i g(x_i)p_i — average a function of XX without finding g(X)g(X)'s distribution.

Connections

Concept Map

summarized by

summarized by

balance point of mass

average function via

obeys

gives

gives

defined as

square avoids cancelling

derived via linearity

square root gives

restores units of

Random variable X

Expected value

Variance

Center of mass

LOTUS

Linearity

E aX+b = aE X +b

E X+Y = E X + E Y always

E of squared distance from mean

Positives cancel negatives

Var = E X^2 - E X ^2

Standard deviation

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, koi bhi random variable XX matlab ek aisa number jo chance se nikalta hai (jaise dice ka result). Iske baare mein hum do cheezein jaanna chahte hain: average kahaan baith raha hai (ye hai expected value E[X]\mathbb{E}[X], yaani center of mass — jahan distribution balance karega), aur values kitni bikhri hui hain center ke around (ye hai variance aur uska square root standard deviation).

Variance ka formula yaad rakhne ka aasaan tareeka: Var(X)=E[X2](E[X])2\operatorname{Var}(X)=\mathbb{E}[X^2]-(\mathbb{E}[X])^2 — "mean of square minus square of mean". Hum deviation ko square isliye karte hain kyunki agar simple XμX-\mu ka average lenge to wo hamesha zero aa jaayega (plus aur minus cancel ho jaate hain). Square karne se sab positive ho jaata hai aur bade misses zyada count hote hain.

Sabse important properties: agar tum XX ko aa se multiply karke bb add karte ho, to E[aX+b]=aE[X]+b\mathbb{E}[aX+b]=a\mathbb{E}[X]+b (linearity — ye hamesha sach hai, even dependent variables ke liye bhi). Lekin variance mein twist hai: Var(aX+b)=a2Var(X)\operatorname{Var}(aX+b)=a^2\operatorname{Var}(X). Yahan +b+b (shift) variance ko change nahi karta — bas poori picture slide ho jaati hai — aur aa (stretch) square ho ke aata hai. Yaad rakho: "Add shifts, Multiply stretches, Square the stretch."

Aur ek common galti: Var(X+Y)=Var(X)+Var(Y)\operatorname{Var}(X+Y)=\operatorname{Var}(X)+\operatorname{Var}(Y) sirf tab sach hai jab XX aur YY independent hon. Warna ek extra term 2Cov(X,Y)2\operatorname{Cov}(X,Y) aata hai. Exam mein ye trap bahut aata hai, to dhyaan rakhna!

Go deeper — visual, from zero

Test yourself — Probability Theory & Statistics

Connections