Concept Probability & Statistics βœ“ Live

Random Variable

A random variable assigns a numerical value to each possible outcome of a random process, turning chance events into numbers that can be added, averaged, and analysed using the full toolkit of mathematics. Despite the name, a random variable is neither random (in the sense of being unpredictable in its definition) nor strictly a variable in the ordinary algebraic sense β€” it is formally a function.

Turning chance into numbers

Roll a die. The outcome is a physical event β€” a die landing showing a certain face. A random variable is the rule that converts that outcome into a number you can actually do arithmetic with. For a standard die, the natural random variable X just assigns X(outcome) = the number of dots showing: 1, 2, 3, 4, 5, or 6.

🎲 Why bother with this formal setup? Once outcomes become numbers, you can calculate averages, add multiple random variables together, and use the entire machinery of algebra and calculus to answer questions like "what's the expected total if I roll two dice?" or "how spread out are the results likely to be?"

Discrete vs continuous

A discrete random variable takes distinct, separate values β€” like a die roll (1 through 6) or the number of heads in 10 coin flips (0 through 10). A continuous random variable can take any value in a continuous range β€” like a person's exact height, or the exact time until a radioactive atom decays.

Everyday random variables

  • The number of emails you receive in a day (discrete)
  • Your exact commute time tomorrow (continuous)
  • The outcome of a coin flip, converted to 0 (tails) or 1 (heads) (discrete)
  • The measurement error in a scientific instrument (continuous)

Formal definition and key quantities

Formal definition

A random variable X is formally a function X : Ξ© β†’ ℝ, mapping outcomes in a sample space Ξ© to real numbers, such that for every real number x, the set {Ο‰ ∈ Ξ© : X(Ο‰) ≀ x} is a measurable event (has a well-defined probability). This technical measurability condition ensures that questions like "what is the probability X is less than 5?" always make sense.

Probability mass function and probability density function

For a discrete random variable, the probability mass function p(x) = P(X = x) gives the exact probability of each possible value. For a continuous random variable, individual exact values typically have probability zero, so instead a probability density function f(x) is used, where probabilities correspond to areas under the curve: P(a ≀ X ≀ b) = βˆ«β‚α΅‡ f(x) dx.

Expected value (mean)

The expected value E[X] is the long-run average value of X over many repetitions, weighted by probability:

E[X] = Ξ£ xΒ·p(x)   (discrete)     E[X] = ∫ xΒ·f(x) dx   (continuous)

For a fair six-sided die, E[X] = (1+2+3+4+5+6)/6 = 3.5 β€” notably, a value the die itself can never actually show, illustrating that the expected value is a long-run average, not a predicted single outcome.

Variance and standard deviation

Variance, Var(X) = E[(Xβˆ’E[X])Β²], measures how spread out the values of X tend to be around the mean. The standard deviation, Οƒ = √Var(X), expresses this same spread in the same units as X itself (rather than squared units), making it more directly interpretable.

Independence and linearity of expectation

Two random variables are independent if knowing the value of one gives no information about the other. Remarkably, linearity of expectation, E[X+Y] = E[X]+E[Y], holds true always β€” even when X and Y are not independent β€” making it one of the most useful and frequently applied facts in all of probability theory.

Measure-theoretic foundations and key theorems

Measure-theoretic definition

Rigorously, following Kolmogorov's axiomatic framework (see the Probability entry), a random variable is a measurable function X : (Ξ©, F, P) β†’ (ℝ, B), where F is a Οƒ-algebra of events on the sample space, and B is the Borel Οƒ-algebra on ℝ. The distribution of X is the probability measure it induces on ℝ, defined by pushing forward P through X. This framework allows expected value to be defined uniformly, for both discrete and continuous cases (and mixtures of the two), as a single Lebesgue integral: E[X] = ∫_Ξ© X dP.

Moments and moment generating functions

The n-th moment of X is E[Xⁿ]; the mean is the first moment, and variance is related to the second moment. The moment generating function M(t) = E[e^(tX)], when it exists, uniquely determines the entire distribution of X and provides a powerful technical tool: moments can be extracted by repeated differentiation of M(t) at t=0, and sums of independent random variables correspond to simple products of their moment generating functions β€” often making otherwise difficult calculations about sums tractable.

Convergence of random variables

Probability theory distinguishes several different, technically inequivalent notions of a sequence of random variables "converging": convergence in distribution (the weakest, underlying the Central Limit Theorem), convergence in probability (underlying the weak Law of Large Numbers), and almost sure convergence (the strongest, underlying the strong Law of Large Numbers). Careful distinctions between these modes of convergence are essential for correctly stating and proving the major limit theorems of probability theory.

Random vectors and joint distributions

Multiple random variables considered together form a random vector, described by a joint distribution capturing not just each variable's individual (marginal) behaviour but also how they relate to and depend upon each other β€” quantified by covariance and correlation. This framework generalises naturally to the multivariate normal distribution and underlies essentially all of modern multivariate statistics, machine learning, and quantitative finance.

πŸ“š Sources

Tier 1 Feller, W. (1968/1971). An Introduction to Probability Theory and Its Applications. Vols. 1–2, 3rd ed. Wiley.
Tier 1 Billingsley, P. (1995). Probability and Measure. 3rd ed. Wiley. β€” Rigorous measure-theoretic treatment.
Tier 2 Ross, S.M. (2014). A First Course in Probability. 9th ed. Pearson.

πŸ”— Related entries

Entry v1.0 Β· Added 2026-05-27 Β· Probability & Statistics Β· Concept JSON Markdown Status