Chapter 2
Chapter 2
Random
Variables
NIPRL
2.1 Discrete Random Variable
2.1.1 Definition of a Random Variable (1/2)
• Random variable
– A numerical value to each outcome of a particular
experiment
S
-3 -2 -1 0 1 2 3
NIPRL
2.1.1 Definition of a Random Variable (2/2)
NIPRL
2.1.2 Probability Mass Function (1/2)
NIPRL
2.1.2 Probability Mass Function (1/2)
f ( x)
0.5
0.3
0.2
F ( x)
1.0
0.5
0.3
NIPRL
2.2 Continuous Random Variables
2.2.1 Example of Continuous Random Variables
(1/1)
• Example 14 : Metal Cylinder Production
– Suppose that the random variableX is the diameter
of a randomly chosen cylinder manufactured by the
company. Since this random variable can take any
value between 49.5 and 50.5, it is a continuous
random variable.
NIPRL
2.2.2 Probability Density Function (1/4)
f ( x) 0
statespace
f ( x)dx 1
NIPRL
2.2.2 Probability Density Function (2/4)
• Example 14
– Suppose that the diameter of a metal cylinder has a p.d.f
f ( x) 1.5 6( x 50.2) 2 for 49.5 x 50.5
f ( x) 0, elsewhere
f ( x)
49.5 50.5 x
NIPRL
2.2.2 Probability Density Function (3/4)
NIPRL
2.2.2 Probability Density Function (4/4)
NIPRL
2.2.3 Cumulative Distribution Function (1/3)
dF ( x)
f ( x)
dx
NIPRL
2.2.2 Probability Density Function (2/3)
• Example 14
x
F ( x) P( X x) (1.5 6( y 50.0) 2 )dy
49.5
NIPRL
2.2.2 Probability Density Function (3/3)
P( X 50.0) 0.5
F ( x)
P( X 49.7) 0.104
NIPRL
2.3 The Expectation of a Random Variable
2.3.1 Expectations of Discrete Random Variables
(1/2)
• Expectation of a discrete random variable with p.m.f
P( X xi ) pi
E ( X ) pi xi
i
E ( X ) xf ( x ) dx
state space
NIPRL
2.3.1 Expectations of Discrete Random Variables
(2/2)
NIPRL
2.3.2 Expectations of Continuous Random Variables
(1/2)
NIPRL
2.3.2 Expectations of Continuous Random Variables
(2/2)
– Then, E ( X ) (why?)
NIPRL
E ( X ) xf ( x)dx
xf ( x)dx +xf ( x)dx
-
y 2 x
xf ( x)dx + yf ( y )dy
- -
NIPRL
2.3.3 Medians of Random Variables (1/2)
• Median
– Information about the “middle” value of the random
variable
F ( x) 0.5
NIPRL
2.3.3 Medians of Random Variables (2/2)
• Example 14
x 50.0
NIPRL
2.4 The variance of a Random Variable
2.4.1 Definition and Interpretation of Variance (1/2)
• Variance(
2
)
– A positive quantity that measures the spread of the
distribution of the random variable about its mean value
– Larger values of the variance indicate that the
distribution is more spread out
– Definition: Var( X ) E (( X E ( X )) 2 )
E ( X 2 ) ( E ( X )) 2
• Standard Deviation
– The positive square root of the variance
– Denoted by
NIPRL
2.4.1 Definition and Interpretation of Variance (2/2)
Var( X ) E (( X E ( X )) 2 )
E ( X 2 2 XE ( X ) ( E ( X )) 2 )
E ( X 2 ) 2 E ( X ) E ( X ) ( E ( X )) 2
E ( X 2 ) ( E ( X )) 2
f ( x)
Two distribution with
identical mean values
but different variances
x
NIPRL
2.4.2 Examples of Variance Calculations (1/1)
• Example 1
Var( X ) E (( X E ( X )) 2 ) pi ( xi E ( X ))2
i
17,100 130.77
NIPRL
2.4.3 Chebyshev’s Inequality (1/1)
• Chebyshev’s Inequality
– If a random variable has a mean 2
and a variance ,
then 1
P ( c X c ) 1
c2
for c 1
c 2
– For example, taking gives
1
P ( 2 X 2 ) 1 2 0.75
2
NIPRL
• Proof
2 ( x ) 2 f ( x)dx ( x ) 2 f ( x)dx c 2 2 f ( x)dx.
| x | c
| x | c
P(| x | c ) 1/ c 2
P (| x |c ) 1 P (| x | c ) 1 1/ c 2
NIPRL
2.4.4 Quantiles of Random Variables (1/2)
NIPRL
2.4.4 Quantiles of Random Variables (2/2)
• Example 14
F ( x) 1.5 x 2( x 50.0)3 74.5 for 49.5 x 50.5
– Upper quartile : F ( x) 0.75 x 50.17
NIPRL
2.5 Jointly Distributed Random Variables
2.5.1 Jointly Distributed Random Variables (1/4)
f ( x, y ) 0 satisfying
state space
f ( x, y )dxdx 1
NIPRL
2.5.1 Jointly Distributed Random Variables (2/4)
F ( x, y ) P ( X xi , Y y j )
– Continuous
F ( x, y ) pij
i: xi x j: y j y
x y
F ( x , y ) f ( w, z )dzdw
w z
NIPRL
2.5.1 Jointly Distributed Random Variables (3/4)
NIPRL
2.5.1 Jointly Distributed Random Variables (4/4)
X=service time
• Joint p.m.f
Y=
numbe p
i j
ij 0.12 0.18
r of
1 2 3 4
units 0.07 1.00
NIPRL
2.5.2 Marginal Probability Distributions (1/2)
– Continuous
f X ( x) f ( x, y )dy
NIPRL
2.5.2 Marginal Probability Distributions (2/2)
• Example 19
– Marginal p.m.f of X
3
P ( X 1) p1 j 0.12 0.08 0.01 0.21
j 1
– Marginal p.m.f of Y
4
P (Y 1) pi1 0.12 0.08 0.07 0.05 0.32
i 1
NIPRL
• Example 20: (a jointly continuous case)
• Joint pdf: f ( x, y )
• Marginal pdf’s of X and Y:
f X ( x) f ( x, y )dy
fY ( y ) f ( x, y )dx
NIPRL
2.5.3 Conditional Probability Distributions (1/2)
f ( x, y )
f X |Y y ( x)
fY ( y )
– The conditional probability distribution is a probability
distribution.
NIPRL
2.5.3 Conditional Probability Distributions (2/2)
• Example 19
– Marginal probability distribution of Y
NIPRL
2.5.4 Independence and Covariance (1/5)
NIPRL
2.5.4 Independence and Covariance (2/5)
• Covariance
Cov( X , Y ) E (( X E ( X ))(Y E (Y )))
E ( XY ) E ( X ) E (Y )
NIPRL
2.5.4 Independence and Covariance (3/5)
E ( X ) 2.59, E (Y ) 1.79
4 3
E ( XY ) ijpij
i 1 j 1
NIPRL
2.5.4 Independence and Covariance (4/5)
• Correlation:
Cov( X , Y )
Corr( X , Y )
Var( X )Var(Y )
NIPRL
2.5.4 Independence and Covariance (5/5)
NIPRL
• What if random variable X and Y have linear relationship, that
is,Y aX b
a 0
where
Cov( X , Y ) E[ XY ] E[ X ]E[Y ]
E[ X (aX b)] E[ X ]E[aX b]
aE[ X 2 ] bE[ X ] aE 2 [ X ] bE[ X ]
a ( E[ X 2 ] E 2 [ X ]) aVar ( X )
Cov( X , Y ) aVar ( X )
Corr ( X , Y )
Var ( X )Var (Y ) Var ( X )a 2Var ( X )
NIPRL
2.6 Combinations and Functions of Random
Variables
2.6.1 Linear Functions of Random Variables (1/4)
• Linear Functions of a Random Variable
– If X is a random variable and Y aX b
for some numbersa, b R thenE (Y ) aE ( X ) b
and Var(Y ) a 2 Var( X )
• Standardization
-If a random variableX has an expectation of and a
variance of ,
2
X 1
Y X
has an expectation of zero and a variance of one.
NIPRL
2.6.1 Linear Functions of Random Variables (2/4)
NIPRL
2.6.1 Linear Functions of Random Variables (3/4)
Y 112 10.58
NIPRL
2.6.1 Linear Functions of Random Variables (4/4)
NIPRL
• Properties of Cov( X 1 , X 2 )
Cov( X 1 , X 2 ) E[ X 1 X 2 ] E[ X 1 ]E[ X 2 ]
Cov( X 1 , X 2 ) Cov( X 2 , X 1 )
Cov( X 1 , X 1 ) Var ( X 1 ) Cov( X 2 , X 2 ) Var ( X 2 )
Cov( X 1 X 2 , X 1 ) Cov ( X 1 , X 1 ) Cov ( X 2 , X 1 )
Cov( X 1 X 2 , X 1 X 2 ) Cov( X 1 , X 1 ) Cov( X 1 , X 2 )
Cov( X 2 , X 1 ) Cov( X 2 , X 2 )
NIPRL
2.6.2 Linear Combinations of Random Variables
(1/5)
NIPRL
2.6.2 Linear Combinations of Random Variables
(2/5)
• Averaging Independent Random Variables
– Suppose thatX 1 , , X n is a sequence of independent
random variables with an expectation and a variance
2
.
X1 X n
– Let X
n
E ( X )
– Then
2
and Var( X )
n
NIPRL
2.6.2 Linear Combinations of Random Variables
(3/5)
1 1 1 1
E ( X ) E X 1 X n E ( X 1 ) E ( X n )
n n n n
1 1
n n
2 2
1 1 1 1
Var( X ) Var X 1 X n Var( X 1 ) Var( X n )
n n n n
2 2
1 2
2
1 2
n n n
NIPRL
2.6.2 Linear Combinations of Random Variables
(4/5)
• Example 21
– The standardized scores of the two tests are
10 5 50
Y1 X 1 and Y2 X 2
3 3 3
– The final score is
2 1 20 5 50
Z Y1 Y2 X 1 X 2
3 3 9 9 9
NIPRL
2.6.2 Linear Combinations of Random Variables
(5/5)
NIPRL
2.6.3 Nonlinear Functions of a Random Variable
(1/3)
NIPRL
2.6.3 Nonlinear Functions of a Random Variable
(2/3)
– For example, f(x)=
1 E(x)=0.
5
f X ( x) 1 for 0 x 1
f ( x) 0 elsewhere
0 1 x
FX ( x) x for 0 x 1
f(y)=1/
y E(y)=1.71
– Consider 8
Y e X
where 1 Y 2.718
NIPRL
2.6.3 Nonlinear Functions of a Random Variable
(3/3)
• CDF methd
E (Y ) e E ( X ) e0.5 1.649
NIPRL
• Determining the p.d.f. of nonlinear relationship between
r.v.s: f ( x ) Y g ( X ) fY ( y )
X
Given and ,what is ?
x1 , x2 , , xn
If are all its real roots, that is,
y g ( x1 ) g ( x2 ) g ( xn )
n
f X ( xi )
then fY ( y )
i 1 | g '( xi ) |
where g '( x ) dg ( x )
dx
NIPRL
• Example: determinefY ( y )
f X ( x) 1 for 0 x 1 Y e X
f ( x) 0 elsewhere where 1 Y 2.718
y g ( x) e x
ln y x -> one root is possible in 0 x 1
dg
e x y
dx
1 1
fY ( y )
| y| y
NIPRL