7.1 Random variables
A random experiment has several outcomes, and usually we are interested in a **number** attached to each outcome (the total on two dice, the number of children in a family). Such a variable is a **random variable**: a variable whose value depends on the outcome of a random experiment (a rule that assigns a real number to each outcome). Random variables are written \(X,Y,Z\) and their values \(x,y,z\).
> **Example 7.1** Two dice are thrown and \(Y\) = sum of the dots. \(Y\) assigns 2 to \((1,1)\), 3 to \((1,2)\) and \((2,1)\), …, 12 to \((6,6)\): its values are 2, 3, …, 12.
> **Example 7.5** Three students each choose Biology (B) or Computer Science (C); \(Y\) = number choosing C:
\[\begin{array}{|c|c|c|c|c|c|c|c|c|}\hline \text{Outcome} & \text{BBB} & \text{CBB} & \text{BCB} & \text{BBC} & \text{CCB} & \text{CBC} & \text{BCC} & \text{CCC} \\ \hline y & 0 & 1 & 1 & 1 & 2 & 2 & 2 & 3 \\ \hline\end{array}\]
> **Example 7.7** Three coins, \(Y\) = number of heads: HHH → 3; HHT, HTH, THH → 2; HTT, THT, TTH → 1; TTT → 0.