# Discrete Random Variables

This section covers Discrete Random Variables, probability distribution, Cumulative Distribution Function and Probability Density Function.

A **probability distribution** is a table of values showing the probabilities of various outcomes of an experiment.

For example, if a coin is tossed three times, the number of heads obtained can be 0, 1, 2 or 3. The probabilities of each of these possibilities can be tabulated as shown:

Number of Heads |
0 |
1 |
2 |
3 |

Probability |
1/8 |
3/8 |
3/8 |
1/8 |

A **discrete variable **is a variable which can only take a countable number of values. In this example, the number of heads can only take 4 values (0, 1, 2, 3) and so the variable is discrete. The variable is said to be **random **if the sum of the probabilities is one.

**Probability Density Function**

The probability density function (p.d.f.) of X (or probability mass function) is a function which allocates probabilities. Put simply, it is a function which tells you the probability of certain events occurring. The usual notation that is used is P(X = x) = something. The random variable (r.v.) X is the event that we are considering. So in the above example, X represents the number of heads that we throw. So P(X = 0) means "the probability that no heads are thrown". Here, P(X = 0) = 1/8 (the probability that we throw no heads is 1/8 ).

In the above example, we could therefore have written:

x |
0 |
1 |
2 |
3 |

P(X = x) |
1/8 |
3/8 |
3/8 |
1/8 |

Quite often, the probability density function will be given to you in terms of x. In the above example, P(X = x) = ^{3}C_{x} / (2)^{3} (see permutations and combinations for the meaning of ^{3}C_{x}).

**Example**

A die is thrown repeatedly until a 6 is obtained. Find the probability density function for the number times we throw the die.

Let X be the random variable representing the number of times we throw the die.

P(X = 1) = 1/6 (if we only throw the die once, we get a 6 on our first throw. The probability of this is 1/6 ).

P(X = 2) = (5/6) × (1/6) (if we throw the die twice before getting a 6, we must throw something that isn't a 6 with our first throw, the probability of which is 5/6 and we must throw a 6 on our second throw, the probability of which is 1/6)

etc

In general, P(X = x) = (5/6)^{(x-1)} × (1/6)

**Cumulative Distribution Function**

The cumulative distribution function (c.d.f.) of a discrete random variable X is the function F(t) which tells you the probability that X is less than or equal to t. So if X has p.d.f. P(X = x), we have:

F(t) = P(X £ t) = SP(X = x).

In other words, for each value that X can be which is less than or equal to t, work out the probability that X is that value and add up all such results.

**Example**

In the above example where the die is thrown repeatedly, lets work out P(X £ t) for some values of t.

P(X £ 1) is the probability that the number of throws until we get a 6 is less than or equal to 1. So it is either 0 or 1.

P(X = 0) = 0 and P(X = 1) = 1/6. Hence P(X £ 1) = 1/6

Similarly, P(X £ 2) = P(X = 0) + P(X = 1) + P(X = 2) = 0 + 1/6 + 5/36 = 11/36