4-Random Variables
4-Random Variables
1 / 76
Objectives
1 Understand random variables (RVs) which
are classified into two types: discrete and
continous RVs
2 Basic concept of distribution: cumulative
distribution; probability mass function for
discrete RVs; probability density function
for continuous RVs and their connections
2 / 76
Intro
• Sample space and events are basic
components of probability
• Similar to numbers in calculus
• Study the relations between numbers we
use functions
• In probability we use random variables
3 / 76
Table of contents
1 Definition of Random Variables
2 Events Defined by Random Variable
3 Cumulative Distribution Function
4 Discrete Random Variables
5 Continuous Random Variable
4 / 76
Definition
A random variable X defined on a sample space
Ω is a quantity that is calculated by the outcomes
- a function of outcomes
5 / 76
Example
6 / 76
w HHH HHT HTH HTT THH THT TTH TTT
X(w) 0 1 1 2 1 2 2 3
7 / 76
Example
• Tossing a fair coin until a Head appear.
The sample space is
Ω = {H, TH, TTH, TTTH, . . . }
• X: the number of tossing
• Range(X) = {1, 2, 3, . . . ...}
• X = 1 if and only if the first coin turns head
so P(X = 1) = P(first coin turns H) = 0.5
8 / 76
Table of contents
1 Definition of Random Variables
2 Events Defined by Random Variable
3 Cumulative Distribution Function
4 Discrete Random Variables
5 Continuous Random Variable
9 / 76
Event defined by Random variable
{X = a} = {w ∈ Ω : X(w) = a}
{X ≥ a} = {w ∈ Ω : X(w) ≥ a}
{X < a} = {w ∈ Ω : X(w) < a}
{a ≤ X ≤ b} = {w ∈ Ω : a ≤ X(w) ≤ b}
{a ≤ X < b} = {w ∈ Ω : a ≤ X(w) < b}
{a < X ≤ b} = {w ∈ Ω : a < X(w) ≤ b}
{a < X < b} = {w ∈ Ω : a < X(w) < b}
10 / 76
Probability associated with a
random variable X
F(b) = P(X ≤ b)
14 / 76
Use c.d.f to answer questions about a random variable
P(X ≤ b) = F(b)
P(X < b) = lim P(X ≤ b − h) = lim F(x) = F(b−)
h→0+ x→b−
P(X > a) = 1 − P(X ≤ a) = 1 − F(a)
P(a < X ≤ b) = P(X ≤ b) − P(X ≤ a) = F(b) − F(a)
P(a ≤ X ≤ b) = F(b) − F(a−)
P(a < X < b) = F(b−) − F(a)
15 / 76
Example
The c.d.f of a random variable X is defined by
0
if x < 0
F(x) = x + 0.5 if 0 ≤ x < 0.5
1 if x ≥ 0.5
Then
P(X > 0.25) = 1 − F(0.25) = 1 − (0.25 + 0.5) = 0
16 / 76
Example
X is a random variable with c.d.f
(
0 if x < 1
F(x) =
k 1 − e−(x−1)
if x ≥ 1
F(3) = 1 − e−2
P(X > 2) = 1 − F(2) = 1 − e−1
P(2 < X ≤ 3) = F(3) − F(2) = e−1 − e−218 / 76
Exercise
The c.d.f of the time T it takes a bank teller to
serve a customer is defined by
0
if x < 2
F(x) = A(x − 2) if 2 ≤ x < 6
1 if x ≥ 6
X(i, j) = max(i, j)
23 / 76
Table values of X
24 / 76
All possible values of X is
Range(X) = {1, 2, 3, 4, 5, 6}
25 / 76
X = 1 if and only if the outcome is (1, 1). So
26 / 76
Similar, we have P(X = 3) = 5/36, P(X = 4) =
7/36, P(X = 5) = 9/36, P(X = 6) = 11/36.
27 / 76
Similar, we have P(X = 3) = 5/36, P(X = 4) =
7/36, P(X = 5) = 9/36, P(X = 6) = 11/36.
27 / 76
Illustration to calculate p.m.f
2 P(−1 ≤ X ≤ 1)
30 / 76
Practice
31 / 76
Practice
32 / 76
Properties of p.m.f
• X is discrete
→ Range(X) = {x1, . . . , xn . . . }
• p(xi) = P(X = Xxi) ≥ 0
• P(X ∈ A) = p(xi)
xi ∈A
• Normalization
∞
X
P(−∞ < X < ∞) = 1 ⇒ p(xi) = 1
i=1 33 / 76
Properties of p.m.f
• X is discrete
→ Range(X) = {x1, . . . , xn . . . }
• p(xi) = P(X = Xxi) ≥ 0
• P(X ∈ A) = p(xi)
xi ∈A
• Normalization
∞
X
P(−∞ < X < ∞) = 1 ⇒ p(xi) = 1
i=1 33 / 76
Properties of p.m.f
• X is discrete
→ Range(X) = {x1, . . . , xn . . . }
• p(xi) = P(X = Xxi) ≥ 0
• P(X ∈ A) = p(xi)
xi ∈A
• Normalization
∞
X
P(−∞ < X < ∞) = 1 ⇒ p(xi) = 1
i=1 33 / 76
Example
Suppose X has 3 values 1, 2, 3 and
1 1
p(1) = , p(2) =
2 3
then what is p(3)?
35 / 76
Practice
Suppose that the p.m.f of random variable X is
given by
Find
1 the value of the constant c
2 P(0 < X < 2.5).
36 / 76
From pdf to cdf
37 / 76
Example
Suppose that p.m.f of X is given by p(1) = 21 , p(2) =
1 1
3 , p(3) = 6 then
39 / 76
Graph of F(x)
Remark
Jump size at 1 is P(X = 1), ... 40 / 76
From c.d.f to p.m.f
41 / 76
Example
Determine the p.m.f of X from the c.d.f
0 if x < −2
0.2 if − 2 ≤ x < 0
F(x) =
0.7 if 0 ≤ x < 2
if x ≥ 2
1
42 / 76
Solution
Graph of F(x) is
44 / 76
Properties of cdf of a discrete RV
45 / 76
Practice
c.d.f of discrete random variable X is given by
0
if x < 1
F(x) = 0.7 if 1 ≤ x < 3
1 if x ≥ 3
Compute
1 P(X ≤ 2) and P(X > 2)
2 P(1 ≤ X ≤ 2)
46 / 76
Table of contents
1 Definition of Random Variables
2 Events Defined by Random Variable
3 Cumulative Distribution Function
4 Discrete Random Variables
5 Continuous Random Variable
47 / 76
RVs with Uncountable Values
• If Range(X) is countable, we can list all
possible value of random variable X
between a and b to evaluate
X
P(a ≤ X ≤ b) = P(X = xi)
a≤xi ≤b
• If X is a continuous random variable, i.e.
Range(X) is uncountable, it leads to
”uncountable sum” 48 / 76
Probability density functions of
continuous R.V
Suppose Range(X) is uncountable.
X is continuous if there is a non negative function f (x) so
that
Z b
P(a ≤ X ≤ b) = f (x) dx
a
|{z}
probability density function (p.d.f) of X
49 / 76
Interpretation of p.d.f
Z a+ϵ
P (a ≤ X ≤ a + ϵ) = f (x)dx ≈ ϵf (a)
a
Range(X) = [−1, 2]
which is uncountable
54 / 76
Use pdf to answer questions of continuous random variable
For example
1 1
x2
Z Z
P(0 ≤ X ≤ 1) = f (x)dx = dx =
0 0 3
55 / 76
Z 1
P(X ≤ 1) = P(−∞ < X ≤ 1) = f (x)dx
−∞
Z −1 Z 1
= f (x)dx + f (x)dx
Z−∞
−1 Z −1
1 2 Z 1 2
x x
= 0dx + dx = dx
−∞ −1 3 −1 3
56 / 76
Remark that Range(X) = [−1, 2] then X ≤ 1 is
equivalent to −1 ≤ X ≤ 1. So we have
Z 1 2
x
P(X ≤ 1) = P(−1 ≤ X ≤ 1) = dx
−1 3
57 / 76
Properties of continuous RV
• P(X = a) = 0 for all a
• For all a, b
58 / 76
Probability as an Area
59 / 76
Exercise
Suppose that X has p.d.f
(
3
256 (8x − x2) if 0 < x < 8
f (x) =
0 elsewhere
Determine
(a) P(X = 3) (b) P(2 < X < 4)
(c) P(X > 6) (d) P(X < 5)
60 / 76
Conditions of pdf
• f (x) ≥ 0 for all x
• (Normalization) P(−∞ < X < ∞) = 1 implies
that
Z∞
f (x)dx = 1
−∞
61 / 76
Example
A gambler spins a wheel of fortune, continuously cali-
brated between 0 and 1, and observes the resulting num-
ber. Assuming that all subintervals of [0, 1] of the same
length are equally likely. The observed number is a ran-
dom variable X with pdf
(
c, 0 ≤ x ≤ 1
f (x) =
0, otherwise
62 / 76
The constant c is determined by
Z ∞
f (x)dx = 1
−∞
So Z 1
cdx = 1
0
then c = 1
63 / 76
Practice
Suppose the p.d.f of X is
n C(4x − 2x2) 0 < x < 2
f (x) =
0 otherwise
What is the value of the constant C?
Find P(X > 1)?
64 / 76
From p.d.f to c.d.f
65 / 76
Properties of cdf of a continuous RV
66 / 76
Example
Suppose that the error in the reaction temperature, in ◦C,
for a controlled laboratory experiment is a continuous ran-
dom variable X having the probability density function
(2
x
−1 < x < 2
f (x) = 3 .
0 elsewhere
Find c.d.f F of X
67 / 76
Solution
• For x < −1
Z x Z x
F(x) = f (u)du = 0du = 0
−∞ −∞
• For −1 ≤ x ≤ 2
Z x x
u2 x3 + 1
Z
F(x) = f (u)du = du =
−∞ −1 3 9
68 / 76
• For x > 2
x 2
u2
Z Z
F(x) = f (u)du = du = 1
−∞ −1 3
69 / 76
Exercise
The lifetime (in hours) of an electric component
is a continous random variable X with p.d. f
(
0.1e−0.1x if x ≥ 0
f (x) =
0 otherwise
71 / 76
Example
72 / 76
Solution
(
′ 2e−2x if x > 0
f (x) = F (x) =
0 elsewhere
73 / 76
content...
74 / 76
content...
75 / 76
content...
76 / 76