Salick Academy

Random Variables

No calculator

A random variable attaches a number to each outcome of an experiment. Once you have its distribution, two summary numbers — the expectation and the variance — describe almost everything you need.

Discrete random variables

A discrete random variable takes separate, countable values: the score on a die, the number of defective items in a batch.

Notation: capital XX for the variable, lower-case xx for a particular value, so P(X=x)P(X = x) is the probability that XX takes the value xx.

Probability distributions

A probability distribution lists every value with its probability. Two conditions must hold:

0P(X=x)1andP(X=x)=10 \le P(X = x) \le 1 \qquad \text{and} \qquad \sum P(X = x) = 1

xx 1 2 3 4
P(X=x)P(X=x) 0.1 0.2 0.4 0.3

The probabilities total 11

Finding an unknown constant. If XX takes the values 1,2,31, 2, 3 with P(X=x)=kxP(X = x) = kx, then

k(1)+k(2)+k(3)=16k=1k=16k(1) + k(2) + k(3) = 1 \quad \Rightarrow \quad 6k = 1 \quad \Rightarrow \quad k = \tfrac16

Expectation

E(X)=xP(X=x)E(X) = \sum x\,P(X = x)

the long-run average value if the experiment were repeated indefinitely.

For the distribution above:

E(X)=1(0.1)+2(0.2)+3(0.4)+4(0.3)=0.1+0.4+1.2+1.2=2.9E(X) = 1(0.1) + 2(0.2) + 3(0.4) + 4(0.3) = 0.1 + 0.4 + 1.2 + 1.2 = 2.9

For a fair die:

E(X)=1+2+3+4+5+66=3.5E(X) = \frac{1+2+3+4+5+6}{6} = 3.5

For a function of XX, weight the function's values by the same probabilities:

E(g(X))=g(x)P(X=x)E\big(g(X)\big) = \sum g(x)\,P(X = x)

E(X2)=1(0.1)+4(0.2)+9(0.4)+16(0.3)=0.1+0.8+3.6+4.8=9.3E(X^2) = 1(0.1) + 4(0.2) + 9(0.4) + 16(0.3) = 0.1 + 0.8 + 3.6 + 4.8 = 9.3

Variance

Var(X)=E(X2)[E(X)]2\operatorname{Var}(X) = E(X^2) - \big[E(X)\big]^2

For the distribution above:

Var(X)=9.38.41=0.89\operatorname{Var}(X) = 9.3 - 8.41 = 0.89

The standard deviation is 0.89=0.943\sqrt{0.89} = 0.943.

For a fair die:

E(X2)=1+4+9+16+25+366=916Var(X)=916494=35122.92E(X^2) = \frac{1+4+9+16+25+36}{6} = \frac{91}{6} \qquad \operatorname{Var}(X) = \frac{91}{6} - \frac{49}{4} = \frac{35}{12} \approx 2.92

Linear transformations

E(aX+b)=aE(X)+bE(aX + b) = aE(X) + b Var(aX+b)=a2Var(X)\operatorname{Var}(aX + b) = a^2\operatorname{Var}(X)

With E(X)=2.9E(X) = 2.9 and Var(X)=0.89\operatorname{Var}(X) = 0.89:

E(3X+2)=3(2.9)+2=10.7E(3X + 2) = 3(2.9) + 2 = 10.7 Var(3X+2)=9(0.89)=8.01\operatorname{Var}(3X + 2) = 9(0.89) = 8.01

The cumulative distribution function

F(x)=P(Xx)F(x) = P(X \le x)

a running total of the probabilities.

xx 1 2 3 4
P(X=x)P(X=x) 0.1 0.2 0.4 0.3
F(x)F(x) 0.1 0.3 0.7 1.0

FF never decreases, and its final value is always 1.

Individual probabilities can be recovered by subtraction:

P(X=x)=F(x)F(x1)P(X = x) = F(x) - F(x-1)

so P(X=3)=0.70.3=0.4P(X = 3) = 0.7 - 0.3 = 0.4