Worked examples — Expectation, variance, and standard deviation
This page is a firing range. We take the parent topic's three tools — expectation (the balance point), variance (average squared spread), and standard deviation (spread in original units) — and we throw every kind of input at them until nothing can surprise you.
Throughout this page we write (Greek letter "mu") as a shorthand for the mean — it is just a one-symbol name for the balance point, nothing new. If any other symbol feels unfamiliar, it was built from zero in the parent note and in random variables & distributions. Here we only use them, on every case.
The scenario matrix
Think of this table as a checklist. Every row is a "kind of situation" this topic can hand you. Every worked example below is stamped with the cell(s) it clears.
| # | Case class | What makes it tricky | Cleared by |
|---|---|---|---|
| C1 | Plain discrete | baseline: sum of value × probability | Ex 1 |
| C2 | Negative values in the support | signs cannot cancel in variance | Ex 2 |
| C3 | Continuous PDF | integral, not a sum | Ex 3 |
| C4 | Degenerate (constant) RV | zero spread — the edge case | Ex 4 |
| C5 | Scaling & shifting | for variance, for SD | Ex 5 |
| C6 | Sum of independent RVs | variances add, SDs do NOT | Ex 6 |
| C7 | Correlated sum (limiting signs) | the term, both signs | Ex 7 |
| C8 | Real-world word problem | translate English → | Ex 8 |
| C9 | Exam twist (given only) | back out variance without the distribution | Ex 9 |
Ex 1 — Plain discrete (C1)
Figure s01 (caption): a horizontal number line from 0 to 4 with two cyan mass spikes — a tall one at (height ) and a shorter one at (height ); a dotted white line marks the midpoint , and an amber triangular pivot sits at showing the balance point pulled right of the midpoint by the heavier mass.

Step 1 — Expectation. . Why this step? Expectation is each value weighted by how likely it is — the balance point. Because heads is more likely, the balance sits nearer 3, matching a sensible forecast. In the figure, the amber pivot marker at is dragged right of the dotted midpoint by the taller mass at .
Step 2 — Get . . Why this step? Variance's easy form is ; we need the average of the squared payout first.
Step 3 — Variance. . Why this step? Subtracting strips out the "center" and leaves pure spread.
Step 4 — SD. . Why this step? Square-root returns us to dollars, the original unit.
Ex 2 — Negative values (C2)
Figure s02 (caption): a number line from to with cyan dots at and ; a dashed amber vertical line marks the mean ; two cyan horizontal arrows run from the mean to each dot, labelled (rightward to ) and (leftward to ) — equal in length, opposite in direction.

Step 1 — Expectation. . Why this step? A negative value is just a point to the left of zero on the number line; it enters the weighted sum normally.
Step 2 — Deviations, then square. Deviations from : for it is ; for it is . Why this step? This is exactly why we square: the two deviations and would cancel if we just averaged them, falsely reporting zero spread. In the figure the two cyan arrows have equal length but point in opposite directions — plain averaging of and gives .
Step 3 — Variance. . Why this step? Squaring makes both deviations positive, so opposite signs reinforce instead of cancel — variance is always .
Step 4 — SD. . Why this step? Variance lives in squared dollars; taking the square root returns us to plain dollars so the spread is directly comparable to the payouts and .
Ex 3 — Continuous PDF (C3)
Figure s03 (caption): the triangular density drawn as a cyan line rising from to with the area beneath shaded cyan; a dashed amber vertical line at marks the mean, and an amber arrow near the base points rightward captioned "more mass on the right."

Step 1 — Sanity: is it a valid PDF? . ✓ Why this step? Total probability must be ; if the slivers don't add to , everything downstream is wrong.
Step 2 — Expectation (integral, not sum). . Why the integral? For a continuous variable there is no list of outcomes to sum; each sliver of width around a point carries probability , we weight its position by that probability, and the integral adds all slivers. As forecast, the balance point because mass leans right — matching the amber mean line in the figure sitting past the midpoint.
Step 3 — Second moment. . Why this step? Variance's easy form needs the average of the squared variable, so we weight by the same density and integrate again — the continuous twin of "sum the squares" from the dice examples.
Step 4 — Variance & SD. ; . Why this step? Subtracting removes the "center" contribution and leaves pure spread; the final square-root converts squared-units variance back to the plain scale of , so is a distance on the same axis.
Ex 4 — Degenerate / constant RV (C4)
Figure s04 (caption): a number line from 3 to 11 carrying a single tall amber spike of height at (probability ) and nothing anywhere else; a cyan annotation points at the spike noting that with all mass on one point there is no distance to average, so and .

Step 1 — Expectation of a constant. . Why this step? One outcome with probability : the balance point is that single point.
Step 2 — Variance. . Why this step? Every "observation" sits exactly on the mean, so every squared deviation is . This is the degenerate edge case: zero variance means zero randomness.
Step 3 — SD. . Why this step? The square-root of a zero variance is zero, and it must be: with all mass piled on the single amber spike in the figure there is literally no distance to average, so the spread in original units is exactly .
Recall What does
tell you? The value is fixed ::: it never deviates from its mean, so it isn't really random.
Ex 5 — Scaling and shifting (C5)
Figure s05 (caption): two stacked number lines. The upper line shows the die faces – as cyan dots with a dashed amber mean at ; the lower line shows , whose dots are spaced twice as far apart (a stretch) and whose dashed amber mean sits at (a slide). A white note reads "ticks spread ×2 (stretch); whole line slides (shift)."

Step 1 — Mean uses full linearity. . Why this step? Expectation is linear: constants slide straight through, and the shift does move the center.
Step 2 — Variance ignores the shift. . Why and why drop the ? Adding slides the whole distribution but keeps distances between points identical, so it changes nothing about spread. Multiplying by stretches every distance by ; squared distances stretch by . In the figure the lower line's dots are literally twice as far apart while its mean has merely slid.
Step 3 — SD. . Why not ? SD is a square root of variance, so it picks up . The absolute value matters if is negative — spread can't be negative.
Ex 6 — Sum of independent RVs (C6)
Figure s06 (caption): a bar chart with two bars — a cyan bar at the true SD and a taller amber bar at the wrong "SD + SD" — visually showing that adding standard deviations overshoots the real spread of the sum.

Step 1 — Mean adds always. . Why this step? Linearity of expectation needs no independence — means always add.
Step 2 — Variance adds (independence). . Why this step? Independent dice don't influence each other, so the covariance term is and only the variances add.
Step 3 — SD does NOT add. , not . Why this step? Variances live in squared units, so they add; SD is a square root of the summed variance. Adding SDs directly double-counts spread. In the figure the amber "added SDs" bar clearly overshoots the true cyan bar.
Ex 7 — Correlated sum, both signs (C7)
Figure s07 (caption): three bars for against a dotted white baseline at — a short cyan bar at (Cov ), a white bar at (independent, Cov ), and a tall amber bar at (Cov ) — showing the term pushing spread below or above the independent baseline.

Step 1 — General formula. . Why this step? Recall is our name for a mean. When variables move together, expanding — the squared deviation of the sum from its mean — leaves a cross-term whose average is .
Step 2 — Positive covariance. . Why this step? Positively correlated variables tend to be high together and low together, so their swings amplify — spread exceeds (the tall amber bar).
Step 3 — Negative covariance. . Why this step? Negatively correlated variables cancel each other's swings, so spread shrinks below (the short cyan bar). At perfect it would hit .
Ex 8 — Real-world word problem (C8)
Figure s08 (caption): a number line of order counts with three cyan mass spikes at (height ), (height , the tallest), and (height ); an amber triangular pivot at marks the mean, sitting left of the midrange because the heaviest mass at pulls it down.

Step 1 — Translate to a distribution. Support with probabilities . Why this step? The English sentence is a discrete RV in disguise; naming it lets us apply the machinery.
Step 2 — Expected orders. . Why this step? Expectation weights each possible order count by how often it occurs — the balance point of the three mass spikes in the figure. Note it need not equal any single outcome; sits between and because the heavier mass at pulls the pivot leftward of the midrange.
Step 3 — Second moment & variance. . So . Why this step? To measure spread we need , so we first average the squared order counts (weighting each by its probability), then subtract to strip out the center and leave pure spread in orders.
Step 4 — Scale to revenue. E[R]=4(170)=\680\text{Var}(R)=4^2(3100)=49600\text{SD}(R)=\sqrt{49600}\approx$222.74^2$44^2\lvert 4\rvert$.
Ex 9 — Exam twist: only moments given (C9)
Step 1 — Use the computational form. . Why this step? The identity was built precisely so that variance depends only on the two moments and — never on the individual outcomes. That is exactly why an exam can hand you just these two numbers and still expect an answer.
Step 2 — SD. . Why this step? Variance is in squared units; the square-root brings it back to the original scale of so the spread is directly comparable to the mean . Notice here, which is typical for a moderately concentrated variable.
Step 3 — Transform. ; the shift is invisible to spread. Why this step? By the scaling rule (Ex 5), multiplying by stretches every squared distance by , while adding merely slides the whole distribution and leaves all inter-point distances — hence the spread — unchanged. We never needed the distribution to apply this.
This spread-vs-noise theme returns as the "variance" axis of the bias–variance tradeoff.