Equality

On this page

We know what it means for two numbers to be equal. Equality of random variables, however, can be of more than one kind.

Equal

Two random variables $X$ and $Y$ defined on the same outcome space are equal if their values are the same for every outcome in the space. The notation is $X = Y$ and it means that

Informally, this says that no matter what the outcome, if $X$ is 10 then $Y$ must be 10 too; if $X$ is 11, $Y$ must be 11, and so on.

An example will make this clear. Let $N_H$ be the number of heads in three tosses of a coin, and let $N_T$ be the number of tails in the same three tosses. Then the two random variables $N_H$ and $3 - N_T$ are equal. For every possible outcome of the three tosses, the value of $N_H$ is equal to the value of $3 - N_T$.

We write this simply as $N_H = 3 - N_T$.

Equal in Distribution

$N_H$ and $N_T$, as defined above, are not equal. For example,

However, there is a sense in which the number of heads “behaves in the same way” as the number of tails. The two random variables have the same probability distribution.

There are only eight outcomes, so it is easy to inspect the table and write the distributions of $N_H$ and $N_T$. Both take the values 0, 1, 2, and 3, with probabilities 1/8, 3/8, 3/8, and 1/8 respectively. This distribution is shown in the table below.

In general, two random variables $X$ and $Y$ are equal in distribution if they have the same probability distribution. This is denoted

Relation between the Equalities

Equality is stronger than equality in distribution. If two random variables are the same, outcome by outcome, then they must have the same distribution because they are the same function on the outcome space.

That is, for any two random variables $X$ and $Y$,

But as the example of heads and tails in three tosses shows, the converse need not be true.

Example: Two Cards Dealt from a Small Deck

A deck contains 10 cards, labeled 1, 2, 2, 3, 3, 3, 4, 4, 4, 4. Two cards are dealt at random without replacement. Let $X_1$ be the label on the first card and $X_2$ be the label on the second card.

Question 1. Are $X_1$ and $X_2$ equal?

Answer 1. No, because the outcome could be 31 in which case $X_1 = 3$ and $X_2 = 1$.

Question 2. Are $X_1$ and $X_2$ equal in distribution?

Answer 2. Let’s find the two distributions and compare. Clearly the possible values are 1, 2, 3, and 4 in each case. The distribution of $X_1$ is easy:

When a distribution is defined by a formula like this, you can define a function that does what the formula says:

defprob1(i):returni/10

Then you can create a probability distribution object using value as before but now with probability_function that takes the name of the function as its argument: