Understanding Random Variables

A Random Variable is a real-valued function defined on the sample space of a random experiment. In simple words, it assigns a numerical value to each outcome of an experiment.

Example: If two coins are tossed, the sample space is S={HH,HT,TH,TT}S = \{HH, HT, TH, TT\} If we define XX as the number of heads, then X(HH)=2,X(HT)=1,X(TH)=1,X(TT)=0X(HH)=2, \quad X(HT)=1, \quad X(TH)=1, \quad X(TT)=0 Thus, XX is a random variable taking values 0,1,20, 1, 2

Types of Random Variables:

  • Discrete Random Variable: Takes only a finite or countably infinite number of values.
  • Continuous Random Variable: Takes any value in an interval.

At this level, the main focus is on discrete random variables.

Probability Distribution of a Random Variable

The list of all possible values of a discrete random variable together with their corresponding probabilities is called its probability distribution.

If a discrete random variable XX takes values x1,x2,,xnx_1, x_2, \dots, x_n with probabilities p1,p2,,pnp_1, p_2, \dots, p_n then the following conditions must hold:

  1. pi0for all ip_i \ge 0 \quad \text{for all } i
  2. i=1npi=1\sum_{i=1}^{n} p_i = 1

Probability Mass Function (PMF): For a discrete random variable, the function P(X=x)P(X=x) is called its probability mass function.

Mean (Mathematical Expectation)

The Mean or Expected Value of a random variable XX, denoted by E(X)E(X) or μ\mu, is the probability-weighted average of all possible values of XX.

It is given by E(X)=μ=i=1nxipiE(X)=\mu=\sum_{i=1}^{n} x_i p_i

It represents the long-run average value of the random variable.

Variance and Standard Deviation

The Variance measures the spread of the random variable around its mean.

It is given by Var(X)=σ2=E(X2)[E(X)]2Var(X)=\sigma^2 = E(X^2) - [E(X)]^2 where E(X2)=xi2piE(X^2)=\sum x_i^2 p_i

The Standard Deviation is the positive square root of the variance: σ=Var(X)\sigma = \sqrt{Var(X)}

Standard deviation is always non-negative and has the same units as the random variable.

Example 1: Probability Distribution of Heads

Two coins are tossed simultaneously. Find the probability distribution of the number of heads.

Solution: Let XX denote the number of heads.

The sample space is S={HH,HT,TH,TT}S = \{HH, HT, TH, TT\} So the possible values of XX are 0,1,20, 1, 2

Now, P(X=0)=P(TT)=14P(X=0)=P(TT)=\frac{1}{4} P(X=1)=P(HT,TH)=24=12P(X=1)=P(HT,TH)=\frac{2}{4}=\frac{1}{2} P(X=2)=P(HH)=14P(X=2)=P(HH)=\frac{1}{4}

Hence the distribution is:

XX 0 1 2
P(X)P(X) 14\frac{1}{4} 12\frac{1}{2} 14\frac{1}{4}

Check: 14+12+14=1\frac{1}{4}+\frac{1}{2}+\frac{1}{4}=1 So this is a valid probability distribution.

Answer: The probability distribution is P(X=0)=14,P(X=1)=12,P(X=2)=14P(X=0)=\frac{1}{4}, \quad P(X=1)=\frac{1}{2}, \quad P(X=2)=\frac{1}{4}

Example 2: Finding Constant 'k'

The probability distribution of a random variable XX is given by P(X=x)=kxP(X=x)=kx for x=1,2,3x=1,2,3 and P(X=x)=0P(X=x)=0 otherwise. Find the value of kk and P(X2)P(X \le 2).

Solution: Since the total probability is 1, P(X=1)+P(X=2)+P(X=3)=1P(X=1)+P(X=2)+P(X=3)=1 k(1)+k(2)+k(3)=1k(1)+k(2)+k(3)=1 6k=16k=1 k=16k=\frac{1}{6}

Now, P(X2)=P(X=1)+P(X=2)P(X\le 2)=P(X=1)+P(X=2) =k+2k=3k= k+2k = 3k =3(16)=12= 3\left(\frac{1}{6}\right)=\frac{1}{2}

Answer: k=16,P(X2)=12k=\frac{1}{6}, \qquad P(X\le 2)=\frac{1}{2}

Example 3: Mean of a Die Roll

Find the mean of the number of points obtained in a single throw of a fair die.

Solution: Let XX be the number obtained on the die. Then X{1,2,3,4,5,6}X \in \{1,2,3,4,5,6\} and for a fair die, P(X=x)=16for each x=1,2,3,4,5,6P(X=x)=\frac{1}{6} \quad \text{for each } x=1,2,3,4,5,6

Therefore, E(X)=xP(X=x)E(X)=\sum xP(X=x) E(X)=116+216+316+416+516+616E(X)=1\cdot\frac{1}{6}+2\cdot\frac{1}{6}+3\cdot\frac{1}{6}+4\cdot\frac{1}{6}+5\cdot\frac{1}{6}+6\cdot\frac{1}{6} E(X)=1+2+3+4+5+66=216=72=3.5E(X)=\frac{1+2+3+4+5+6}{6}=\frac{21}{6}=\frac{7}{2}=3.5

Answer: E(X)=72=3.5E(X)=\frac{7}{2}=3.5

Example 4: Variance and Standard Deviation Calculation

Find the variance of the number of heads in two tosses of a coin.

Solution: From the distribution of the number of heads in two tosses, P(X=0)=14,P(X=1)=12,P(X=2)=14P(X=0)=\frac{1}{4}, \quad P(X=1)=\frac{1}{2}, \quad P(X=2)=\frac{1}{4}

First, compute the mean: E(X)=014+112+214E(X)=0\cdot\frac{1}{4}+1\cdot\frac{1}{2}+2\cdot\frac{1}{4} E(X)=0+12+12=1E(X)=0+\frac{1}{2}+\frac{1}{2}=1

Now, E(X2)=0214+1212+2214E(X^2)=0^2\cdot\frac{1}{4}+1^2\cdot\frac{1}{2}+2^2\cdot\frac{1}{4} E(X2)=0+12+1=32E(X^2)=0+\frac{1}{2}+1=\frac{3}{2}

Hence, Var(X)=E(X2)[E(X)]2Var(X)=E(X^2)-[E(X)]^2 Var(X)=3212=321=12Var(X)=\frac{3}{2}-1^2=\frac{3}{2}-1=\frac{1}{2}

Answer: Var(X)=12Var(X)=\frac{1}{2}

Example 5: Defective Items Distribution

From a lot of 10 items containing 3 defectives, a sample of 2 items is drawn at random without replacement. Find the probability distribution of the number of defective items.

Solution: Let XX be the number of defective items in the sample of 2. Then possible values are X=0,1,2X=0,1,2

Total number of ways of choosing 2 items from 10 is (102)=45\binom{10}{2}=45

For X=0X=0: Both selected items are non-defective. There are 7 non-defective items, so P(X=0)=(72)(102)=2145=715P(X=0)=\frac{\binom{7}{2}}{\binom{10}{2}}=\frac{21}{45}=\frac{7}{15}

For X=1X=1: Choose 1 defective from 3 and 1 non-defective from 7: P(X=1)=(31)(71)(102)=3745=2145=715P(X=1)=\frac{\binom{3}{1}\binom{7}{1}}{\binom{10}{2}}=\frac{3\cdot 7}{45}=\frac{21}{45}=\frac{7}{15}

For X=2X=2: Choose 2 defectives from 3: P(X=2)=(32)(102)=345=115P(X=2)=\frac{\binom{3}{2}}{\binom{10}{2}}=\frac{3}{45}=\frac{1}{15}

Thus the distribution is:

XX 0 1 2
P(X)P(X) 715\frac{7}{15} 715\frac{7}{15} 115\frac{1}{15}

Check: 715+715+115=1\frac{7}{15}+\frac{7}{15}+\frac{1}{15}=1

Answer: P(X=0)=715,P(X=1)=715,P(X=2)=115P(X=0)=\frac{7}{15}, \quad P(X=1)=\frac{7}{15}, \quad P(X=2)=\frac{1}{15}

Example 6: Expected Gain in a Game

A player tosses two coins. He wins Rs 5 if 2 heads appear, Rs 2 if 1 head appears and Rs 1 if no head appears. Find his expected gain.

Solution: Let XX denote the gain of the player. Then X=5 if 2 heads appearX=5 \text{ if 2 heads appear} X=2 if 1 head appearsX=2 \text{ if 1 head appears} X=1 if no head appearsX=1 \text{ if no head appears}

From the distribution of heads in two tosses, P(2 heads)=14,P(1 head)=12,P(0 heads)=14P(2 \text{ heads})=\frac{1}{4}, \qquad P(1 \text{ head})=\frac{1}{2}, \qquad P(0 \text{ heads})=\frac{1}{4}

Hence, E(X)=514+212+114E(X)=5\cdot\frac{1}{4}+2\cdot\frac{1}{2}+1\cdot\frac{1}{4} E(X)=54+1+14=54+44+14=104=52E(X)=\frac{5}{4}+1+\frac{1}{4}=\frac{5}{4}+\frac{4}{4}+\frac{1}{4}=\frac{10}{4}=\frac{5}{2}

Answer: Expected gain=52=Rs 2.50\text{Expected gain}=\frac{5}{2}=\text{Rs }2.50

Example 7: Using E(X) to find Variance

A random variable XX has mean 3 and variance 2. Find E(X2)E(X^2).

Solution: We know that Var(X)=E(X2)[E(X)]2Var(X)=E(X^2)-[E(X)]^2 Given, E(X)=3,Var(X)=2E(X)=3, \qquad Var(X)=2 So, 2=E(X2)322=E(X^2)-3^2 2=E(X2)92=E(X^2)-9 E(X2)=11E(X^2)=11

Answer: E(X2)=11E(X^2)=11

Example 8: Dice Difference Distribution

Two dice are thrown. Let XX be the absolute difference of the numbers appearing. Find the probability distribution of XX.

Solution: When two dice are thrown, total outcomes are 3636 The possible values of the absolute difference are 0,1,2,3,4,50,1,2,3,4,5

Now count the number of outcomes for each value:

For X=0X=0: (1,1),(2,2),(3,3),(4,4),(5,5),(6,6)(1,1),(2,2),(3,3),(4,4),(5,5),(6,6) So frequency is 66, hence P(X=0)=636=16P(X=0)=\frac{6}{36}=\frac{1}{6}

For X=1X=1: There are 10 outcomes, so P(X=1)=1036=518P(X=1)=\frac{10}{36}=\frac{5}{18}

For X=2X=2: There are 8 outcomes, so P(X=2)=836=29P(X=2)=\frac{8}{36}=\frac{2}{9}

For X=3X=3: There are 6 outcomes, so P(X=3)=636=16P(X=3)=\frac{6}{36}=\frac{1}{6}

For X=4X=4: There are 4 outcomes, so P(X=4)=436=19P(X=4)=\frac{4}{36}=\frac{1}{9}

For X=5X=5: There are 2 outcomes, so P(X=5)=236=118P(X=5)=\frac{2}{36}=\frac{1}{18}

Hence the probability distribution is:

XX 0 1 2 3 4 5
P(X)P(X) 16\frac{1}{6} 518\frac{5}{18} 29\frac{2}{9} 16\frac{1}{6} 19\frac{1}{9} 118\frac{1}{18}

Check: 16+518+29+16+19+118=1\frac{1}{6}+\frac{5}{18}+\frac{2}{9}+\frac{1}{6}+\frac{1}{9}+\frac{1}{18}=1

Answer: The probability distribution is as shown above.

Example 9: Expectation of a Constant and Linear Property

Given E(X)=5E(X)=5, find E(3X+4)E(3X+4).

Solution: Using linearity of expectation, E(aX+b)=aE(X)+bE(aX+b)=aE(X)+b So, E(3X+4)=3E(X)+4E(3X+4)=3E(X)+4 =3(5)+4=15+4=19=3(5)+4=15+4=19

Answer: 1919

Example 10: Step-by-Step Variance of a Distribution

A random variable XX has the following distribution. Find its variance.

XX 1 2 3
P(X)P(X) 0.2 0.5 0.3

Solution: First, compute the mean: E(X)=1(0.2)+2(0.5)+3(0.3)E(X)=1(0.2)+2(0.5)+3(0.3) E(X)=0.2+1.0+0.9=2.1E(X)=0.2+1.0+0.9=2.1

Now compute E(X2)=12(0.2)+22(0.5)+32(0.3)E(X^2)=1^2(0.2)+2^2(0.5)+3^2(0.3) E(X2)=0.2+4(0.5)+9(0.3)E(X^2)=0.2+4(0.5)+9(0.3) E(X2)=0.2+2.0+2.7=4.9E(X^2)=0.2+2.0+2.7=4.9

Hence, Var(X)=E(X2)[E(X)]2Var(X)=E(X^2)-[E(X)]^2 Var(X)=4.9(2.1)2Var(X)=4.9-(2.1)^2 Var(X)=4.94.41=0.49Var(X)=4.9-4.41=0.49

Answer: Var(X)=0.49Var(X)=0.49