3.
0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
EEE251 Probability Methods in Engineering
Lecture 6
Instructor: Bakhtiar Ali
Department of Electrical Engineering.
COMSATS Institute of Information Technology, Islamabad
Bakhtiar Ali 1/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
3.0 Discrete Random Variables
In most random experiments we are interested in a numerical
attribute of the outcome of the experiment.
A random variable is defined as a function that assigns a
numerical value to the outcome of the experiment.
In this chapter we introduce the concept of a random variable
and methods for calculating probabilities of events involving a
random variable.
We focus on the simplest case, that of discrete random
variables, and introduce the probability mass function.
We define the expected value of a random variable and relate
it to our intuitive notion of an average.
We also introduce the conditional probability mass function
for the case where we are given partial information about the
random variable.
Bakhtiar Ali 2/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
3.1 The Notion Of A Random Variable
The outcome of a random experiment need not be a number.
However, we are usually interested not in the outcome itself,
but rather in some measurement or numerical attribute of the
outcome.
A random variable X is a function that assigns a real number,
X(ζ) to each outcome ζ in the sample space of a random
experiment.
Bakhtiar Ali 3/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
3.1 The Notion Of A Random Variable
Example 1 (Coin Tosses).
A coin is tossed three times and the sequence of heads and tails is
noted.
The sample space for this experiment is
S = [HHH, HHT, HT H, T HH, T HT, T T H, HT T, T T T ].
X assigns each outcome ζ in S a number from the set
SX = {0, 1, 2, 3}.
The table below lists the eight outcomes of S and the
corresponding values of X.
ζ HHH HHT HT H T HH T HT T T H HT T T T T
X(ζ) 3 2 2 2 1 1 1 0
Bakhtiar Ali 4/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
3.1 The Notion Of A Random Variable
Example 2 (A Betting Game).
A player pays $1.50 to play the following game: A coin is tossed
three times and the number of heads X is counted. The player
receives $1 if X = 2 and $8 if X = 3 but nothing otherwise.
Let Y be the reward to the player.
Y is a function of the random variable X and its outcomes can be
related back to the sample space of the underlying random
experiment as follows:
ζ HHH HHT HT H T HH T HT T T H HT T T T T
X(ζ) 3 2 2 2 1 1 1 0
Y (ζ) 8 1 1 1 0 0 0 0
Y is a random variable taking on values in the set SY = {0, 1, 8}.
Bakhtiar Ali 5/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
Example 3 (Coin Tosses and Betting).
Let X be the number of heads in three independent tosses of a fair
coin.
Find the probability of the event {X = 2}.
Find the probability that the player in Example 2 wins $8.
Note that X(ζ) = 2 if and only if ζ is in {HHT, HT H, T HH}.
Therefore
P [X = 2] = P [{HHT, HT H, T HH}]
= P [{HHT } + P [{HT H}] + P [{T HH}] = 3/8
The event {Y = 8} occurs if and only if the outcome ζ is HHH,
therefore
P [Y = 8] = P [{HHH}] = 1/8
Bakhtiar Ali 6/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
3.2 Discrete Random Variables And Probability Mass
Function
A discrete random variable X is defined as a random variable
that assumes values from a countable set, that is,
SX = {x1 , x2 , x3 , . . . }.
A discrete random variable is said to be finite if its range is
finite, that is, SX = {x1 , x2 , . . . , xn }.
Since the sample space SX is discrete, we only need to obtain
the probabilities for the events Ak = {ζ : X(ζ) = xk } in the
underlying random experiment.
The probability mass function (pmf) of a discrete random
variable X is defined as:
pX (x) = P [X = x] = P [{ζ : X(ζ) = x}] for x a real number.
Bakhtiar Ali 7/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
3.2 Discrete Random Variables And Probability Mass
Function Contd.
The pmf pX (x) satisfies three properties that provide all the
information required to calculate probabilities for events
involving the discrete random variable X:
i. pX (x) ≥ 0 for all x
X X X
ii. pX (x) = pX (xk ) = P [Ak ] = 1
x∈SX all k all k
X
iii. P [X in B] = pX (x) = where B ⊂ SX
x∈B
The pmf of X gives us the probabilities for all the elementary
events from SX .
The probability of any subset of SX is obtained from the sum
of the corresponding elementary events.
Bakhtiar Ali 8/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
3.2 Discrete Random Variables And Probability Mass
Function
Example 4.
Let X be the number of heads in three independent tosses of a
coin. Find the pmf of X.
pX (0) = P [X = 0] = P [{T T T }] = (1 − p)3 .
pX (1) = P [X = 1] = P [{HT T, T HT, T T H}] = 3(1 − p)2 p.
pX (2) = P [X = 2] = P [{HHT, HT H, T HH}] = 3(1 − p)p2 .
pX (3) = P [X = 3] = P [{HHH}] = p3 .
Note that pX (0) + pX (1) + pX (2) + pX (3) = 1.
Bakhtiar Ali 9/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
3.2 Discrete Random Variables And Probability Mass
Function
Example 5.
A player receives $1 if the number of heads in three coin tosses is
2, $8 if the number is 3, but nothing otherwise. Find the pmf of
the reward Y .
pY (0) = P [Y = 0] = P [{T T T, HT T, T HT, T T H}] = 4/8 = 1/2.
pY (1) = P [Y = 1] = P [{HHT, HT H, T HH}] = 3/8.
pY (8) = P [Y = 8] = P [{HHH}] = 1/8.
Note that pY (0) + pY (1) + pY (8) = 1.
Bakhtiar Ali 10/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
Example 6.
Let X be the number of times a message needs to be transmitted
until it arrives correctly at its destination.
Find the pmf of X.
Find the probability that X is an even number.
X is a discrete random variable taking on values from
SX = {1, 2, 3, . . . }. The event {X = k} occurs if the underlying
experiment finds k − 1 consecutive erroneous transmissions
(failures) followed by a error-free one (success)
pX (k) = P [X = k] = P [00 · · · 01] = (1 − p)k−1 p = q k−1 p
k = 1, 2, . . . .
We call X the geometric random variable, and we say that X is
geometrically distributed
∞ ∞
X X 1 1
P [X is even] = pX (2k) = p q 2k−1 = p = .
1 − q2 1+q
k=1 k=1
Bakhtiar Ali 11/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
QUIZ # 1 EPE-4
A fraction p of items from a certain production line is defective.
1 What is the probability that there is more than one defective
item in a batch of 20 items?
2 During normal production p = 0.00099 but when production
malfunctions p = 0.1. Find the size of a batch that should be
tested so that if any items are found defective we are 99%
sure that there is a production malfunction.
Bakhtiar Ali 12/13
3.0 Discrete Random Variables
3.1 The Notion Of A Random Variable
3.2 Discrete Random Variables And Probability Mass Function
QUIZ # 1 BCE-4
A Binary communication channel transmit X = +1 and X = −1
with equal probability. The malicious channel counts the number
of heads in two tosses of an unfair coin with P [H] = 1/3 to decide
how much noise N to be added to the input to produce the output
Y = X + N.
1 Use a tree diagram to find the set of possible input-output
pairs.
2 Find the probabilities of the input-output pairs.
3 Find the probabilities of the output values.
4 Find the probability that the input was X = +1 given that
Y = +1.
Bakhtiar Ali 13/13