1. Chapter 2: Random Variables
Probability and Random Process (EEEg-2114)
2. Random Variables
Outline
Introduction
The Cumulative Distribution Function
Probability Density and Mass Functions
Expected Value, Variance and Moments
Some Special Distributions
Functions of One Random Variable
2
3. 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.
Line
al
Re
x
X
)
(
x
A
B
3
4. Introduction Cont’d……
If X is a random variable, then {ω: X(ω)≤ x}={X≤ x} is an event
for every X in RX.
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:
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}.
}
TTT
,
,
,
,
,
,
,
{ TTH
HTT
THT
THH
HTH
HHT
HHH
0
1
1
1
2
2
2
3
:
)
(
:
X
TTT
TTH
HTT
THT
THH
HTH
HHT
HHH
4
5. The Cumulative Distribution Function
The cumulative distribution function (cdf) of a random variable
X is defined as the probability of the event {X≤ x}.
Properties of the cdf, FX(x):
The cdf has the following properties.
1
)
(
0
i.e.,
function,
negative
-
non
a
is
)
(
.
x
F
x
F
i
X
X
1
)
(
lim
.
x
F
ii X
x
0
)
(
lim
.
x
F
iii X
x
)
(
)
( x
X
P
x
FX
5
6. The Cumulative Distribution Function Cont’d…..
)
(
)
(
then
,
If
i.e.,
,
of
function
decreasing
-
non
a
is
)
(
.
2
1
2
1 x
F
x
F
x
x
X
x
F
iv
X
X
X
)
(
)
(
)
(
. 1
2
2
1 x
F
x
F
x
X
x
P
v X
X
)
(
1
)
(
. x
F
x
X
P
vi 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
7. 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.
3
,
1
3
2
,
8
/
7
2
1
,
2
/
1
1
0
,
8
/
1
0
,
0
)
(
x
x
x
x
x
x
FX
7
8. 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.,
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,……
du
u
f
x
FX )
(
)
(
8
9. The Probability Density Function
The probability density function (pdf) of a continuous random
variable X is defined as the derivative of the cdf, FX(x), i.e.,
Properties of the pdf, fX(x):
dx
x
dF
x
f X
X
)
(
)
(
2
1
)
(
)
(
.
1
)
(
.
0
)
(
,
of
values
all
For
.
2
1
x
x
X
X
X
dx
x
f
x
X
x
P
iii
dx
x
f
ii
x
f
X
i
9
10. The Probability Mass Function
The probability mass function (pmf) of a discrete random
variable X is defined as:
Properties of the pmf, PX (xi ):
)
(
)
(
)
(
)
( 1
i
X
i
X
i
X
i
X x
F
x
F
x
P
x
X
P
k
k
X
k
X
i
X
x
P
iii
k
x
x
x
P
ii
k
x
P
i
1
)
(
.
.....
2,
,
1
,
if
,
0
)
(
.
.....
2,
,
1
,
1
)
(
0
.
10
11. Calculating the Cumulative Distribution Function
The cdf of a continuous random variable X can be obtained by
integrating the pdf, i.e.,
Similarly, the cdf of a discrete random variable X can be obtained by
using the formula:
x
X
X du
u
f
x
F )
(
)
(
x
x
k
k
X
X
k
x
x
U
x
P
x
F )
(
)
(
)
(
11
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:
Similarly, the expected value of a discrete random variable X is
given by:
Mean represents the average value of the random variable in a
very large number of trials.
dx
x
xf
X
E X
X )
(
)
(
k
k
X
k
X x
P
x
X
E )
(
)
(
12
13. Expected Value, Variance and Moments Cont’d…..
ii. Variance
The variance of a continuous random variable X, denoted by
σ2
X or VAR(X), is defined as:
Expanding (x-μX )2 in the above equation and simplifying the
resulting equation, we will get:
dx
x
f
x
X
Var
X
E
X
Var
X
X
X
X
X
)
(
)
(
)
(
]
)
[(
)
(
2
2
2
2
2
2
2
)]
(
[
)
(
)
( X
E
X
E
X
Var
X
13
14. Expected Value, Variance and Moments Cont’d…..
The variance of a discrete random variable X is given by:
The standard deviation of a random variable X, denoted by σX, is
simply the square root of the variance, i.e.,
iii.Moments
The nth moment of a continuous random variable X is defined as:
k
k
X
X
k
X x
P
x
X
Var )
(
)
(
)
( 2
2
)
(
)
( 2
X
Var
X
E X
X
1
,
)
(
)
( n
dx
x
f
x
X
E X
n
n
14
15. Expected Value, Variance and Moments Cont’d…..
Similarly, the nth moment of a discrete random variable X is
given by:
Mean of X is the first moment of the random variable X.
1
,
)
(
)
(
n
x
P
x
X
E
k
k
X
n
k
15
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:
The corresponding distribution function is given by:
where
.
2
1
)
(
2
2
2
/
)
(
2
x
X e
x
f
x
y
X
x
G
dy
e
x
F
2
2
2
/
)
(
2
2
1
)
(
dy
e
x
G y
x
2
/
2
2
1
)
(
16
17. Some Special Distributions Cont’d……
The normal or Gaussian distribution is the most common
continuous probability distribution.
)
(x
fX
x
Fig. Normal or Gaussian Distribution
17
18. Some Special Distributions Cont’d……
2. Uniform Distribution
3. Exponential Distribution
)
(x
fX
x
a b
a
b
1
Fig. Uniform Distribution
otherwise.
0,
,
0
,
1
)
(
/
x
e
x
f
x
X
)
(x
fX
x
Fig. Exponential Distribution
otherwise.
0,
,
1
)
(
b
x
a
a
b
x
fX
18
19. Some Special Distributions Cont’d……
4. Gamma Distribution
5. Beta Distribution
where
otherwise.
0,
,
0
,
)
(
)
(
/
1
x
e
x
x
f
x
X
otherwise.
0,
,
1
0
,
)
1
(
)
,
(
1
)
(
1
1
x
x
x
b
a
x
f
b
a
X
1
0
1
1
.
)
1
(
)
,
( du
u
u
b
a b
a
19
20. Some Special Distributions Cont’d……
6. Rayleigh Distribution
7. Cauchy Distribution
8. Laplace Distribution
otherwise.
0,
,
0
,
)
(
2
2
2
/
2
x
e
x
x
f
x
X
.
,
)
(
/
)
( 2
2
x
x
x
fX
.
,
2
1
)
( /
|
|
x
e
x
f x
X
20
21. Some Special Distributions Cont’d….
i. Discrete Probability Distributions
1. Bernoulli Distribution
2. Binomial Distribution
3. Poisson Distribution
.
)
1
(
,
)
0
( p
X
P
q
X
P
.
,
,
2
,
1
,
0
,
)
( n
k
q
p
k
n
k
X
P k
n
k
.
,
,
2
,
1
,
0
,
!
)
(
k
k
e
k
X
P
k
21
22. Some Special Distributions Cont’d….
4. Hypergeometric Distribution
5. Geometric Distribution
6. Negative Binomial Distribution
, max(0, ) min( , )
( )
m N m
k n k
N
n
m n N k m n
P X k
.
1
,
,
,
2
,
1
,
0
,
)
( p
q
k
pq
k
X
P k
1
( ) , , 1, .
1
r k r
k
P X k p q k r r
r
22
23. Random Variable Examples
Example-1:
The pdf of a continuous random variable is given by:
.
of
variance
and
mean
the
Evaluate
.
)
1
4
/
1
(
Find
.
.
of
cdf
ing
correspond
the
Find
.
.
of
value
the
Determine
.
constant.
a
is
re
whe
otherwise
,
0
1
0
,
)
(
X
d
X
P
c
X
b
k
a
k
x
kx
x
fX
23
24. Random Variable Examples Cont’d……
Solution:
2
1
2
1
0
1
2
1
1
)
(
.
2
1
0
k
k
x
k
kxdx
dx
x
f
a X
otherwise
,
0
1
0
,
2
)
(
x
x
x
fX
24
25. Random Variable Examples Cont’d……
Solution:
0
2
)
(
)
(
1
0
for
:
2
Case
0
for
,
0
)
(
since
,
0
)
(
0
for
:
1
Case
)
(
)
(
:
by
given
is
of
cdf
The
.
2
0 0
2
X
x
x
u
udu
du
u
f
x
F
x
x
x
f
x
F
x
du
u
f
x
F
X
b
x x
X
X
X
x
X
X
25
26. Random Variable Examples Cont’d……
Solution:
1
,
1
1
0
,
0
,
0
)
(
by
given
is
cdf
The
1
0
1
2
)
(
)
(
1
for
:
3
Case
2
1
0
1
0
2
x
x
x
x
x
F
u
udu
du
u
f
x
F
x
X
X
X
26
27. Random Variable Examples Cont’d……
Solution:
16
/
15
)
1
4
/
1
(
16
/
15
)
4
/
1
(
1
)
1
4
/
1
(
)
4
/
1
(
)
1
(
)
1
4
/
1
(
cdf
the
Using
.
16
/
15
)
1
4
/
1
(
16
/
15
4
/
1
1
)
1
4
/
1
(
2
)
(
)
1
4
/
1
(
pdf
the
Using
.
)
1
4
/
1
(
.
2
2
1
4
/
1
1
4
/
1
X
P
X
P
F
F
X
P
ii
X
P
x
X
P
dx
x
dx
x
f
X
P
i
X
P
c
X
X
X
27
28. Random Variable Examples Cont’d……
Solution:
18
/
1
)
3
/
2
(
2
/
1
)
(
2
/
1
2
)
(
)
(
)]
(
[
)
(
)
(
Variance
.
3
/
2
0
1
3
2
2
)
(
)
(
Mean
.
Variance
and
Mean
.
2
2
1
0
1
0
3
2
2
2
2
2
3
1
0
1
0
2
x
Var
dx
x
dx
x
f
x
X
E
X
E
X
E
X
Var
ii
x
dx
x
dx
x
xf
X
E
i
d
X
X
X
X
X
X
28
29. Random Variable Examples Cont’d……..
Example-2:
Consider a discrete random variable X whose pmf is given by:
.
of
variance
and
mean
the
Find
otherwise
,
0
1
0,
,
1
,
3
/
1
)
(
X
x
x
P
k
k
X
29
30. Random Variable Examples Cont’d……
Solution:
3
/
2
)
0
(
3
/
2
)
(
3
/
2
]
)
1
(
)
0
(
)
1
[(
3
/
1
)
(
)
(
)]
(
[
)
(
)
(
Variance
.
0
)
1
0
1
(
3
/
1
)
(
)
(
Mean
.
2
2
1
1
2
2
2
2
2
2
2
2
1
1
x
Var
x
P
x
X
E
X
E
X
E
X
Var
ii
x
P
x
X
E
i
X
k
k
X
k
X
k
k
X
k
X
30
31. 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:
We can determine the cdf and pdf of Y in terms of that of X.
Consider some of the following functions.
31
)
(X
g
Y
)
(X
g
Y
b
aX
2
X
|
| X
X
)
(
|
| x
U
X
X
e
X
log
X
sin
X
1
32. 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.
3. Obtain fY(y) from FY(y) by using direct differentiation, i.e.,
32
)
(
)
)
(
(
)
( y
Y
P
y
X
g
P
y
FY
dy
y
dF
y
f Y
Y
)
(
)
(
33. 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:
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
33
)]
(
[
)
(
)
(
)
( y
h
f
dy
y
dh
x
f
dy
dx
y
f X
X
Y
34. Functions of a Random Variable Cont’d…..
ii. Determine the derivative of function g(xi ) at every real root xi ,
i.e. ,
iii. Find the pdf of Y by using the following formula.
34
i
i
X
i
i
X
i
i
Y x
f
x
g
x
f
dy
dx
y
f )
(
)
(
)
(
)
(
dy
dx
x
g i
i
)
(
35. Examples on Functions of One Random Variable
Examples:
35
.
of
pdf
the
determine
,
tan
If
].
2
,
2
[
interval
in the
uniform
is
X
variable
random
The
.
).
(
Find
.
1
Let
.
).
(
Find
.
Let
.
).
(
Find
.
Let
.
2
Y
X
Y
d
y
f
X
Y
c
y
f
X
Y
b
y
f
b
aX
Y
a
Y
Y
Y
36. Examples on Functions of One Random Variable…..
Solutions:
36
)
(
1
)
(
)
(
)
(
)
(
)
(
)
(
0
that
Suppose
Method
Using
.
.
i
a
b
y
f
a
dy
y
dF
y
f
a
b
y
F
y
F
a
b
y
X
P
y
b
aX
P
y
Y
P
y
F
a
I
i
b
aX
Y
a
X
Y
Y
X
Y
y
37. Examples on Functions of One Random Variable…..
Solutions:
37
)
(
1
)
(
)
(
1
)
(
)
(
)
(
)
(
then
,
0
if
other
On the
Method
Using
.
.
ii
a
b
y
f
a
dy
y
dF
y
f
a
b
y
F
y
F
a
b
y
X
P
y
b
aX
P
y
Y
P
y
F
a
I
i
b
aX
Y
a
X
Y
Y
X
Y
y
38. Examples on Functions of One Random Variable…..
Solutions:
38
a
a
b
y
f
a
y
f
ii
i
I
i
b
aX
Y
a
X
Y all
for
,
1
)
(
:
obtain
we
,
)
(
and
)
(
equations
From
Method
Using
.
.
39. Examples on Functions of One Random Variable…..
Solutions:
39
a
b
y
f
a
y
f
y
h
f
dy
y
dh
x
f
dy
dx
y
f
a
dy
dx
a
dy
y
dh
dy
dx
y
h
a
b
y
x
y
IR
Y
b
aX
Y
II
ii
b
aX
Y
a
X
Y
X
X
Y
1
)
(
)
(
)
(
)
(
1
1
)
(
solution
principal
the
is
)
(
,
any
For
is
of
space
range
the
and
one
-
to
-
one
is
function
The
Method
Using
.
.
40. Examples on Functions of One Random Variable…..
Solutions:
40
y
and
by
given
solutions
two
are
there
,
0
each
For
0
is
of
space
range
the
and
one
-
to
-
one
not
is
function
The
.
2
1
2
x
y
x
y
y
Y
X
Y
b
41. Examples on Functions of One Random Variable…..
Solutions:
41
otherwise
y
y
f
y
f
y
y
f
x
f
dy
dx
x
f
dy
dx
y
f
x
f
dy
dx
y
f
y
dy
dx
y
dy
dx
y
dy
dx
y
dy
dx
b
X
X
Y
X
X
Y
i
X
i
i
Y
,
0
0
,
2
1
)
(
)
(
)
(
)
(
)
(
)
(
2
1
2
1
and
2
1
2
1
.
2
2
1
1
2
2
1
1
42. Examples on Functions of One Random Variable…..
Solutions:
42
0
/
,
y
1
1
)
(
1
1
)
(
)
(
)
(
)
(
1
)
(
solution
principal
the
is
)
(
1
,
any
For
0
/
is
of
space
range
the
and
one
-
to
-
one
is
1
function
The
.
2
2
2
IR
f
y
y
f
y
f
y
y
f
y
h
f
dy
y
dh
x
f
dy
dx
y
f
y
dy
y
dh
dy
dx
y
h
y
x
y
IR
Y
X
Y
c
X
Y
X
Y
X
X
Y
43. Examples on Functions of One Random Variable…..
Solutions:
43
y
y
y
f
y
y
f
y
h
f
dy
y
dh
x
f
dy
dx
y
f
y
dy
y
dh
dy
dx
y
h
y
x
y
Y
X
Y
d
Y
Y
X
X
Y
,
)
1
(
1
)
(
1
/
1
)
(
)
(
)
(
)
(
1
1
)
(
solution
principal
the
is
)
(
tan
,
any
For
)
,
(
is
of
space
range
the
and
one
-
to
-
one
is
tan
function
The
.
2
2
2
1
45. Assignment-II
1. The continuous random variable X has the pdf given by:
.
of
variance
and
mean
the
.
)
1
(
.
.
of
cdf
the
.
.
of
value
the
.
:
Find
constant.
a
is
re
whe
otherwise
,
0
2
0
,
)
2
(
)
(
2
X
d
X
P
c
X
b
k
a
k
x
x
x
k
x
fX
45
46. Assignment-II Cont’d…..
2. The cdf of continuous random variable X is given by:
.
of
variance
and
mean
the
.
.
of
pdf
the
.
.
of
value
the
.
:
Determine
constant.
a
is
re
whe
1
1,
1
0
,
0
,
0
)
(
X
c
X
b
k
a
k
x
x
x
k
x
x
X
F
46
47. Assignment-II Cont’d…..
3. The random variable X is uniform in the interval [0, 1]. Find
the pdf of the random variable Y if Y=-lnX.
47