2-Random Variables
2-Random Variables
TeacherµQiang Ma(êr)
maqiang809@scu.edu.cn
Random Variables and Probability Distributions
Contents
1 Random variables
Random variables
Motivation:
definition, computation and properties of probability
P (.): only set function, not real function
Can we use real functions to solve probability?
Yes, we need random variable and distribution function
Definition 1
A random variable is a function that associates a real number with each
element in the sample space, which can be denoted by X, Y, Z.
Example 3
Consider the simple condition in which components are arriving from the
production line and they are stipulated to be defective or not defective.
Define the random variable X by
1, defective
X=
0, not defective
Definition 5
If a sample space contains a finite number of possibilities or an unending
sequence with as many elements as there are whole numbers, it is called a
discrete sample space.
Definition 7
The set of ordered pairs (x, f (x)) is a probability function of the discrete
random variable X if, for each possible outcome x,
1 f (x) ≥ 0.
P
x f (x) = 1.
2
3 P (X = x) = f (x).
Random Variables and Probability Distributions
Discrete random distribution
Example 8
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 distribution for the number of detectives.
Random Variables and Probability Distributions
Discrete random distribution
Example 8
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 distribution for the number of detectives.
Solution: Let X be a random variable whose values x are the possible
numbers of defective computers purchased by the school. Then x can
only take the numbers 0, 1, and 2. Now
17 3 17 3
2 0 68 1 1 51
P (X = 0) = f (0) = = , P (X = 1) = f (1) = = ,
20 95 20 190
2 2
17 3
0 2 3
P (X = 2) = f (2) = = ,
20 190
2
Random Variables and Probability Distributions
Discrete random distribution
Example 8
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 distribution for the number of detectives.
Solution: Let X be a random variable whose values x are the possible
numbers of defective computers purchased by the school. Then x can
only take the numbers 0, 1, and 2. Now
17 3 17 3
2 0 68 1 1 51
P (X = 0) = f (0) = = , P (X = 1) = f (1) = = ,
20 95 20 190
2 2
17 3
0 2 3
P (X = 2) = f (2) = = ,
20 190
2
x 0 1 2
68 51 3
f (x)
95 190 190
Random Variables and Probability Distributions
Discrete random distribution
There are many problems where we may wish to compute the proba-
bility that the observed value of a random variable X will be less than
or equal to some real number x.
Writing F (x) = P (X ≤ x) for every real number x, we define F (x)
to be the cumulative distribution function of the random variable X.
Definition 9
The cumulative distribution function(CDF) F (x) of a discrete random vari-
able X with probability distribution f (x) is
X
F (x) = P (X ≤ x) = f (t), for − ∞ < x < ∞.
t≤x
Properties of CDF
2 Monotonicity: non-decreasing
∀x1 < x2 , F (x1 ) ≤ F (x2 )
3 Continuity: right continuous
F (x0 + 0) = lim+ F (x) = F (x0 )
x→x0
Definition 10
The function f (x)is a probability density function(pdf) for the continuous
random variable X, defined over the set of real numbers, if
1 f (x) ≥ 0, for all x ∈ R.
R∞
2
−∞
f (x) = 1.
Rb
3 P (a < X < b) = a f (x)dx.
Definition 11
The cumulative distribution function F (x) of a continuous random variable
X with density function f (x) is
Z x
F (x) = P (X ≤ x) = f (x)dx, for − ∞ < x < ∞.
−∞
Example 12
Suppose that the error in the reaction temperature, in ◦ C, for a controlled
laboratory experiment is a continuous random variable X having the prob-
ability density function
x2
f (x) = , −1 < x < 2,
0,3 elsewhere.
Example 13
The proportion of people who respond to a certain mail-order solicitation
is a continuous random variable X that has the density function
2(x + 2)
, 0 < x < 1,
f (x) =
0, 5elsewhere.
Definition 14
The function f (x, y) is a joint probability distribution of the discrete ran-
dom variables X and Y if
1 f (x, y) ≥ 0 for all (x, y),
P P
y f (x, y) = 1
2
x
3P (X = x, Y = y) = f (x, y)
PP
For any region A in the xy plane, P [(X, Y ) ∈ A] = A f (x, y).
Example 15
Two ballpoint pens are selected at random from a box that contains 3
blue pens, 2 red pens, and 3 green pens. If X is the number of blue pens
selected and Y is the number of red pens selected, find
1 The joint probability function f(x, y),
2 P [(X, Y ) ∈ A], where A is the region {(x, y)|x + y ≤ 1}.
Random Variables and Probability Distributions
Joined Probability Distributions
Solution: (a)
Definition 16
The function f (x, y) is a joint density function of the continuous random
variables X and Y if
1 f (x, y) ≥ 0, for all (x, y),
R∞ R∞
2
−∞ −∞
f (x, y)dxdy = 1
RR
3 P [(X, Y ) ∈ A] = A
f (x, y)dxdy, for any region A in the xy plane.
Random Variables and Probability Distributions
Joined Probability Distributions
Example 17
A privately owned business operates both a drive-in facility and a walk-in
facility. On a randomly selected day, let X and Y , respectively, be the
proportions of the time that the drive-in and the walk-in facilities are in
use, and suppose that the joint density function of these random variables
is (2
(2x + 3y), 0 ≤ x ≤ 1, 0 ≤ y ≤ 1,
f (x, y) = 5
0 elsewhere
Definition 18
The marginal distributions of X alone and of Y alone are
X X
g(x) = f (x, y), h(y) = f (x, y)
y x
x 0 1 2
The marginal distribution of X is 5 15 3
f (x)
14 28 28
y 0 1 2
and the marginal distribution of Y is 15 3 1
f (y)
28 7 28
Random Variables and Probability Distributions
Joined Probability Distributions
Definition 19
Let X and Y be two random variables, discrete or continuous. The con-
ditional distribution of the random variable Y given that X = x is
f (x, y)
f (y|x) = ,
g(x)
provided g(x) > 0. Similarly, the conditional distribution of X given that
Y = y is
f (x, y)
f (x|y) = ,
h(y)
provided h(y) > 0.
Random Variables and Probability Distributions
Joined Probability Distributions
Example 20
The joint density for the random variables (X, Y ), where X is the unit
temperature change and Y is the proportion of spectrum shift that a certain
atomic particle produces, is
(a) Find the marginal densities g(x), h(y), and the conditional density
f (y|x).
(b) Find the probability that the spectrum shifts more than half of the
total observations, given that the temperature is increased by 0.25
unit.
Random Variables and Probability Distributions
Joined Probability Distributions
Now
f (x, y) 3y 2
f (y|x) = = , 0 < x < y < 1.
g(x) 1 − x3
(b) Therefore,
1 1
3y 2
Z Z
1 8
P (Y > |X = 0.25) = f (y|x = 0.25)dy = 3
dy =
2 1/2 1/2 1 − 0.25 9
Random Variables and Probability Distributions
Joined Probability Distributions
Definition 21
Let X and Y be two random variables, discrete or continuous, with joint
probability distribution f (x, y) and marginal distributions g(x) and h(y),
respectively. The random variables X and Y are said to be statistically
independent if and only if
f (x, y) = g(x)h(y)
for all (x, y) within their range.
Random Variables and Probability Distributions
Joined Probability Distributions
Example 22
Suppose that the shelf life, in years, of a certain perishable food product
packaged in cardboard containers is a random variable whose probability
density function is given by
−x
e , x>0
f (x) =
0 elsewhere
Let X1 , X2 ,and X3 represent the shelf lives for three of these containers
selected independently and find P (X1 < 2, 1 < X2 < 3, X3 > 2).
Random Variables and Probability Distributions
Joined Probability Distributions
Example 22
Suppose that the shelf life, in years, of a certain perishable food product
packaged in cardboard containers is a random variable whose probability
density function is given by
−x
e , x>0
f (x) =
0 elsewhere
Let X1 , X2 ,and X3 represent the shelf lives for three of these containers
selected independently and find P (X1 < 2, 1 < X2 < 3, X3 > 2).
Solution: We can assume that the random variables X1 , X2 ,and X3 are
statistically independent, having the joint probability density
f (x1 , x2 , x3 ) = f (x1 )f (x2 )f (x3 ) = e−x1 e−x2 e−x3 = e−x1 −x2 −x3 ,