# Discrete Random Variables

## What is a Random Variable?

A random variable, usually denoted as X, is a variable whose values are numerical outcomes of some random process. There are two types of random variables: discrete and continuous. This section will focus on discrete random variables.

## Discrete Random Variables

A discrete random variable is one which can take on only a countable number of distinct values like 0, 1, 2, 3, 4, 5…100, 1 million, etc. Some examples of discrete random variables include:

The number of members in a family.
The number of football players on a team.
The amount of animals at a zoo.
The number of chairs at a table.
The number of patients sitting in a doctor’s office.

## Probability Distributions

The probability distribution of a random variable is a list of probabilities associated with each of its possible values.

For example, suppose we flip a coin three times. Let random variable X = the number of times the coin lands on heads. Assuming “H” stands for “heads” and “T” stands for “tails”, here are the eight possible outcomes of three coin flips:

HHH    HHT    HTH    HTT    THH    THT    TTH    TTT

To make a probability distribution for X, we need to identify all the possible outcomes of XFrom the outcomes listed above, we can see that the number of heads after three flips could be: 0, 1, 2, or 3.

Next, we need to find the probability of each outcome.

The probability that the coin lands on heads 0 times is: P(X = 0) = 1/8

HHH    HHT    HTH    HTT    THH    THT    TTH    TTT

The probability that the coin lands on heads 1 time is: P(X = 1) = 3/8

HHH    HHT    HTH    HTT    THH    THT    TTH    TTT

The probability that the coin lands on heads 2 times is: P(X = 2) = 3/8

HHH    HHT    HTH    HTT    THH    THT    TTH    TTT

And the probability that the coin lands on heads 3 times is: P(X = 3) = 1/8

HHH    HHT    HTH    HTT    THH    THT    TTH    TTT

So the probability distribution of X is: And we can visual this probability distribution in a plot with the value for X on the x-axis and the probability on the y-axis:

## Valid Discrete Probability Distributions

A discrete probability distribution is valid if the probabilities for all of the possible values adds up to one. The probability distribution in our previous example is valid because all of the probabilities add up to one: A discrete probability distribution is not valid if the probabilities add up to anything but one. For example, the following two probability distributions are not valid:  ## Finding Probabilities of Discrete Random Variables

We can use probability distributions to answer questions about probability. Consider again our probability distribution of a coin landing on heads during three flips: What is the probability that a coin doesn’t land on heads during three flips? The probability that a coin doesn’t land on heads during three flips is P(X=0) = 1/8.

What is the probability that a coin lands on heads at least once during three flips? To find this probability, we can add up the probabilities that the coin lands on heads once, twice, or three times: P(X≥ 1) = 3/8 + 3/8 + 1/8 = 7/8.

What is the probability that a coin lands on heads less than twice during three flips? To find this probability, we can add up the probabilities that the coin lands on heads zero times or one time: P(X < 2) = 1/8 + 3/8 = 4/8 = 1/2.

## The Mean & Variance of a Discrete Random Variable

To find the mean (or the “expected value”) of a discrete random variable, denoted as E(X), simply multiply each possible value with its probability, then take the sum: Expected number of heads = (0*1/8) + (1*3/8) + (2*3/8) + (3*1/8) = 0 + 3/8 + 6/8 + 3/8 = 12/8 = 1.5

The expected number of heads from three coin flips is 1.5

To find the variance of a discrete random variable, denoted as Var(X), we subtract the expected value from each possible value, square this number, then multiply by its probability. Then we sum all these numbers.

Var(X) = (0-1.5)2 *1/8  +  (1-1.5)2 * 3/8  +  (2-1.5)2 * 3/8  +  (3-1.5)2 * 1/8  =  0.75

To find the standard deviation of X, we simply take the square root of the variance: √0.75 = 0.866