02 Random Variables
02 Random Variables
2
Introduction
§ A random variable X is a function that assigns a real number
X(ω) to each outcome ω in the sample space Ω of a random
experiment.
§ The sample space Ω is the domain of the random variable and the
set RX of all values taken on by X is the range of the random
variable.
§ Thus, RX is the subset of all real numbers.
A
X ( ) x
Re al Line
x B
3
Introduction Cont’d……
§ If X is a random variable, then {ω: X(ω)≤ x}={X≤ x} is an event for
every X in RX.
§ Two or more different sample points might give the same value
of X(ω) but two different numbers in the range cannot be
assigned to the same sample point.
Example: Consider a random experiment of tossing a fair coin three times.
The sequence of heads and tails is noted and the sample space Ω is given
by: {HHH , HHT , HTH , THH , THT , HTT , TTH , TTT}
Let X be the number of heads in three coin tosses. X assigns each
possible outcome ω in the sample space Ω a number from the set
RX={0, 1, 2, 3}.
: HHH HHT HTH THH THT HTT TTH TTT
X ( ) : 3 2 2 2 1 1 1 0 4
The Cumulative Distribution Function
iii . lim F X ( x ) 0
x
5
The Cumulative Distribution Function Cont’d…..
v. P ( x1 X x 2 ) F X ( x 2 ) F X ( x1 )
vi . P ( X x ) 1 F X ( x )
Example:
Find the cdf of the random variable X which is defined as the
number of heads in three tosses of a fair coin.
6
The Cumulative Distribution Function
Solution:
ü We know that X takes on only the values 0, 1, 2 and 3 with
probabilities 1/8, 3/8, 3/8 and 1/8 respectively.
ü Thus, FX(x) is simply the sum of the probabilities of the
outcomes from the set {0, 1, 2, 3} that are less than or equal to x.
0, x 0
1 / 8, 0 x 1
FX ( x) 1 / 2, 1 x 2
7 / 8, 2 x 3
1, x 3
7
Types of Random Variables
§ There are two basic types of random variables.
i. Continuous Random Variable
ü A continuous random variable is defined as a random variable
whose cdf, FX(x), is continuous every where and can be written as
an integral of some non-negative function f(x), i.e.,
FX ( x) f (u )du
ii. Discrete Random Variable
ü A discrete random variable is defined as a random variable whose
cdf, FX(x), is a right continuous, staircase function of X with
jumps at a countable set of points x0, x1, x2,……
8
Chapter 3, Lecture 1
Discrete and Continuous Density Functions
• Probability functions
– Discrete mass functions
– Continues density functions
– Expected Value, Variance and Moments
– Some Special Distributions
– Functions of One Random Variable
9
The Probability Mass Function
§ The probability mass function (pmf) of a discrete random variable
X with i<j is defined as:
pmf of r.v X:
Properties of the pmf, PX (xi ):
i. 0 PX ( x i ) 1, k 1, 2, .....
ii . PX ( x ) 0 , if x x k , k 1, 2, .....
iii . P
k
X ( xk ) 1
x2
iii . P ( x1 X x 2 )
x1
f X ( x ) dx
11
Calculating the Cumulative Distribution Function
FX ( x) P
xk x
X ( xk )U ( x xk )
12
Expected Value, Variance and Moments
i. Expected Value (Mean)
§ The expected value (mean) of a continuous random variable X,
denoted by μX or E(X), is defined as:
X E ( X ) xf X ( x)dx
X E ( X ) xk PX ( xk )
k
2
X
2
Var ( X ) E ( X ) [ E ( X )] 2
14
Expected Value, Variance and Moments Cont’d…..
§ The variance of a discrete random variable X is given by:
2
X Var ( X ) ( xk X ) PX ( xk )
2
X E ( X X ) 2 Var ( X )
iii.Moments
§ The nth moment of a continuous random variable X is defined as:
E ( X ) x n f X ( x)dx ,
n
n 1
15
Expected Value, Variance and Moments Cont’d…..
E ( X ) xk PX ( xk ) ,
n
n 1
k
16
Some Special Distributions
i. Continuous Probability Distributions
1. Normal (Gaussian) Distribution
§ The random variable X is said to be normal or Gaussian random
variable if its pdf is given by: N(µ, σ2)
1 ( x ) 2 / 2 2
f X (x) e .
2
2
§ The corresponding distribution function is given by:
x 1 x
( y ) 2 / 2 2
FX ( x) e dy G
2 2
where
x 1
2
G (x) e y / 2 dy
2 17
Some Special Distributions Cont’d……
x
Fig. Normal or Gaussian Distribution
18
Some Special Distributions Cont’d……
fX (x)
1
1 ba
, a xb x
f X (x) b a a b
0, otherwise.
Fig. Uniform Distribution
f X (x)
19
Some Special Distributions Cont’d……
4. Gamma Distribution
x 1 x/
e , x 0,
f X ( x ) ( )
0, otherwise.
5. Beta Distribution
1
x a 1 (1 x ) b 1 , 0 x 1,
f X ( x) (a, b)
0, otherwise.
where
1
(a , b) 0
u a 1 (1 u ) b 1 du .
20
Some Special Distributions Cont’d……
6. Rayleigh Distribution
x x 2 / 2 2
e , x 0,
f X ( x) 2
0, otherwise.
7. Cauchy Distribution
/
fX (x) 2 2
, x .
(x )
8. Laplace Distribution
1 | x |/
fX (x) e , x .
2
21
Some Special Distributions Cont’d….
i. Discrete Probability Distributions
1. Bernoulli Distribution
A Bernoulli r.v. X is associated with some experiment where an
outcome can be classified as either a "success" or a "failure," and
the probability of a success is p and the probability of a failure is 1-p
2. Binomial Distribution
A binomial r.v. X is associated with some experiments in which n
independent Bernoulli trials are performed and X represents the
number of successes that occur in the n trial. N.B. a Bernoulli r.v. is
just a binomial r.v. with parameters (1, p)
n k nk
P ( X k ) p q , k 0 ,1 , 2 , , n .
k
Mean= np
Variance np(1-p) 22
Some Special Distributions Cont’d….
3. Poisson Distribution
• an approximation for a binomial r.v. with parameters (n, p)
when n is large and p is small enough so that np is of a
moderate size.
• Some applications of Poisson r.v.'s:
1. The number of telephone calls arriving at a switching center
during various intervals of time
2. The number of misprints on a page of a book
3. The number of customers entering a bank during various
intervals of time
k
P ( X k ) e , k 0 ,1, 2 , , .
k!
23
Some Special Distributions Cont’d….
4. Hypergeometric Distribution
m N m
k n k
P( X k )
N
, max(0, m n N ) k min( m, n )
n
5. Geometric Distribution
P ( X k ) pq k , k 0 ,1 , 2 , , , q 1 p.
Example-1:
The pdf of a continuous random variable is given by:
kx , 0 x 1
f X ( x)
0 , otherwise
where k is a constant.
c. Find P (1 / 4 X 1)
27
Random Variable Examples Cont’d……
Solution:
Case 3 : for x 1
1 1 1
2
FX ( x) f X ( u ) du 2 udu u 1
0 0 0
The cdf is given by
0, x 0
2
FX ( x) x , 0 x 1
1, x 1
28
Random Variable Examples Cont’d……
Solution:
c. P (1 / 4 X 1)
i. Using the pdf
1 1
P (1 / 4 X 1)
1/ 4
f X ( x ) dx
1/ 4
2 xdx
2 1
P (1 / 4 X 1) x 15 / 16
1/ 4
P (1 / 4 X 1) 15 / 16
ii . Using the cdf
P (1 / 4 X 1) F X (1) F X (1 / 4 )
P (1 / 4 X 1) 1 (1 / 4 ) 2 15 / 16
P (1 / 4 X 1) 15 / 16
29
Random Variable Examples Cont’d……
Solution:
d. Mean and Variance
i. Mean
1 1
X E(X )
0
xf X ( x ) dx 0
2 x 2 dx
2x3 1
X 2/3
3 0
ii . Variance
X 2 Var ( X ) E ( X 2 ) [ E ( X )] 2
1 1
2 2
E(X ) x f X ( x ) dx 2 x 3 dx 1 / 2
0 0
2
X Var ( x ) 1 / 2 ( 2 / 3) 2 1 / 18
30
Random Variable Examples Cont’d……..
Example-2:
Consider a discrete random variable X whose pmf is given by:
1 / 3 , xk 1, 0, 1
PX ( xk )
0 , otherwise
31
Random Variable Examples Cont’d……
Solution:
i. Mean
1
X E(X ) x
k 1
k PX ( x k ) 1 / 3( 1 0 1) 0
ii . Variance
X 2 Var ( X ) E ( X 2 ) [ E ( X )] 2
1
2 2
E(X ) x k PX ( x k ) 1 / 3[( 1) 2 ( 0 ) 2 (1) 2 ] 2 / 3
k 1
2
X Var ( x ) 2 / 3 ( 0 ) 2 2 / 3
32
Exercises
Exercise
34
Functions of One Random Variable
§ Let X be a continuous random variable with pdf fX(x) and suppose
g(x) is a function of the random variable X defined as:
Y g( X )
1 |X |
Y g( X )
X
X
log X
eX | X | U ( x)
35
Functions of a Random Variable Cont’d…..
§ Steps to determine fY(y) from fX(x):
Method I:
1. Sketch the graph of Y=g(X) and determine the range space of Y.
2. Determine the cdf of Y using the following basic approach.
FY ( y ) P ( g ( X ) y ) P (Y y )
dFY ( y )
fY ( y )
dy
36
Functions of a Random Variable Cont’d…..
Method II:
1. Sketch the graph of Y=g(X) and determine the range space of Y.
2. If Y=g(X) is one to one function and has an inverse
transformation x=g-1(y)=h(y), then the pdf of Y is given by:
dx dh( y )
fY ( y ) f X ( x) f X [h( y )]
dy dy
3. Obtain Y=g(x) is not one-to-one function, then the pdf of Y can
be obtained as follows.
i. Find the real roots of the function Y=g(x) and denote them by xi
37
Functions of a Random Variable Cont’d…..
dxi
f Y ( y) f X ( xi ) g ( xi ) f X ( xi )
i dy i
38
Examples on Functions of One Random Variable
Examples:
a. Let Y aX b. Find f Y ( y ).
b. Let Y X 2 . Find f Y ( y ).
1
c. Let Y . Find f Y ( y ).
X
d . The random variable X is uniform in the interval [ , ].
2 2
If Y tan X , determine the pdf of Y .
39
Examples on Functions of One Random Variable…..
Solutions:
a. Y aX b
i. Using Method I
Suppose that a 0
yb
F y ( y ) P (Y y ) P ( aX b y ) P X
a
yb
FY ( y ) F X
a
dFY ( y ) 1 yb
fY ( y) fX (i )
dy a a
40
Examples on Functions of One Random Variable…..
Solutions:
a. Y aX b
i. Using Method I
On the other if a 0, then
yb
F y ( y ) P (Y y ) P ( aX b y ) P X
a
yb
FY ( y ) 1 F X
a
dFY ( y ) 1 yb
fY ( y) fX (ii )
dy a a
41
Examples on Functions of One Random Variable…..
Solutions:
a. Y aX b
i. Using Method I
1 y b
f Y ( y) fX , for all a
a a
42
Examples on Functions of One Random Variable…..
Solutions:
a. Y aX b
ii. Using Method II
The function Y aX b is one - to - one and the range
space of Y is IR
yb
For any y , x h ( y ) is the principal solution
a
dx dh ( y ) 1 dx 1
dy dy a dy a
dx dh y 1 yb
fY ( y) f X ( x) f X h ( y ) f Y ( y ) fX
dy dy a a
43
Examples on Functions of One Random Variable…..
Solutions:
2
b. The function Y X is not one - to - one and the range
space of Y is y 0
For each y 0, there are two solutions given by
x1 y and x 2 y
44
Examples on Functions of One Random Variable…..
Solutions:
dx 1 1 dx 1 1
b. and
dy 2 y dy 2 y
dx 2 1 dx 2 1
dy 2 y dy 2 y
dx i dx 1 dx 2
fY ( y)
i dy
f X ( xi ) f Y ( y )
dy
f X ( x1 )
dy
f X ( x2 )
1
2 y fX y f y ,
X y0
fY ( y)
0, otherwise
45
Examples on Functions of One Random Variable…..
Solutions:
1
c . The function Y is one - to - one and the range
X
space of Y is IR / 0
1
For any y , x h ( y ) is the principal solution
y
dx dh ( y ) 1
2
dy dy y
dx dh y 1 1
fY ( y) f X ( x) f X h ( y ) f Y ( y ) 2 f X
dy dy y y
1 1
fY ( y) f X
, IR / 0
y
2
y
46
Examples on Functions of One Random Variable…..
Solutions:
d . The function Y tan X is one - to - one and the range
space of Y is ( , )
dx dh ( y ) 1
dy dy 1 y2
dx dh y 1/
fY ( y) f X ( x) f X h ( y ) f Y ( y )
dy dy 1 y2
1
fY ( y) 2
, y
(1 y )
47
Examples on Functions of One Random Variable…..
Solutions:
48
Assignment-II
where k is a constant.
Find :
a. the value of k .
b. the cdf of X .
c. P ( X 1)
whe re k is a constant.
Determine :
a. the value of k .
b. the pdf of X .
c. the mean and variance of X .
50
Assignment-II Cont’d…..
51