Discrete Random Variables

Fei Ye

January 2024

1. Learning Goals


2. Random Variables


Practice: Discrete or continuous

Classify each random variable as either discrete or continuous.

  1. The number of boys in a randomly selected three-child family.

  2. The temperature of a cup of coffee served at a restaurant.

  3. The number of math majors in randomly selected group of 10 students.

  4. The amount of rain recorded in a small town one day.


3. Probability Distributions


4. Basic Properties of Probability Distributions


5. Example: Distribution of Flipping Two Fair Coins

Let \(X\) be the number of heads that are observed when tossing two fair coins.

  1. Construct the probability distribution for \(X\).
  2. Find \(P(X\le 1)\) and \(P(X\le 2)\).

Solution: The possible values of the number of heads are \(0\), \(1\) and \(2\). The probability distribution can be characterized by the following table:

\(x\) 0 1 2
\(P(X=x)\) 0.25 0.5 0.25

From the table, we may find the following cumulative distributions: $$P(X\leq 1)=P(X=0)+P(X=1)=0.25+0.5=0.75.$$ $$P(X\leq 2)= P(X=0)+P(X=1)+P(X=2)=0.25+0.5+0.25=1.$$


6. Example: Histogram of an Unfair Coin

The probability distribution of an unfair coin is characterized by the following histogram. Find the probability of getting at most 1 head.

Solution: Let \(X\) be the number of heads. From the probability histogram, we know that \(P(X=0)=0.36\), and \(P(X=1)=0.47\).

Then the probability of getting at most 1 head is $$ P(X\le 1)=P(X=0)+P(X=1)=0.36+0.47=0.83. $$


Practice: Distribution of Rolling Dice

A pair of fair 6-sided dice were rolled. Let \(X\) denote the sum of the number of dots on the top faces.

  1. Construct the probability distribution of \(X\).
  2. Find the probability that \(X\) takes an odd value.

Practice: Distribution of Waiting Time


7. Mean and SD of a Discrete Random Variable

Let \(X\) be a discrete random variable and \(p_X(x)=P(X=x)\) the probability mass function.


8. Some Properties of Expected Value (Optional)


9. Example: Expected Gain

One thousand raffle tickets are sold for $2 each. Each has an equal chance of winning. First prize is $500, second prize is $300, and third prize is $100. Find the expected value of gain, and interpret its meaning.

Solution: Let \(X\) denote the net gain from purchasing one ticket. The probability distribution for \(X\) is

\(x\) 498 298 98 -2
\(P(X=x)\) \(\frac{1}{1000}\) \(\frac{1}{1000}\) \(\frac{1}{1000}\) \(\frac{997}{1000}\)

The expected gain is $$E(X)= 498\cdot \frac{1}{1000}+ 298\cdot\frac{1}{1000}+98\cdot \frac{1}{1000}+(-2)\cdot \frac{997}{1000}=-1.1,$$ which means that when buying one ticket, the buyer may expect a loss of $1.1.


10. Example: Expected Waiting Time and SD

The wait times (rounded to multiples of 5) in the cafeteria at a Community College has the following probability distribution. Find the expected waiting time and the standard deviation.

\(x\) (minutes) 5 10 15 20 25
\(P(X=x)\) 0.13 0.25 0.31 0.21 0.1

Solution: The expected waiting time is $$E(X)= 5\cdot 0.13 +10\cdot 0.25+15\cdot 0.31+20\cdot 0.21 + 25\cdot 0.1 = 14.5.$$ The standard deviation is then $$\scriptsize\begin{aligned}\sigma=&\sqrt{(5-14.5)^2\cdot 0.13 +(10-14.5)^2\cdot 0.25+(15-14.5)^2\cdot 0.31+(20-14.5)^2\cdot 0.21 + (25-14.5)^2\cdot 0.1}\\ \approx& 5.9. \end{aligned}$$


11. Example: Distribution of a Unfair Die (1 of 2)

The probability distribution of an unfair die is given in the following table.

\(x\) 1 2 3 4 5 6
\(P(X=x)\) 0.18 0.12 \(\,?\,\) 0.14 0.23 0.17
  1. Find \(P(X=3)\).
  2. Find the mean, variance and standard deviation of this probability distribution.

Solution: Since the sum of probabilities must be 1, we know that $$ P(X=3)=1-(0.18+0.12+0.14+0.23+0.17)=0.16 $$


12. Example: Distribution of a Unfair Die (2 of 2)

The mean is the weighted sum $$ % \scriptstyle \begin{aligned} \mu=&0.18\cdot 1+0.12\cdot 2+0.16\cdot 3+0.14\cdot 4+0.23\cdot 5+0.17\cdot 6\\ =&3.63. \end{aligned} $$

The variance is $$ \scriptstyle \begin{aligned} \sigma^2=&0.18(1-3.63)^2+0.12(2-3.63)^2+0.16(3-3.63)^2+0.14(4-3.63)^2+0.23(5-3.63)^2+0.17(6-3.63)^2\\ =&3.0331. \end{aligned} $$

Therefore, the standard deviation is $$ \sigma=\sqrt{\sigma^2}=\sqrt{3.0331}\approx 1.7416. $$


Practice: Lottery Tickets

Seven thousand lottery tickets are sold for $5 each. One ticket will win $2,000, two tickets will win $750 each, and five tickets will win $100 each. Let \(X\) denote the net gain from the purchase of a randomly selected ticket.

  1. Construct the probability distribution of \(X\).
  2. Compute the expected value \(E(X)\) of \(X\). Interpret its meaning.
  3. Compute the standard deviation \(\sigma\) of \(X\).

Source: https://saylordotorg.github.io/text_introductory-statistics/s08-02-probability-distributions-for-.html


13. Binomial Distribution


14. Example: Multiple Cards Drawing (1 of 2)

A card is randomly selected from a standard deck and replaced. This experiment is repeated a total of \(5\) times.

Solution: This is a binomial experiment. The number to total trials is \(n=5\). The number of successes is \(3\). The chance of a success is \(p=\frac{13}{52}=\frac14\).

The probability of getting exactly \(3\) clubs is \(P(X=3)\).

Method 1: Using the binomial probability formula

$$\textstyle P(X=3)=\frac{5!}{3!2!} \left(\frac{1}{4}\right)^3\left(\frac34\right)^2=10\cdot\frac{9}{4^5}\approx 0.088.$$

Method 2: Using Excel

The probability \(P(X=3)\) can also be found by using the Excel function BINOM.DIST(3, 5, 1 / 4, FALSE).


15. Example: Multiple Cards Drawing (2 of 2)

To probability of getting at least \(3\) club is $$\textstyle P(X\geq 3) =1-P(X\leq 2)=1-(P(0)+P(1)+P(2))\approx 1-0.8965=0.1035.$$

To calculate \(P(X\leq 2)\), there are two methods.

Method 1: In Excel, \(P(X\le 2)\) =BINOM.DIST(2,5,0.25,TRUE) \(\approx 0.8965\).

Method 1: As \(n=5\) and \(p=0.25\), we use the following portion of the cumulative binomial distribution table.

Binomial Probability Table n=5

n x 0.1 0.15 0.2 0.25 0.3 0.35 0.4
5 0 0.5905 0.4437 0.3277 0.2373 0.1681 0.116 0.0778
5 1 0.3281 0.3915 0.4096 0.3955 0.3602 0.3124 0.2592
5 2 0.0729 0.1382 0.2048 0.2637 0.3087 0.3364 0.3456
5 3 0.0081 0.0244 0.0512 0.0879 0.1323 0.1811 0.2304

\(P(X\le 2) \approx 0.2373+0.3955+0.2637= 0.8965.\)


Practice: Binomial Distribution

Let \(X\) be a binomial random variable with parameters \(n = 5\), \(p=0.2\). Find the probabilities

  1. \(P(X=3),\)
  2. \(P(X<3),\)
  3. \(P(X>3).\)

Practice: Machine Defect Rate


16. Mean and SD of Binomial Distribution (⅘)

Remark: \(\sum \left[x\cdot \dfrac{n!}{(n-x)!x!}p^x(1-p)^{n-x}\right] = np\cdot\sum \left[\dfrac{(n-1)!}{(n-x)!(x-1)!}p^{x-1}(1-p)^{n-x}\right] = np \cdot (p+(1-p))^{n-1} =np.\)


17. Example: Expected Value and SD of Cracked Eggs

The probability that an egg in a retail package is cracked or broken is 0.02.

  1. Find the average number of cracked or broken eggs in a one dozen carton.
  2. Find the standard deviation.
  3. Is getting at least two broken eggs unusual?

Solution: Since there are 12 eggs and the chance of getting a cracked egg is 0.02, the average number of cracked is \(\mu =np=12\cdot 0.02=0.24.\)

The standard deviation is \(\sigma=\sqrt{12\cdot 0.02\cdot(1-0.02)}\approx 0.4850.\)

Recall the Empirical rule: 95% data are within 2 standard deviation away from the mean. Since \(2>0.24+2\cdot 0.4850\), the chance of getting at least two cracked eggs is less than 5%, which is considered as unusual.

Note that the probability of getting at least two cracked eggs is \(P(X\geq 2)=1-P(X\leq 1)=\) 1-BINOM.DIST(1, 12, 0.02, TRUE) \(\approx 0.9768922\).


Practice: Quality of Grapefruit

Adverse growing conditions have caused 5% of grapefruit grown in a certain region to be of inferior quality. Grapefruit are sold by the dozen.

  1. Find the average number of inferior quality grapefruit per box of a dozen.

  2. A box that contains two or more grapefruit of inferior quality will cause a strong adverse customer reaction. Find the probability that a box of one dozen grapefruit will contain two or more grapefruit of inferior quality.


Practice: Mean and SD of a Binomial Distribution


Extra Practice


Practice: Mean of a Discrete Variable


Practice: SD of a Discrete Variable


Practice: Probability within One SD


Practice: Probability from a Poll


Lab Instructions in Excel


18. Excel Functions for Binomial

Let \(X\) be a binomial random variable with parameters \(n\) and \(p\), that is \(X\sim B(n, p)\). In Excel, \(P(X=x)\) is given by BINOM.DIST(x, n, p, FALSE) and \(P(X\le x)\) is given by BINOM.DIST(x, n, p, TRUE). You may click input function \(f_x\) and then search binom to find the function.


Lab Practice: Binominal Distribution Table

Create a binomial distribution table for \(p=0.5\) and \(n=10\). (See the linked PDF for example)