It is a function
X(s) is a number for each outcome s. Nothing about it is random; the randomness is in which s occurs.
A random variable is a function from the sample space to the reals. Its distribution collects the probabilities of its values, and it is neither random nor a variable.
Core ideas
Random variables let one sample space answer many questions, by attaching different numbers to the same outcomes.
X(s) is a number for each outcome s. Nothing about it is random; the randomness is in which s occurs.
P(X = k) for each value k. It discards which outcomes gave that value, which is usually exactly what you want.
The number of heads in three flips and the number of tails have the same distribution and are different functions.
The material
The definition, the distribution, and how several variables interact.
A random variable on a sample space S is a function X : S → ℝ — a function in the sense of “Functions”, in Sets, Relations, and Functions, one value for each element of the domain S. The event X = k is {s ∈ S : X(s) = k}, and P(X = k) is its probability.
The name is doubly misleading, as is traditional. X is a function and it is completely determined; what varies is which outcome occurs. Reading X as a function on outcomes removes most of the confusion this topic causes.
The distribution of a discrete random variable X is the list of pairs (k, P(X = k)) over the values X takes. The probabilities are non-negative and sum to 1.
S is the 36 pairs and X(a,b) = a + b. Then P(X = 2) = 1/36, P(X = 7) = 6/36, and so on. The distribution is the familiar triangle: 1,2,3,4,5,6,5,4,3,2,1 over 36.
For an event A, the indicator I_A is the random variable equal to 1 when A occurs and 0 otherwise. Its distribution is P(I_A = 1) = P(A).
Indicators look trivial and are the single most useful tool in “Linearity of Expectation”. Any count can be written as a sum of indicators, and expectation adds over sums regardless of dependence.
The joint distribution of X and Y is P(X = a, Y = b) for all a, b. They are independent when P(X = a, Y = b) = P(X = a)P(Y = b) for every pair.
Roll two dice; let X be the first die and Y the sum. These are dependent: P(Y = 2 | X = 3) = 0 while P(Y = 2) = 1/36. Knowing X restricts Y sharply.
Functions of random variables are random variables: X², X + Y and max(X, Y) are all functions on S. Their distributions are computed by collecting the outcomes, which is the only method available and is usually enough.
Interactive
Definition first, formula second
Method
Define the function before computing anything about it.
"The number of heads", "the sum", "1 if it rains". A random variable with no stated rule is not defined.
P(X = k) is the probability of the set of outcomes giving k. This is Combinatorics and Counting's counting again.
Every outcome contributes to exactly one value, so the probabilities must total 1. A free check that catches missed cases.
Independence is a statement about every entry of it, not about a summary.
S = {HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}, each 1/8.
Y is an indicator, and X is the sum of three such indicators — one per flip. That decomposition is what “Linearity of Expectation” exploits, and it works even though the indicators here are visibly not independent of X.
Roll two dice and let X be the larger of the two values. Write the distribution of X and check it sums to 1. P(X = k) is (2k − 1)/36, and deriving that is the exercise.
Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.
No recommendations yet for this lesson.