Mathematics · core

Random Variables & Distributions

Discrete and continuous distributions, expectation, variance, and the law of large numbers.

mathematicsprobability

Mental model

A random variable is a function from outcomes to numbers. Expectation is the long-run average; variance measures spread. The CLT says sums of many independent pieces look Gaussian — which is why normal distributions are everywhere.

How to study Random Variables & Distributions

Begin by restating the mental model in your own words, then connect it to a concrete system you have built or operated. Name the mechanism, the constraint it addresses, and the trade-off it introduces. Use MIT 6.041SC — Probabilistic Systems Analysis (course), StatQuest — Probability vs Likelihood to check details, but close the source before writing your explanation. Retrieval is the learning step; rereading is only preparation.

Next, compare Random Variables & Distributions with Descriptive Statistics, Estimation & Confidence Intervals, Hypothesis Testing. Ask what changes in correctness, latency, resource use, operability, and failure recovery. Complete Expectation and variance of a discrete RV, Normal tail probability and preserve the command, input, output, and one failed attempt as evidence. Finish by explaining the idea without jargon to someone who has not studied the track.

Proof of understanding

  • Explain the mechanism from first principles and identify the state it reads or changes.
  • Give one situation where the concept is the right choice and one where it is not.
  • Predict a realistic failure mode before running the drill, then compare the prediction with evidence.
  • Connect the result to a roadmap or build artifact instead of treating the concept as isolated trivia.

Where it matters

Latency modeling, error bars, Monte Carlo simulation, loss function design.

Common mistakes

  • Confusing the PDF value with a probability (for continuous RVs)
  • Assuming small samples look like their population distribution
  • Using variance when you mean standard deviation in an explanation

Learn from primary sources

Practice and explain it back

Expectation and variance of a discrete RV

X takes values {0, 1, 2} with probabilities {0.2, 0.5, 0.3}. Compute E[X] and Var(X) = E[X²] − (E[X])².

Expected evidence: E[X] = 1.1, E[X²] = 1.5, Var(X) = 0.29.

Open the interactive drill →

Normal tail probability

Latency is Normal(μ=100ms, σ=20ms). Approximate P(X > 140ms) using the z-score and a standard normal table (Φ(2) ≈ 0.977). What fraction is within 1σ of the mean?

Expected evidence: z=(140−100)/20=2; P(X>140)≈1−0.977=0.023. Within 1σ: ≈68%.

Open the interactive drill →

Review prompts

  • How does the sample mean relate to expectation?
  • Why is f(x) in a PDF not a probability?

Build evidence

Simulate coin flips, dice, and random walks

Code simulators (no stats libraries): Bernoulli trials, dice sums, and a 1D random walk. Plot or print distributions and compare sample mean to theory.

  • 10k coin flips: sample proportion within 0.02 of 0.5
  • Dice sum histogram matches triangular shape qualitatively
  • Random walk: report mean displacement and max |position| over T steps

Prerequisites

Related concepts

Learning paths