0% found this document useful (0 votes)
21 views80 pages

4-Random Variables

Uploaded by

dinhlinhna0510
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views80 pages

4-Random Variables

Uploaded by

dinhlinhna0510
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

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

• Toss a coin three times


• X be the number of times that tails appear
• Sample space Ω =
{HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}
• X(HHH) = 0, X(HHT) = 1 . . .

6 / 76
w HHH HHT HTH HTT THH THT TTH TTT
X(w) 0 1 1 2 1 2 2 3

All possible values of X are 0, 1, 2, 3. We say Range(X) =


{0, 1, 2, 3}
1
P(X = 0) = P(there is no tail) = P(HHH) =
8
3
P(X = 1) = P(there is 1 tail) = P({HHT, HTH, THH}) =
8

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

P(X = a), P(X ≥ a), P(X > a),


P(X ≤ b), P(X < b),
P(a ≤ X ≤ b), P(a < X ≤ b),
P(a ≤ X < b), P(a < X < b)
11 / 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
12 / 76
Cumulative distribution function
(c.d.f)
cdf F(.) of the random variable X is a function
defined by

F(b) = P(X ≤ b)

is the probability that X takes on values less than


or equal to b
13 / 76
Properties of c.d.f

1 F(x) is a nondecreasing function in x


2 0 ≤ F(x) ≤ 1
3 lim F(x) = 0, lim F(x) = 1
x→−∞ x→∞

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

1 Find the value of k


2 Compute F(3), P(X > 2) and
P(2 < X ≤ 3)
17 / 76
Solution
1 Using the property lim F(x) = 1, we have
x→∞

lim k 1 − e−(x−1) = 1 ⇒ k = 1
x→∞
2

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

1 Find the value of the constant A


2 P(X > 4) =? P(3 ≤ X ≤ 5) =? 19 / 76
Types of RV
Based on range of the random variable X
• If the set of possible values of X is finite or
countable like {0, 1, 2, 3}, {1, 2, . . . } then
X is called discrete RV
• If the set of possible values of X is
uncountable (like the interval [a, b],
[a, ∞)) then X is called continuous RV
20 / 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
21 / 76
Probability mass function
• A discrete random variable is a random
variable that can take on at most a
countable number of possible values.
• The probability mass function (p.m.f) of
the discrete random variable X is defined as

p(xi) = P(X = xi) for all xi ∈ Range(X)


22 / 76
Example
Roll two fair dice then the sample space is

Ω = {(1, 1, ), . . . , (6, 6)} = {(i, j) : 1 ≤ i, j ≤ 6}

Let X be the largest of numbers on two dice, i.e


if the rolling result is (i, j) then

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}

so X is a discrete random variable.


In order to determine the pmf of X, we need to
find all the probabilities

P(X = 1), P(X = 2), . . . , P(X = 6)

25 / 76
X = 1 if and only if the outcome is (1, 1). So

P(X = 1) = P((1, 1)) = 1/36

X = 2 if and only if the outcomes is one of


(1, 2), (2, 2), (2, 2). So

P(X = 2) = P({(1, 2), (2, 1), (2, 2)})


= P((1, 2)) + P((2, 1)) + P((2, 2) = 3/36

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.

We can summary p.m.f of X in the p.m.f table


x 1 2 3 4 5 6
1 3 5 7 9 11
P(X = x) 36 36 36 36 36 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.

We can summary p.m.f of X in the p.m.f table


x 1 2 3 4 5 6
1 3 5 7 9 11
P(X = x) 36 36 36 36 36 36

27 / 76
Illustration to calculate p.m.f

For each possible value x, we collect all the outcomes that


give rise to X = x and add their probabilities to obtain
pX (x) = P(X = x). 28 / 76
One can use p.m.f of the discrete random vari-
able X to answer any question of X such as
P(1 < X < 4) = P(X = 2 or X = 3)
= P(X = 2) + P(X = 3) = 3/36 + 5/36
using additive rule for disjoin set
P(A ∪ B) = P(A) + P(B) if A ∩ B = ∅
for A = {X = 2}, B = {X = 3}
29 / 76
Practice
Probability mass function of discrete random vari-
able X is
x -2 -1 0 1 2
p(x) = P(X = x) 1/8 2/8 2/8 2/8 1/8
Determine
1 P(X ≤ −1 or X = 2)

2 P(−1 ≤ X ≤ 1)
30 / 76
Practice

A shipment of 20 similar laptop computers to a


retail outlet contains 3 that are defective. If a
school makes a random purchase of 2 of these
computers, find the probability mass function
(p.m.f) for the number of defectives.

31 / 76
Practice

An urn contains 11 balls, 3 white, 3 red, and 5


blue balls. Take out 2 balls at random, without
replacement. You win $1 for each red ball you
select and lose a $1 for each white ball you se-
lect. Determine the p.m.f of your loss/profit X.

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)?

p(3) = 1 − p(1) − p(2) = 1/6.


34 / 76
Example
Suppose X has 3 values 1, 2, 3 and
1 1
p(1) = , p(2) =
2 3
then what is p(3)?

p(3) = 1 − p(1) − p(2) = 1/6.


34 / 76
Graph of p(x)

35 / 76
Practice
Suppose that the p.m.f of random variable X is
given by

p(x) = c(x + 5), x = 0, 1, 2, 3, 4

Find
1 the value of the constant c
2 P(0 < X < 2.5).
36 / 76
From pdf to cdf

Probability that X does not exceed a given value


X
F(b) = P(X ≤ b) = P(X = xi)
xi ≤b

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

F(0.5) = P(X ≤ 0.5) = 0


5
F(2.4) = P(X ≤ 2.4) = P(X = 1)+P(X = 2) =
6
38 / 76
The formula of the c.d.f of X is



 0, x < 1
1, 1 ≤ x < 2

F(x) = 25
6, 2 ≤ x < 3



1, x ≥ 3

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

If X is a discrete random variable with c.d.f F(x)


then the p.m.f of X is determined by

P(X = x) = P(X ≤ x)−P(X < x) = F(x)−F(x−)

where x is a jump discontinuity of 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

P(X = a) = F(a)−F(a−) is nonzero at the points −2, 0, 2.


The p.m.f at each point is the change (jump size) of c.d.f
at the point 43 / 76
p.m.f of X is given by
p(−2) = P(X = −2) = F(−2) − F(−2−)
= 0.2 − 0 = 0.2
p(0) = P(X = 0) = F(0) − F(0−)
= 0.7 − 0.2 = 0.5
p(2) = P(X = 2) = F(2) − F(2−)
= 1 − 0.7 = 0.3

44 / 76
Properties of cdf of a discrete RV

• lim F(x) = 0 and lim F(x) = 1


x→−∞ x→∞
• FX has a piecewise constant and
staircase-like form.

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

f (a) is a measure of how likely it is that the


random variable will be near a - ”pmf per unit
length”
50 / 76
f (x)dx ≈ P(x < X < x + dx) ≈ P(X ≈ x)
So
X X
P(a ≤ X ≤ b) ≈ P(X ≈ x) = f (x)dx
a≤X≤b a≤x≤b
Z b
= f (x)dx
a
51 / 76
Example
Suppose that the error in the reaction tempera-
ture, in ◦C, for a controlled laboratory experi-
ment is a continuous random variable X having
the probability density function
(2
x
−1 ≤ x ≤ 2
f (x) = 3 .
0 elsewhere
52 / 76
We have
f (0.3) = f (−0.3) = 0.03 < f (0.6) = 0.12
So the error in the reaction temperature near 0.3

C is as likely as near -0.3◦C but has less chance
than near 0.12 ◦C
f (3) = 0
implies that the error can not be near 3 ◦C.
53 / 76
f (x) = 0 ∀x ≥ 2 or x ≤ −1
says that the error can not be greater than 2. It
can not also take on values less than -1. The
error can be between -1 and 2 or we say

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

P(a ≤ X ≤ b) = P(a < X ≤ b)


= P(a ≤ X < b)
= P(a < X < 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

Let X be a continous random variable with p.d.f


f (x) then its c.d. f is given by
Z x
F(x) = P(X ≤ x) = f (u)du
−∞

65 / 76
Properties of cdf of a continuous RV

• F ′(x) = f (x) for all x


• P(a ≤ X ≤ b) = F(b) − F(a)
• lim F(x) = 0 and lim F(x) = 1
x→−∞ x→∞

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

• Hence the c.d.f of X is



0,
 x < −1
3
F(x) = x 9+1 , −1 ≤ x ≤ 2

1, x>2

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

1 Find the c.d.f F(x) of X.


2 What is the probability that the component
will last at least 5 hours? 70 / 76
From c.d.f to p.d.f

If F is the c.d.f of a continous random variable


X then the p.d.f of X is
d
f (x) = F(x)
dx

71 / 76
Example

Find p.d.f of X if its c.d.f is


(
1 − e−2x if x > 0
F(x) =
0 elsewhere

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

You might also like