Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

We know what it means for two numbers to be equal: they are at the same spot on the number line. Equality of random variables, however, can be of more than one kind.

3.3.1Equal

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

X(ω)=Y(ω) for all ωΩX(\omega) = Y(\omega) \text{ for all } \omega \in \Omega

This is the usual definition of the equality of two mathematical functions. Informally, it says that when XX has the value 10 then YY must be 10 too; when XX is 11, YY must be 11; and so on.

An example will make this clear. Let NHN_H be the number of heads in three tosses of a coin, and let NTN_T be the number of tails in the same three tosses.

Now consider the new random variable M=3NTM = 3 - N_T. The two random variables NHN_H and MM are equal. For every possible outcome of the three tosses, the value of NHN_H is equal to the value of MM.

We write this simply as NH=MN_H = M. Equivalently, NH=3NTN_H = 3 - N_T.

🎥 See More
Loading...

3.3.2Equal in Distribution

NHN_H and NTN_T, as defined above, are not equal. For example,

NH(TTT)=0   but   NT(TTT)=3N_H(\text{TTT}) = 0 ~~~ \text{but} ~~~ N_T(\text{TTT}) = 3

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.

The outcome space is three_tosses:

coin = make_array('H', 'T')
three_tosses = list(product(coin, repeat=3))
three_tosses
[('H', 'H', 'H'), ('H', 'H', 'T'), ('H', 'T', 'H'), ('H', 'T', 'T'), ('T', 'H', 'H'), ('T', 'H', 'T'), ('T', 'T', 'H'), ('T', 'T', 'T')]

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

dist = Table().values(np.arange(4)).probabilities(make_array(1, 3, 3, 1)/8)
dist
Loading...

We say that NHN_H and NTN_T are equal in distribution.

In general, two random variables XX and YY are equal in distribution if they have the same probability distribution.

That is, they have the same set of possible values and the same probabilities for all those values.

Equality in distribution is denoted as

X=dYX \stackrel{d}{=} Y

3.3.3Relation 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 XX and YY,

X=Y    X=dYX = Y \implies X \stackrel{d}{=} Y

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

3.3.4Example: 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 X1X_1 be the label on the first card and X2X_2 be the label on the second card.

Question 1: Are X1X_1 and X2X_2 equal?

Answer 1: No, because for example the outcome could be (3,1)(3,1) in which case X1=3X_1 = 3 and X2=1X_2 = 1.

Question 2: Are X1X_1 and X2X_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 X1X_1 is easy:

P(X1=i)=i10,  i=1,2,3,4P(X_1 = i ) = \frac{i}{10} , ~~ i = 1, 2, 3, 4

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

def prob1(i):
    return i/10

You can create a probability distribution object for X1X_1 using values as before but now with the probability_function method.

The argument to probability_function is the name of the function that takes ii as its argument and returns P(X1=i)P(X_1 = i).

possible_i = np.arange(1, 5, 1)
dist_X1 = Table().values(possible_i).probability_function(prob1)
dist_X1
Loading...

Convince yourself that the function prob2 below returns P(X2=i)P(X_2 = i) for each ii. The event has been partitioned according to the value of X1X_1.

def prob2(i):
    if i == 1:
        return (9/10)*(1/9)
    else:
        return (i/10)*((i-1)/9) + ((10-i)/10)*(i/9)
dist_X2 = Table().values(possible_i).probability_function(prob2)
dist_X2
Loading...

The two distributions are the same! Here is yet another example of symmetry in sampling without replacement. The conclusion is

X1=dX2X_1 \stackrel{d}{=} X_2