# Random Variables and Discrete Probability Distributions

## Random Variable

A random variable is a variable whose value is determined by chance.

### Examples

• The outcome of rolling a die
• The number of heads seen when flipping a coin 3 times
• The number of spades seen in 5 cards drawn from a standard deck of playing cards
• The profit (or loss) as a result of playing the lottery
• The income associated with issuing an insurance policy
• The number of microwaves sold each day at a local appliance store

## Discrete Probability Distributions

A discrete probability distribution for a random variable consists of the values a random variable can assume and the corresponding probabilities that those values occur.

The related function that outputs the probabilities for the respective values the random variable can assume is called the probability density function, or pdf. (This is also called the probability function, the frequency function, or the probability mass function, depending on what statistics book you read.)

For example, suppose we toss a coin three times.

The sample space consists of 8 equally likely possibilities:

 HHH HHT HTH HTT THH THT TTH TTT

Suppose the random variable X counts the number of heads seen in three tosses.

We can't see a negative number of heads in three tosses, nor can we see more than 3, so the values that X can assume are: 0, 1, 2, or 3

(By the way, the probability distribution for this random variable is called discrete because there are a countable number of values that our random variable can assume. In this case there are 4 of them.)

Looking at the sample space, it is easy to see that:

• the probability of seeing no heads is 1/8
• the probability of seeing exactly one head is 3/8
• the probability of seeing exactly two heads is 3/8, and
• the probability of seeing exactly three heads is 1/8

Adopting the notation, P(x), for the probability density function (i.e., P(x) gives the probability of seeing exactly x heads in this example), we can summarize these results with the following table:

$x$ 0 1 2 3
$P(x)$ $1/8$ $3/8$ $3/8$ $1/8$

The above table constitutes the probability distribution for X.

It should be remembered that all of the probabilities should be legitimate (between zero and one) and the sum of the probabilities should equal one (as 100% of the time, there is an outcome).

Equivalently,

$$0 \le P(X) \le 1 \quad \textrm{ and } \quad \sum P(X) = 1$$

As seen above, a discrete probability distribution might take the form of a table.

However, one can can also specify the outcomes and probabilities with a formula -- as in the case of the binomial distribution, which gives the probability of observing X successes in n Bernoulli trials:

$$P(X) = {}_nC_x p^x q^{n-x} \quad \textrm{where } X = 0,1,2,\ldots, n$$

The fact that all of the probabilities so produced are between zero and one, with a sum of exactly one is less obvious here -- but still present. Indeed, if we consider the case when $n=8$ and $p=1/2$, we produce precisely the same probabilities as seen in the above table!