5. Introduction to Random Variables
5. Introduction to Random Variables
Lecture 5:
Introduction to Random
Variables
CPE251 Probability Methods in Engineering
Dr. Zaid Ahmad, MIEEE
Advisor, IEEE CUI Lahore
COMSATS University Islamabad, Lahore Campus
Random Variable
A random variable is a function that assigns a real number 𝑋(𝜁) to each outcome 𝜁 of
the sample space of a random experiment.
For example, when a coin is tossed thrice, two random variables can be associated
with this experiment: 𝑋 = number of heads and 𝑌 = number of tails.
The capital letters 𝑋 and 𝑌 are the labels of the random variables, while small letters
𝑥 and 𝑦 denote the values of the random variables
𝑆 = {𝑇𝑇𝑇, 𝑇𝑇𝐻, 𝑇𝐻𝑇, 𝑇𝐻𝐻, 𝐻𝑇𝑇, 𝐻𝑇𝐻, 𝐻𝐻𝑇, 𝐻𝐻𝐻}
𝑆 = {0,1,2,3}
𝑆 = {0,1,2,3}
1
3/12/2024
Examples
Sample Problem
A fair coin is flipped three times and the number of heads 𝑋 is observed. If the
probability of occurring a head is 𝑝. Compute 𝑃 𝑋 = 0 and 𝑃[𝑋 = 2].
2
3/12/2024
𝒙 𝟎 𝟏 𝟐 𝟑
1 3 3 1
𝑃[𝑋 = 𝑥]
8 8 8 8
1. 𝑝 𝑥 ≥ 0
2. ∑𝑝 𝑥 = 1
3. 𝑃 𝑋 = 𝑥 = 𝑝 (𝑥)
3
3/12/2024
Example
A shipment of 20 similar laptops to a retail outlet contains 3 that are defective. If a
school makes a random purchase of 2 of these laptops, find the probability
distribution for the number of defectives.
Let 𝑛 is the total number of defective laptops selected and 𝑛 is the total number of
not defective laptops.
Then, probability that 𝑥 number of defective laptops are picked by the school is:
𝑛 𝑛
𝑝 𝑥 =𝑃 𝑋=𝑥 = 𝑥 2−𝑥
20
2
4
3/12/2024
𝐹 𝑥 = 𝑝 (𝑡)
They represent measured data unlike count data (discrete random variable)
10
5
3/12/2024
𝑓(𝑥) may or may not be continuous for all values. However, frequently used 𝑓(𝑥) are
continuous.
11
1. 𝑓 𝑥 ≥ 0, ∀𝑥 ∈ 𝑅
2. ∫ 𝑓 𝑥 𝑑𝑥 = 1
3. 𝑃 𝑎 < 𝑋 < 𝑏 = ∫ 𝑓 (𝑥) 𝑑𝑥
12
6
3/12/2024
𝐹 𝑥 =𝑃 𝑋≤𝑥 = 𝑓 𝑡 𝑑𝑡 , −∞ ≤ 𝑥 ≤ ∞
13
Example
14
7
3/12/2024
15
16
8
3/12/2024
EXERCISE 1 EXERCISE 2
17
References
1. Walpole, R.E., Myers, R.H., Myers, S.L. and Ye, K. (2007) Probability &
Statistics for Engineers & Scientists. 9th Edition, Pearson Education, Inc.
2. Leon-Garcia, A. (2008). Probability, Statistics, and Random Processes for
Electrical Engineering. 3rd Edition, Pearson/Prentice Hall.
18