datarekha

Expectation, Variance & SD

A die game answers the wish from last lesson: two numbers can stand in for a whole table — the expectation for where the variable sits, the variance for how much it swings. With linearity and one famous trap, these summarise every distribution to come.

8 min read Intermediate GATE DA Lesson 9 of 122

What you'll learn

  • Expectation E[X] = Σ x·p(x) — the probability-weighted average
  • Linearity: E[aX + b] = aE[X] + b, always
  • Variance Var(X) = E[X²] − (E[X])², and Var(aX + b) = a²·Var(X)
  • The nonlinearity trap: E[g(X)] ≠ g(E[X]) in general

Before you start

The last lesson left us with a whole table of chances and a wish: could just two numbers stand in for it — one for where the variable sits, one for how much it swings? They can. Picture a simple game: roll a fair die and win that many rupees. Roll a six, win six; roll a one, win one. Before you play, what would you expect to win on a typical roll?

The first number: what you expect on average

You cannot win 3.5 rupees on any single roll, yet that is the honest long-run average — add the six equally likely payouts and share them out, (1+2+3+4+5+6)/6 = 3.5. That probability-weighted average is the expectation, written E[X]. When the chances are not equal, you weight each value by its own mass instead of sharing equally:

E[X] = Σ x · p(x)

— run through the values, multiply each by its chance, and add. That is the first of our two summary numbers.

Expectation (mean)E[X] = ∑ x·p(x)probability-weighted averageVariance (spread)E[X²] − (E[X])²mean square minus square of meanStd deviationSD = √Var(X)spread in the units of X
Mean, spread, and spread-in-original-units — the three numbers every distribution reduces to.

Expectation has one habit worth trusting completely: it is linear. Scaling and shifting the variable scales and shifts its average, exactly — E[aX + b] = aE[X] + b — and this holds always, even when variables depend on each other. Double every payout and add two, and the average doubles and adds two.

The second number: how much it swings

The average alone hides a lot. A game paying 3 or 4 rupees and a game paying 0 or 7 can share the very same average, yet feel completely different to play. The variance captures that swing: the average squared distance from the mean. The form you actually compute from is the mean of the squares minus the square of the mean:

Var(X) = E[X²] − (E[X])²

The two pieces are genuinely different computations — E[X²] weights each by its chance, while (E[X])² squares the single number E[X]. Take the square root and you return to the original units: the standard deviation, SD = √Var(X). Spread reacts to scaling and shifting differently from the mean — Var(aX + b) = a²·Var(X) — because a shift b slides every value together and changes nothing about the swing, while a scale a stretches every distance and so comes out squared.

Watching it on the die

A fair die shows 1 to 6, each with chance 1/6. Find E[X], E[X²], Var(X), and SD.

Average the faces, then average the squared faces, then subtract the square of the mean:

E[X]   = (1+2+3+4+5+6) / 6        = 21/6  = 3.5
E[X²]  = (1+4+9+16+25+36) / 6     = 91/6  ≈ 15.1667

Var(X) = E[X²] − (E[X])²
       = 15.1667 − 3.5²
       = 15.1667 − 12.25
       = 2.9167                   (exactly 35/12)

SD     = √2.9167                  ≈ 1.708

Mind the order: square each face and average for E[X²] = 15.1667, then subtract the square of the mean, 3.5² = 12.25. Squaring at the wrong moment is the usual slip.

A question to carry forward

We now have a way to squeeze any table into two numbers, but we still computed them by grinding through the whole list. Here is the thread onward: a few special shapes of randomness — a single yes/no trial, a count of successes — come up again and again, and for those the mean and variance have ready-made formulas you will not need to re-derive. What are those repeat-offender distributions, and what are their two numbers?

In one breath

  • Expectation E[X] = Σ x·p(x) — the probability-weighted average (the long-run mean); fair die = 3.5.
  • Linearity E[aX+b] = aE[X]+b holds always; but E[g(X)] ≠ g(E[X]) for nonlinear gE[X²] ≠ (E[X])², E[1/X] ≠ 1/E[X].
  • Variance Var(X) = E[X²] − (E[X])² (mean of squares − square of mean); SD = √Var, back in X’s units.
  • Affine variance Var(aX+b) = a²·Var(X) — a shift b leaves the swing untouched; a scale a comes out squared.
  • Fair die: E[X]=3.5, Var = 35/12 ≈ 2.917, SD ≈ 1.708.

Practice

Quick check

0/6
Q1Recall: the expectation E[X] of a discrete random variable is best described as…
Q2Trace: a discrete RV X has p(0)=0.2, p(1)=0.5, p(2)=0.3. Compute Var(X).numerical answer — type a number
Q3Trace: for a fair six-sided die, what is Var(X)? (3 decimals)numerical answer — type a number
Q4Apply: if Var(X) = 4, what is Var(3X + 7)?numerical answer — type a number
Q5Apply: which identities are ALWAYS true for a random variable X and constants a, b? (select all that apply)select all that apply
Q6Create: X takes values 1 and 3, each with chance 0.5. Decide whether E[1/X] equals 1/E[X], computing both.

Sign in to track your progress

Completed lessons, your XP, level, and streak save to your account — it's free and takes a few seconds.

Practice this in an interview

All questions
Define expected value and variance. What are their key properties?

Expected value is the probability-weighted average outcome of a random variable; variance measures average squared deviation from that mean. Both are linear/additive in specific ways — knowing these rules prevents algebraic mistakes under interview pressure.

What is the difference between variance and standard deviation, and why do we need both?

Variance is the average squared deviation from the mean; standard deviation is its square root and lives in the same units as the data. Variance is mathematically tractable — variances of independent variables add — while standard deviation is interpretable as a typical distance from the mean.

What is the difference between standard error and standard deviation?

Standard deviation measures the spread of individual observations around the population mean. Standard error measures the spread of sample means around the true mean — it equals the standard deviation divided by the square root of the sample size, so it shrinks as the sample grows while the standard deviation does not.

What makes the Normal distribution so central in statistics, and when does it fail?

The Normal distribution is justified by the Central Limit Theorem — averages of large i.i.d. samples converge to Normal regardless of the underlying distribution. It is fully characterized by mean and variance, enabling closed-form inference. It fails for heavy-tailed data, skewed outcomes, bounded quantities, and rare extreme events.

Related lessons

Explore further

Skip to content