Chapter2 Random Variable
Chapter2 Random Variable
O UTLINE
1 R ANDOM VARIABLES .
O UTLINE
1 R ANDOM VARIABLES .
O UTLINE
1 R ANDOM VARIABLES .
O UTLINE
1 R ANDOM VARIABLES .
O UTLINE
1 R ANDOM VARIABLES .
D EFINITION 1.1
A variable that associates a number X (ω) with the outcome ω of a
random experiment is called a random variable.
X :Ω → R
ω → X (ω)
D EFINITION 1.1
A variable that associates a number X (ω) with the outcome ω of a
random experiment is called a random variable.
X :Ω → R
ω → X (ω)
D EFINITION 1.2
A discrete random variable is a random variable with a finite or
countably infinite range. Its values are obtained by counting.
D EFINITION 1.2
A discrete random variable is a random variable with a finite or
countably infinite range. Its values are obtained by counting.
D EFINITION 1.3
A continuous random variable is a random variable with an interval
(either finite or infinite) of real numbers for its range. Its values are
obtained by measuring.
D EFINITION 1.3
A continuous random variable is a random variable with an interval
(either finite or infinite) of real numbers for its range. Its values are
obtained by measuring.
D EFINITION 2.1
For a discrete random variable X with possible values
x 1 , x 2 , . . . , x n , . . . a probability mass function (p.m.f ) is a function
such that
P (X = u) if u ∈ {x 1 , . . . , x n , . . .}
½
f (u) =
0 if u ∉ {x 1 , . . . , x n , . . .}
D EFINITION 2.1
For a discrete random variable X with possible values
x 1 , x 2 , . . . , x n , . . . a probability mass function (p.m.f ) is a function
such that
P (X = u) if u ∈ {x 1 , . . . , x n , . . .}
½
f (u) =
0 if u ∉ {x 1 , . . . , x n , . . .}
D EFINITION 2.1
For a discrete random variable X with possible values
x 1 , x 2 , . . . , x n , . . . a probability mass function (p.m.f ) is a function
such that
P (X = u) if u ∈ {x 1 , . . . , x n , . . .}
½
f (u) =
0 if u ∉ {x 1 , . . . , x n , . . .}
E XAMPLE 1
There is a chance that a bit transmitted through a digital
transmission channel is received in error. Let X denote the number
of bits received in error in 4 bits transmitted. Suppose that the
probabilities are
E XAMPLE 1
There is a chance that a bit transmitted through a digital
transmission channel is received in error. Let X denote the number
of bits received in error in 4 bits transmitted. Suppose that the
probabilities are
0.6
P(X =0) = 0.6561
P(X =1) = 0.2916
0.4
P(X =2) = 0.0486
P(X =3) = 0.0036 0.2
P(X =4) = 0.0001
Total 1.0000 0
0 2 4
E XAMPLE 2
Suppose that a random variable X has a discrete distribution with
the following p.m.f.
(
cu, u = 1, · · · , 5
f (u) =
0, otherwise
E XAMPLE 3
Computers in a shipment of 100 units contain a portable hard drive,
solid-state memory, or both, according to the following table:
Portable Hard Drive
Solid-state memory Yes No
Yes 15 80
No 4 1
Two computers are selected randomly, with replacement, from the
the shipment. What is the probability mass function of the number
of computers in the sample having both Portable Hard Drive and
Solid-state memory?
E XAMPLE 4
A discrete r.v X has the p.m.f as below
X −1 0 1 2
P 0.1 0.3 0.4 0.2
D EFINITION 2.2
The cumulative distribution function (c.d.f) of a discrete random
variable X, denoted as F (x), is
F (x) = P(X ≤ x) =
X
f (x i )
x i ≤x
P ROPOSITION 2.2
For a discrete random variable X , F (x) satisfies the following
properties.
P ROPOSITION 2.2
For a discrete random variable X , F (x) satisfies the following
properties.
1 0 ≤ F (x) ≤ 1.
P ROPOSITION 2.2
For a discrete random variable X , F (x) satisfies the following
properties.
1 0 ≤ F (x) ≤ 1.
2 If x ≤ y, then F (x) ≤ F (y).
P ROPOSITION 2.2
For a discrete random variable X , F (x) satisfies the following
properties.
1 0 ≤ F (x) ≤ 1.
2 If x ≤ y, then F (x) ≤ F (y).
3 F is right continuous: limu→a + F (u) = F (a).
P ROPOSITION 2.2
For a discrete random variable X , F (x) satisfies the following
properties.
1 0 ≤ F (x) ≤ 1.
2 If x ≤ y, then F (x) ≤ F (y).
3 F is right continuous: limu→a + F (u) = F (a).
4 F (−∞) = lim F (x) = 0, F (+∞) = lim F (x) = 1.
x→−∞ x→+∞
P ROPOSITION 2.2
For a discrete random variable X , F (x) satisfies the following
properties.
1 0 ≤ F (x) ≤ 1.
2 If x ≤ y, then F (x) ≤ F (y).
3 F is right continuous: limu→a + F (u) = F (a).
4 F (−∞) = lim F (x) = 0, F (+∞) = lim F (x) = 1.
x→−∞ x→+∞
5 P (a < X ≤ b) = F (b) − F (a) for all a, b ∈ R and a ≤ b.
E XAMPLE 5
Let X be a discrete random variable which is identified by the
following c.d.f.
0, x < −2
0.2, −2 ≤ x < 0
F (x) =
0.7, 0 ≤ x < 2
1, 2 ≤ x
Rb
3 P(a ≤ X ≤ b) = a f (x)d x = area under f(x) from a to b.
C ONTINUOUS D ISTRIBUTION
C ONTINUOUS D ISTRIBUTION
E XAMPLE 6
Suppose that the p.d.f. of X is as
(
cu, 0 < u < 4
f (u) =
0, otherwise
C ONTINUOUS D ISTRIBUTION
E XAMPLE 7
The amount of time in hours that a computer functions before
breaking down is a continuous random variable with probability
density function
(
λe −u/100 , u ≥ 0
f (u) =
0, otherwise
C ONTINUOUS DISTRIBUTION
D EFINITION 3.2
The cumulative distribution function of a continuous random
variable X is Z x
F (x) = P (X ≤ x) = f (u)d u
−∞
for all −∞ ≤ x ≤ ∞.
Note:
C ONTINUOUS DISTRIBUTION
D EFINITION 3.2
The cumulative distribution function of a continuous random
variable X is Z x
F (x) = P (X ≤ x) = f (u)d u
−∞
for all −∞ ≤ x ≤ ∞.
Note:
C ONTINUOUS DISTRIBUTION
D EFINITION 3.2
The cumulative distribution function of a continuous random
variable X is Z x
F (x) = P (X ≤ x) = f (u)d u
−∞
for all −∞ ≤ x ≤ ∞.
Note:
1 P(a < X < b) = P(a < X ≤ b) = P(a ≤ X < b) = P(a ≤ X ≤ b) =
F (b) − F (a)
C ONTINUOUS DISTRIBUTION
D EFINITION 3.2
The cumulative distribution function of a continuous random
variable X is Z x
F (x) = P (X ≤ x) = f (u)d u
−∞
for all −∞ ≤ x ≤ ∞.
Note:
1 P(a < X < b) = P(a < X ≤ b) = P(a ≤ X < b) = P(a ≤ X ≤ b) =
F (b) − F (a)
2
d
F 0 (x) = F (x) = f (x)
dx
C ONTINUOUS DISTRIBUTION
E XAMPLE 8
C ONTINUOUS DISTRIBUTION
E XAMPLE 9
Assume that the lifespan of a new released product (hours) follows
the given c.d.f
(
a
− a if x ≥ 100
F (x) = 100 x
0 if x < 100
where a ∈ R.
(A) Find the p.d.f. of X .
(B) Determine the value of a such that f (x) is defined.
(C) The product will be classified as type A if its lifespan is at least
400 hours. Find the portion of type A.
E XPECTATION
D EFINITION 4.1
The expected value (mean) of a random variable X is
E(X ) = x i P(X = x i )
X X
x i f (x i ) = (discrete)
i i
Z ∞
E(X ) = x f (x)d x (continuous).
−∞
E XPECTATION
D EFINITION 4.1
The expected value (mean) of a random variable X is
E(X ) = x i P(X = x i )
X X
x i f (x i ) = (discrete)
i i
Z ∞
E(X ) = x f (x)d x (continuous).
−∞
E XPECTATION
D EFINITION 4.1
The expected value (mean) of a random variable X is
E(X ) = x i P(X = x i )
X X
x i f (x i ) = (discrete)
i i
Z ∞
E(X ) = x f (x)d x (continuous).
−∞
E XPECTATION
I NTERPRETATION OF M EAN
E XPECTATION
I NTERPRETATION OF M EAN
A weighted average of the possible values of X , with each value
weighted by the probability that X assumes it. ==> E(X )
describes the "center" or the "balance" point of the
distribution.
E XPECTATION
I NTERPRETATION OF M EAN
A weighted average of the possible values of X , with each value
weighted by the probability that X assumes it. ==> E(X )
describes the "center" or the "balance" point of the
distribution.
The average value of X over a large number of replications of
the experiment is approximately E[X ].
E XPECTATION
P ROPOSITION 4.1
Properties of Expectation
1 E(C ) = C .
2 Expectation is linear: E(aX + b) = a E(X ) + b and
E(X + Y ) = E(X ) + E(Y )
3 If X and Y are two independent variables, then
E(X Y ) = E(X )E(Y ).
E XPECTATION
E XAMPLE 10
A roulette wheel has the numbers 1 through 36, as well as 0 and 00.
If you bet $1 that an odd number comes up, you win or lose $1
according to whether that event occurs. If X denotes your net gain,
find E(X ).
E XPECTATION
E XAMPLE 11
Find E[X ] when the density function of X is
(
2u, 0 ≤ u ≤ 1
f (u) =
0, otherwise
D EFINITION 4.2
The expected value of a random variable X 2 is called the second
moment of X that is computed by
E(X 2 ) = u 2 f (u)
X
(discrete)
u
Z ∞
E(X 2 ) = u 2 f (u)d u (continuous).
−∞
E XAMPLE 12
Let X denote a random variable that takes on any of the values -1, 0,
and 1 with respective probabilities
Compute E(X 2 ).
E XAMPLE 12
Let X denote a random variable that takes on any of the values -1, 0,
and 1 with respective probabilities
Compute E(X 2 ).
E XAMPLE 13
Let X be the current measured in mA. The PDF is f (x) = 0.05 for
0 ≤ x ≤ 20. What is the expected value of power when the resistance
is 100 ohms? Use the result that power in watts P = 10−6 R I 2 , where
I is the current in milliamperes and R is the resistance in ohms.
P ROPOSITION 4.2
In general, for any function g (u) and random variable X :
E[g (X )] =
X
g (x) f (x) (discrete)
x
Z ∞
E[g (X )] = g (x) f (x)d x (continuous).
−∞
E XAMPLE 14
There is a chance that a bit transmitted through a digital
transmission channel is received in error. X is the number of bits
received in error of the next 4 transmitted. The probabilities are
E XAMPLE 15
The time, in hours, it takes to locate and repair an electrical
breakdown in a certain factory is a random variable X whose
density function is given by
(
1, if 0 < u < 1
f (u) =
0, otherwise
P ROPOSITION 4.3
If X is a discrete r.v, the variance of X is:
à !
∞ ∞
2
V (X ) = (x i − E(X )) f (x i ) = x i f (x i ) − E(X )2
2
X X
i =1 i =1
Z+∞ Z+∞
2
V (X ) = (x − E(X )) f (x)d x = x 2 f (x)d x − E(X )2
−∞ −∞
P ROPOSITION 4.4
Properties of Variance
1 V(c) = 0 where c is a constant.
P ROPOSITION 4.4
Properties of Variance
1 V(c) = 0 where c is a constant.
2 Variance and standard deviation are not linear
P ROPOSITION 4.4
Properties of Variance
1 V(c) = 0 where c is a constant.
2 Variance and standard deviation are not linear
M EDIAN
D EFINITION 4.5
For a continuous r.v, X , defined by the p.d.f f , the median
md (X ) = m can be found by solving
Z m
f (x)d x = 0.5
−∞
.
For a discrete r.v, X , the median md (X ) = m is a value such that
E XAMPLE 16
Let consider X be a discrete random variable with the given
distribution.
X a 0.1 0.3 0.4 2
P 0.3 0.2 0.2 b 0.1
E XAMPLE 17
Suppose X has the following pdf, where c is a constant to be
determined (
c(1 − u 2 ), −1 ≤ u ≤ 1
f (u) =
0, otherwise
Compute E(X ), V(X ), and md (X ).
J OINT DISTRIBUTION
D EFINITION 5.1
The joint probability mass function of the discrete random
variables X and Y denoted as f X Y (u, v) satisfies
f X Y (u, v) = P (X = u, Y = v).
D EFINITION 5.1
The joint probability mass function of the discrete random
variables X and Y denoted as f X Y (u, v) satisfies
f X Y (u, v) = P (X = u, Y = v).
E XAMPLE 18
A mobile web site is accessed from a smart phone; X is the signal
strength, in number of bars, and Y is response time, to the nearest
second.
y = Response time x = Number of Bars
(nearest second) of Signal Strength Determine
1 2 3 Total
1 0.01 0.02 0.25 0.28
A P (X < 3, Y ≤ 2).
2 0.02 0.03 0.20 0.25 B P (X < 3|Y ≤ 2).
3 0.02 0.10 0.05 0.17
4 0.15 0.10 0.05 0.30 C P (Y ≤ 2|X < 3).
Total 0.20 0.25 0.55 1.00
f X (u) = P (X = u)
X
= P (X = u, Y = v)
v
X
= f X Y (u, v)
v
f X (u) = P (X = u)
X
= P (X = u, Y = v)
v
X
= f X Y (u, v)
v
D EFINITION 5.2
Considering a random vector (X , Y ), if X has the marginal
probability distribution f X (x), then
∞
E(X ) =
X
x i f X (x i )
i =1
and
à !
∞ ∞
2
V(X ) = (x i − E(X )) f X (x i ) = x i2 f X (x i ) − E(X )2
X X
i =1 i =1
D EFINITION 5.3
If a random vector (X , Y ) has the joint probability mass function
f X Y (x, y), then
E(X Y ) =
XX
x i y j f X Y (x i , y j )
i j
và
E(h(X , Y )) =
XX
h(x i , y j ) f X Y (x i , y j )
i j
I NTERPRETION OF COVARIANCE :
Covariance is a measure of linear relationship between the random
variables.
P ROPERTIES OF COVARIANCE :
1 Cov(X , X ) = V(X )
2 Cov(X , aY + b) = a Cov(X , Y )
3 Cov(X , Y + Z ) = Cov(X , Y ) + Cov(X , Z )
4 If X and Y independent, Cov(X , Y ) = 0.
D EFINITION 5.4
Correlation between X and Y is
Cov(X , Y ) σX Y
Cor (X , Y ) = ρ X Y = p =
V(X )V(Y ) σ X σY
P (X = x, Y = y i ) f X Y (x, y i )
f X |y i = P (X = x|Y = y i ) = =
P (Y = y i ) f Y (y i )
Similarly,
P (X = x i , Y = y) f X Y (x i , y)
f Y |xi = P (Y = y|X = x i ) = = .
P (X = x i ) f X (x i )
D EFINITION 5.6
For random variables X and Y , if any one of the following
properties is true, the others are also true, and X and Y are
independent.
1 f X Y (x, y) = f X (x) f Y (y) for all x and y.
2 f Y |x (y) = f Y (y) for all x and y with f X (x) > 0.
3 f X |y (x) = f X (x) for all x and y with f Y (y) > 0.
4 P (X ∈ A, Y ∈ B ) = P (X ∈ A)P (Y ∈ B ) for any sets A and B in the
range of X and Y, respectively.
E XAMPLE 19
Given random variables X and Y with the joint probability
distribution f X Y (x, y) as below
X =x
Y =y 1 2 3
0 0.1 0.15 a
1 0.2 b 0.4
E XAMPLE 20
A mobile web site is accessed from a smart phone; X is the signal
strength, in number of bars, and Y is response time, to the nearest
second.
y = Response time x = Number of Bars
(nearest second) of Signal Strength
1 2 3
1 0.01 0.02 0.25
2 0.02 0.03 0.20
3 0.02 0.10 0.05
4 0.15 0.10 0.05
(A) Compute the mean and the variance of X .
(B) Compute E(X Y ).
(C) Are X and Y independent?
Dr. Phan Thi Huong Probability and Statistics