Random variables · Definition
Random variable
Before you start you need to know
It summarizes each outcome of an experiment with a number, so that the whole machinery of calculus can be applied to chance phenomena.
Definition
A random variable \(X\) is a function that assigns a real number to each outcome of the sample space \(\Omega\) of a random experiment.
The name is misleading: a random variable is neither a variable nor random by itself. It is a fixed function \(X\) that sends each outcome \(\omega\) of the sample space to a number \(X(\omega)\). The randomness lives in the experiment, which decides which \(\omega\) occurs; \(X\) only translates it into a number. When rolling two dice, \(X(a,b)=a+b\) turns the pair into its sum.
Thanks to \(X\), events can be described with numerical conditions. The set \(\{X=4\}\) is the event made of all outcomes \(\omega\) with \(X(\omega)=4\); for the sum of two dice they are \((1,3)\), \((2,2)\) and \((3,1)\). Likewise \(\{X\le 5\}\) or \(\{X\text{ is even}\}\) are events, and their probability is computed with the probability measure of the original space, for instance \(P(X=4)=\tfrac3{36}\).
A random variable is discrete if it takes isolated values that can be listed (number of heads, calls, defects) and continuous if it can take any value in an interval (a time, a height, a temperature). The distinction decides how its distribution is described: with a mass function in the discrete case and a density function in the continuous one.
Two different variables can live in the same experiment and behave very differently: with two dice, the sum \(a+b\) and twice the first die \(2a\) are not distributed alike. A typical mistake is to confuse the variable with one of its values, or the function \(X\) with the event \(\{X=x\}\).
Think about it
If \(X\) is the number of heads in three tosses, how many outcomes make up the event \(\{X=2\}\)?
Three: HHT, HTH and THH.
Can a constant, such as \(X(\omega)=5\) for every \(\omega\), be a random variable?
Yes: it is a valid function from the sample space to the reals, even though its value carries no uncertainty.
Exercises 10
- Two coins are tossed and \(X\) is the number of heads. What is \(X(\text{HT})\), where H = heads and T = tails?
- Two dice are rolled and \(X\) is the sum. How many outcomes of the sample space make up the event \(\{X=4\}\)?
- Which of the following is a random variable?
- Three coins are tossed and \(X\) is the number of heads. What is the set of possible values of \(X\)?
- Two dice are rolled and \(X\) is the larger of the two results. Compute \(P(X=6)\).
- Two dice are rolled and \(Y=|a-b|\) is the absolute difference of the results. Compute \(P(Y=0)\).
- Which of the following random variables is continuous?
- Two fair coins are tossed and \(X\) is the number of heads. Compute \(P(X\ge 1)\).
- Let \(\Omega=\{-2,-1,0,1,2\}\) with equally likely outcomes and \(X(\omega)=\omega^2\). Compute \(P(X=1)\).
- With two dice, let \(S=a+b\) and \(T=2a\) (where \(a\) is the first die). Compute \(P(T=2)+P(S=2)\).
References
- Joseph K. Blitzstein, Jessica Hwang, Introduction to Probability, 2nd edition, CRC Press, 2019. §3.1
- Sheldon Ross, A First Course in Probability, 10th edition, Pearson, 2019. §4.1
- Larry Wasserman, All of Statistics, 1st edition, Springer, 2004. §2.1