Login

Concepts

Read through concept notes with worked explanations and diagrams, chapter by chapter.

Concept 06 / 08Statistics and Probability

Random Variables, Probability Distributions, Mean and Variance

Discrete random variables and their probability distributions, checking a distribution, the mean E(X) = sum x p, variance E(X^2) - [E(X)]^2 and standard deviation, linearity of expectation, and expected value in games and decisions.

Figure 1
A random variable XX assigns a real number to each outcome of an experiment, for example the sum of two dice or the number of heads in three tosses. A discrete random variable takes a list of values x1,x2,…x_{1}, x_{2}, \ldots with probabilities pi=P(X=xi)p_{i} = P(X = x_{i}). The table of values and probabilities is its probability distribution. It is valid iff every pi≥0p_{i} \ge 0 and ∑pi=1\sum p_{i} = 1. The figure shows the distribution of the sum of two dice: triangular, peaking at 77. Mean (expectation): E(X)=μ=∑xipiE(X) = \mu = \sum x_{i}p_{i}. It is the long-run average value of XX over many repetitions, the 'centre of mass' of the distribution. It need not be a possible value: the expected number shown by a die is 3.53.5. Variance and standard deviation: Var(X)=E[(X−μ)2]=∑(xi−μ)2pi=E(X2)−[E(X)]2\text{Var}(X) = E[(X - \mu)^{2}] = \sum(x_{i} - \mu)^{2}p_{i} = E(X^{2}) - [E(X)]^{2}, with E(X2)=∑xi2piE(X^{2}) = \sum x_{i}^{2}p_{i}. The standard deviation is σ=Var(X)\sigma = \sqrt{\text{Var}(X)}. These are exactly the formulas for the mean and variance of a frequency distribution, with relative frequencies replaced by probabilities. Properties. E(aX+b)=aE(X)+bE(aX + b) = aE(X) + b and Var(aX+b)=a2Var(X)\text{Var}(aX + b) = a^{2}\text{Var}(X). Linearity of expectation: E(X+Y)=E(X)+E(Y)E(X + Y) = E(X) + E(Y) always, even when XX and YY are dependent. This is extremely powerful: to find the expected number of something, write it as a sum of indicator variables (each 11 if a particular thing happens and 00 otherwise) and add their probabilities. If XX and YY are independent, Var(X+Y)=Var(X)+Var(Y)\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y) and E(XY)=E(X)E(Y)E(XY) = E(X)E(Y). Without independence these can fail. Example: one die. E(X)=216=3.5E(X) = \frac{21}{6} = 3.5, E(X2)=916E(X^{2}) = \frac{91}{6}, Var(X)=916−494=3512\text{Var}(X) = \frac{91}{6} - \frac{49}{4} = \frac{35}{12}. For the sum of two independent dice, E=7E = 7 and Var=356\text{Var} = \frac{35}{6}, as noted in the figure. Expected value in games. A game is fair if the expected gain is 00. To compute the expected gain, list each outcome's net gain (winnings minus stake) with its probability and take ∑\sum gain ×\times probability. Key Takeaways: - Valid distribution: pi≥0p_{i} \ge 0, ∑pi=1\sum p_{i} = 1. - E(X)=∑xipiE(X) = \sum x_{i}p_{i}; Var(X)=E(X2)−[E(X)]2\text{Var}(X) = E(X^{2}) - [E(X)]^{2}. - E(aX+b)=aE(X)+bE(aX + b) = aE(X) + b; Var(aX+b)=a2Var(X)\text{Var}(aX + b) = a^{2}\text{Var}(X). - E(X+Y)=E(X)+E(Y)E(X + Y) = E(X) + E(Y) always; variance adds only for independent variables. - Indicator variables turn 'expected number' questions into sums of probabilities. - One die: mean 3.53.5, variance 3512\frac{35}{12}. - Pitfall: writing Var(X−Y)=Var(X)−Var(Y)\text{Var}(X - Y) = \text{Var}(X) - \text{Var}(Y); for independent variables it is the sum. Brain-Teaser 1: A random variable has P(X=x)=kxP(X = x) = kx for x=1,2,3,4x = 1, 2, 3, 4. Find kk, E(X)E(X) and Var(X)\text{Var}(X). Solution: k(1+2+3+4)=1k(1 + 2 + 3 + 4) = 1, so k=110k = \frac{1}{10}. E(X)=∑x⋅x10=3010=3E(X) = \sum x \cdot \frac{x}{10} = \frac{30}{10} = 3. E(X2)=∑x310=10010=10E(X^{2}) = \sum\frac{x^{3}}{10} = \frac{100}{10} = 10. Var(X)=10−9=1\text{Var}(X) = 10 - 9 = 1. The normalisation condition ∑p=1\sum p = 1 always comes first. Brain-Teaser 2: nn letters are put at random into nn envelopes. What is the expected number of letters in the correct envelope? Solution: Let IkI_{k} be 11 if letter kk is correct and 00 otherwise. E(Ik)=P(letter k correct)=1nE(I_{k}) = P(\text{letter } k \text{ correct}) = \frac{1}{n}. By linearity, E(∑Ik)=n×1n=1E(\sum I_{k}) = n \times \frac{1}{n} = 1, for every nn. The indicators are dependent, but linearity does not care; computing the full distribution (which involves derangements) would be far harder. Brain-Teaser 3: You pay ₹10 to roll a die and receive ₹ (5 times the number shown) if it is even, nothing otherwise. Is the game fair? Solution: Winnings: 10,20,3010, 20, 30 each with probability 16\frac{1}{6}, and 00 with probability 12\frac{1}{2}. Expected winnings =606=10= \frac{60}{6} = 10. The expected net gain is 10−10=010 - 10 = 0, so the game is fair. Fairness is a statement about expectation, even though any single play has a definite gain or loss.