Random Variables#

Definition#

Definition 75 (Random Variables)

A random variable X is a function defined by the mapping

X:ΩRξX(ξ)

which maps an outcome ξΩ to a real number X(ξ)R.

We denote the range of X to be x and shorthand the notation of X(ξ)=x to be X=x.

Definition 76 (Pre-image of a Random Variable)

Given a random variable X:ΩR, define a singleton set {x}R, then by the pre-image definition of a function, we have

X1({x})={ξΩX(ξ){x}}

which is equivalent to

X1(x)=def{ξΩX(ξ)=x}

Examples#

Example 22 (Coin Toss)

Consider a fair coin and define an experiment of throwing the coin twice.

Define the random variable X to be the total number of heads in an experiment. (i.e if you throw 1 head and 1 tail the total number of heads in this experiment is 1).

What is the probability of getting 1 head in an experiment, i.e. P[X=1]?

Solution

We define the sample space Ω of this experiment to be {(HH),(HT),(TH),(TT)}.

We enumerate each outcome ξi in the sample space as

  • ξ1=HH

  • ξ2=HT

  • ξ3=TH

  • ξ4=TT

First, recall that X is a function that map an outcome ξ from the sample space Ω to a number x in the real space R. In this context it means that X maps one of the four outcomes ξi to the total number of heads in the experiment (i.e X()=number of heads).

It is important to note that the codomain of X is not any arbitrary number. We can only map our 4 outcomes ξi in the domain to 3 distinct numbers 0, 1 or 2, which we will see by manually enumerating each case below.

(174)#X(ξ1)=2,X(ξ2)=1,X(ξ3)=1,X(ξ4)=0

With that, this random variable X is completely determined.

Secondly, we need to examine carefully what is meant by P[X(ξ)=1] since this will answer the question on what is the probability of getting 1 head.

However, X(ξ)=1 is an expression and not an event that the probability measure P expects. Here we should recall that the probability law P() is always applied to an event EF where E is a set.

So we need to map this expression to an event EF. So you can ask yourself how to establish this “mapping” of X(ξ)=1 to an event in our event space F. This seems pretty easy since we already know that X(ξ)=1 has two cases matched in (174), namely X(ξ2)=1 and X(ξ3)=1. So we can simply define the event E to be {ξ2,ξ3}={(HT),(TH)}.

We verify that E={ξ2,ξ3} is indeed an event in F:

F={,{ξ1},{ξ2},{ξ3},{ξ4},{ξ1ξ2},{ξ1ξ3},{ξ1ξ4},{ξ2ξ3},{ξ2ξ4},{ξ3ξ4},Ω}

More concretely, given an expression X(ξ)=x, we construct the event set E by enumerating all the outcomes ξi in the sample space Ω that satisfy X(ξ)=x.

E={ξΩX(ξ)=x}

and this coincides with the pre-image of x in the random variable X as defined in Definition 76.

Consequently, we have

P[X(ξ)=1]=P[{(HT),(TH)}]=24=0.5

Example 23 (Dice Roll)

Consider a fair dice and define an experiment of rolling the dice once.

The sample space is then

Ω={1,2,3,4,5,6}

If we roll two fair dice, then the sample space is

Ω={(1,1),(1,2),,(6,6)}

So the probability of rolling say (1,2) is,

P[{(1,2)}]=136

Probability Measure P#

In the chapter on Probability Space, we have defined a probability measure P on a sample space Ω as

P:F[0,1]EP(E)

as per Probability Law (Definition 68).

The question initially is that P[X=x] does not seem to take in an event E in F but an expression X(ξ)=x instead. This needs to be emphasized that they are the same, as the expression X=x is just an event E in F (i.e. X=x evaluates to {ξΩX(ξ)=x}) where {ξΩX(ξ)=x}F.

Variable vs Random Variable#

Example 24 (Variable vs Random Variable)

Professor Stanley Chan gave a good example of the difference between a variable and a random variable.

The main difference is that a variable is deterministic while a random variable is non-deterministic.

Consider solving the following equation:

2X=x

Then, if x is a fixed constant, then X=x2 is a variable.

However, if x is not fixed, meaning that it can have multiple states, then X is a random variable since it is not deterministic.

Tie back to the example in Example 22, we note that X is a random variable since the total number of heads x in an experiment is not fixed. It can be 0, 1 or 2 depending on your toss.

Summary#

  1. A random variable X is a function that has the sample space Ω as its domain and the real space R as its codomain.

  2. X(Ω) is the set of all possible values that X can take and the mapping is not necessarily a bijective function since X(ξ) can take on the same value for different outcomes ξ.

  3. The elements in X(Ω) are denoted as x (i.e. xX(Ω)). They are often called the states of X.

  4. It is important to not confused X and x. X is a function while x are the states of X.

  5. When we write P[X=x], we are describing the probability of the random variable X taking on a particular state x. This is equivalent to P[{ξΩX(ξ)=x}].

  6. Random variables need not be bijective, see here.