# Discrete Random Variables & Probability Distribution Functions (PDF)

In this section we learn about discrete random variables and probability distribution functions, which allow us to calculate the probabilities associated to a discrete random variable.

We start by defining discrete random variables and then define their probability distribution functions (pdf) and learn how they are used to calculate probabilities.

## Tutorial

In the following tutorial, we learn more about what discrete random variables and probability distribution functions are and how to use them. Watch it before carrying-on.

## Definition: Discrete Random Variable

### Discrete Variables

A discrete variable is a variable that can "only" take-on certain numbers on the number line.
We usually refer to discrete variables with capital letters: $X, \ Y, \ Z, \ \dots$ A typical example would be a variable that can only be an integer, or a variable that can only by a positive whole number.

Discrete variables can either take-on an infinite number of values or they can be limited to a finite number of values.

For instance the number we obtain , when rolling a dice is a discrete variable, which is limited to a finite number of values:$$1, \ 2, \ 3, \ 4, \ 5,$$ or $$6$$.

An example of a discrete variable that can take-on an "infinite" number of values could be: the number of rain drops that fall over a square kilometer in Sweden on November 25th.
Note: although this quantity can technically not be infinite, it is common practice and acceptable to assume so.

### Discrete Random Variables

A discrete variable is a discrete random variable if the sum of the probabilities of each of its possible values is equal to $$1$$.

#### Example

When we roll a single dice, the possible outcomes are: $1, \ 2, \ 3, \ 4, \ 5, \ 6$ The probability of each of these outcomes is $$\frac{1}{6}$$.
If we define the discrete variable $$X$$ as:

$$X:$$ the number obtained when rolling a dice.
Then this is a discrete random variable since the sum of the probabilities of each of these possible outcomes is equal to $$1$$, indeed: $\frac{1}{6}+\frac{1}{6}+\frac{1}{6}+\frac{1}{6}+\frac{1}{6}+\frac{1}{6} = 1$

## Probability Distribution Function (PDF)

Given a discrete random variable, $$X$$, its probability distribution function, $$f(x)$$, is a function that allows us to calculate the probability that $$X=x$$.
In other words, $$f(x)$$ is a probability calculator with which we can calculate the probability of each possible outcome (value) of $$X$$. $P\begin{pmatrix}X = x \end{pmatrix} = f(x)$

### Example

A bag contains several balls numbered either: $$2$$, $$4$$ or $$6$$ with only one number on each ball. A simple experiment consists of picking a ball, at random, out of the bag and looking at the number written on the ball.

Defining the discrete random variable $$X$$ as:

$$X$$: the number obtained when we pick a ball at random from the bag
and given that its probability distribution function is: $P\begin{pmatrix} X = x \end{pmatrix} = \frac{8x-x^2}{40}$ Answer each of the following:
1. State the possible values that $$X$$ can take.
2. Calculate the probability of picking a ball with $$2$$ on it.
3. Calculate the probability of picking a ball with $$4$$ on it.

#### Solution

1. Given the balls are numbered either $$2$$, $$4$$ or $$6$$, the discrete random variable, $$X$$, can take-on either of those values.
We write all the values $$X$$ can take inside a set $$x$$: $x=\left \{2, \ 4, \ 6 \right \}$ We're given the probability distribution function for $$X$$: $P\begin{pmatrix} X = x \end{pmatrix} = \frac{8x-x^2}{40}$
2. The probability of picking a ball with $$2$$ on it equals to the probability of $$X$$ being equal to $$2$$, that's $$P\begin{pmatrix} X = 2 \end{pmatrix}$$.
To calculate $$P\begin{pmatrix} X = 2 \end{pmatrix}$$ we "simply" replace $$x$$ by $$2$$ in the function that was given to us in the question and calculate: \begin{aligned} P\begin{pmatrix} X = 2 \end{pmatrix} & = \frac{8\times 2-2^2}{40} \\ & = \frac{16-4}{40} \\ P\begin{pmatrix} X = 2 \end{pmatrix} & = \frac{12}{40} \end{aligned}
3. The probability of picking a $$4$$ is calculated in the same way, except we now replace $$x$$ by $$4$$: \begin{aligned} P\begin{pmatrix} X = 4 \end{pmatrix} & = \frac{8\times 4-4^2}{40} \\ & = \frac{32-16}{40} \\ P\begin{pmatrix} X = 4 \end{pmatrix} & = \frac{16}{40} \end{aligned} So the probability of picking a ball numbered $$4$$ is $$\frac{16}{40}$$.

## Distribution Tables & Graphs

To illustrate the probabilities of each of the possible values a discrete random variable $$X$$ can take, it will often be useful to showcase all the possible values of $$X$$ alongside the corresponding probability.
This is usually done in either:

• a probability distribution table, or
• a bar chart.
Each of these is illustrated in the following tutorial and in the detailed example below.

### Example: Distribution Table & Graph

We'll stick to the example we saw further up:

A game of chance consists of picking, at random, a ball from a bag. Each ball is numbered either $$2$$, $$4$$ or $$6$$. The discrete random variable is defined as:

$$X$$: the number obtained when we pick a ball from the bag.

The probability distribution function associated to the discrete random variable is: $P\begin{pmatrix} X = x \end{pmatrix} = \frac{8x-x^2}{40}$
1. Construct a probability distribution table to illustrate this distribution.
2. Draw a bar chart to illustrate this probability distribution.
3. Use the distribution table and bar chart to determine which value the discrete random variable $$X$$ is most likely to take.

#### Probability Distribution Tables

To draw this discrete random variable's probability distribution table

• top row: enter all the values $$x$$ that the discrete random variable $$X$$ can take.
• bottom row: enter all of the corresponding probabilities, $$P\begin{pmatrix} X = x \end{pmatrix}$$.

Note: each of the probabilities in the second row is calculated by replacing the $$x$$ in the function $$P\begin{pmatrix} X = x \end{pmatrix} = \frac{8x-x^2}{40}$$ by the value of $$x$$ directly above it in the table.
Doing so for our discrete random variable $$X$$ leads to the following distribution table:

#### Probability Distribution Bar Graph

Using the probability distribution table we have above, we can illustrate this probability distribution in a bar chart.
For each of the possible values $$x$$ of the discrete random variable $$X$$, we draw a bar whose height is equal to the probability $$P\begin{pmatrix} X = x \end{pmatrix}$$.
For the probability distribution we have above this would look like:

Looking at this graph allows us to determine, at a quick glance, which value $$X$$ is most likely to take on.
Here we can say that there is a greater chance that $$X = 4$$. In other words a ball picked at random from the bag is more likely to be numbered $$4$$ than any other value.

## Tutorial

In the following tutorial we learn how to construct probability distributions tables and their corresponding bar charts. Make sure to watch before working through the exercises below.

## Exercise

A discrete random variable $$X$$ can take either of the values: $x = \left \{ 2, \ 4, \ 6 \right \}$ and has a probability distribution function (pdf) defined as: $P\begin{pmatrix} X = x \end{pmatrix} = \frac{8x-x^2}{40}$

1. Construct a probability distribution table for $$X$$.
2. Illustrate this probability distribution with a bar chart.
3. Using your previous answers, state which value the discrete random variable $$X$$ most likely to take?
1. A discrete random variable $$X$$ has a probability distribution function defined as: $P\begin{pmatrix} X = x \end{pmatrix} = kx^2$ where: $$x = \left \{ 0, \ 1, \ 2, \ 3\right \}$$.

1. Find the value of $$k$$.
2. Calculate the probability that $$X = 2$$.

2. A discrete random variable $$X$$ has a probability distribution function defined as: $P \begin{pmatrix} X = x \end{pmatrix} = \frac{x}{k}$ where: $$x = \left \{ 1, \ 2, \ 3, \ 4, \ 5 \right \}$$.
1. Find the value of $$k$$.
2. Illustrate this discrete probability distribution in a table.

3. A discrete random variable has a probability distribution function $$f(x)$$, its distribution is shown in the following table:
1. Find the value of $$k$$ and draw the corresponding distribution table.
2. Represent this distribution in a bar chart.
3. Which value is the discrete random variable most likely to take?

1. $$k = \frac{1}{14}$$
2. $$P \begin{pmatrix} X = 2 \end{pmatrix} = \frac{2}{7}$$ that's $$0.286$$ (rounded to 3 significant figures).

1. $$k = 15$$

1. $$k=-0.1$$

The probability distribution therefore becomes:
2. The graphical representation, of this distribution, is shown in the following bar chart:

3. The discrete random variable is most likely to take the value $$2$$.