You are on page 1of 16

Nodule 1b: Random variables

NOTES







Stat130
Nrs. Narian T. Reyes
Lecturer
School of Statistics
University of the Philippines
Diliman QC

Random variable
Definition.
Let S be the sample space of an
experiment. A real-valued function X
that maps each element s S onto the
set of real numbers is called a random
variable of the experiment if for each
interval ! {s: X(s) !) is an event.
X: S


Random variables
An experiment consists of throwing a green
die and a red die. What are the possible
outcomes (x,y) if x is the outcome of the
green die and y is the outcome on the red
die?
Suppose that our interest lies in
the sum of the spots on the two
dice. What are the possible
values of this random variable?


Types of Probability Set
Functions
Discrete Probability Set Function
- Any probability function defined on a sample space
containing either a finite or a countably infinite (has a
1-to-1 correspondence with
+
)number of outcomes
- Suppose that the sample space for a given experiment
is either finite or countably infinite. Then any probability
function P such that
is called a discrete probability function. The probability
of any event A is the sum of the probabilities associated
with the outcomes in A
all s S
(a) ( ) 0 ;
(b) P(s) = 1
P S s S

s A
( ) ( )
all
P A P s

=



Discrete Probability Function
Show that
qualifies as a discrete probability function.
1
( ) , 0,1, 2,..., 0
1 1
s
P s s


| |
= = >
|
+ +
\ .
No. 2.4.4 page 41


Discrete Probability Function
For any outcome in the sample space S =
{ss = 2, 3, +, .), let
Find the value of k so that P(s) qualifies as a
discrete probability function.
2
( ) , 2, 3,...
3
s
P s k s
| |
= =
|
\ .
No. 2.4.6 page 41


Random variables
Discrete Random Variables
- A random variable defined on a discrete sample space
is called a discrete random variable and a probability
set function for a discrete random variable is called a
PROBAB!L!TY NASS FUNCT!ON.
- A PNF is a table or a formula that lists down all the
possible values of the random variable, along with the
associated probabilities. Of course, PNF's satisfy the
following properties:
1 2
1
(a) ( ) 0, 1, 2,3,...; ( ) 0 { , ,...}
(b) ( ) 1
(c) ( ) ( )
i
i
i
i i
P x i P x x x x
P x
p x P X x

=
= =
=
= =



Random variables
(1,1) (1,2) (1,3) (1,+) (1,5) (1,6)
(2,1) (2,2) (2,3) (2,+) (2,5) (2,6)
(3,1) (3,2) (3,3) (3,+) (3,5) (3,6)
(+,1) (+,2) (+,3) (+,+) (+,5) (+,6)
(5,1) (5,2) (5,3) (5,+) (5,5) (5,6)
(6,1) (6,2) (6,3) (6,+) (6,5) (6,6)
G
R
E
E
N
R E D
1
2
3
+
5
6
1 2 3 + 5 6
2 3 + 5 6 7
3 + 5 6 7 8
+ 5 6 7 8 9
5 6 7 8 9 10
6 7 8 9 10 11
7 8 9 10 11 12
Write down the PNF of the random
variable associated with the sum of the
spots on the two dice.


Random variables
(1,1) (1,2) (1,3) (1,+) (1,5) (1,6)
(2,1) (2,2) (2,3) (2,+) (2,5) (2,6)
(3,1) (3,2) (3,3) (3,+) (3,5) (3,6)
(+,1) (+,2) (+,3) (+,+) (+,5) (+,6)
(5,1) (5,2) (5,3) (5,+) (5,5) (5,6)
(6,1) (6,2) (6,3) (6,+) (6,5) (6,6)
G
R
E
E
N
R E D
1
2
3
+
5
6
1 2 3 + 5 6
1 2 3 + 5 6
2 2 3 + 5 6
3 3 3 + 5 6
+ + + + 5 6
5 5 5 5 5 6
6 6 6 6 6 6
Write down the PNF of the random
variable associated with the maximum of
the two numbers obtained.


Random variables
(1,1) (1,2) (1,3) (1,+) (1,5) (1,6)
(2,1) (2,2) (2,3) (2,+) (2,5) (2,6)
(3,1) (3,2) (3,3) (3,+) (3,5) (3,6)
(+,1) (+,2) (+,3) (+,+) (+,5) (+,6)
(5,1) (5,2) (5,3) (5,+) (5,5) (5,6)
(6,1) (6,2) (6,3) (6,+) (6,5) (6,6)
G
R
E
E
N
R E D
1
2
3
+
5
6
1 2 3 + 5 6
0 1 2 3 + 5
1 0 1 2 3 +
2 1 0 1 2 3
3 2 1 0 1 2
+ 3 2 1 0 1
5 + 3 2 1 0
Write down the PNF of the random
variable associated with the absolute value
of the difference of the two numbers.


Discrete Random variables
A game consists of drawing two chips at random
from an urn that contains five red, five white, and
five blue chips. For each blue chip drawn, the player
wins $1, for each white chip, he wins $2, but for
each red chip, he loses $3. !f X is the random
variable that represents the gain or loss when playing
this game, what are the possible values of X and the
probabilities associated with them? Summarize the
probability mass function of X in the form of a table.


Discrete Random variables
Three balls are to be randomly selected without
replacement from an urn containing 20 balls
numbered 1 through 20. The random variable X is
the largest number in the selection. Write down the
probability mass function of X. !f we bet that at least
one of the drawn balls has a number as large as or
larger than 17, what is the probability that we will
win?


Discrete Random variables
!n the United States, the number of
twin births is approximately 1 in 90. Let
X be the random variable that
represents the number of births in a
certain hospital until the first twins are
born. Write down the probability mass
function of X.


Types of Probability Set
Functions
Continuous Probability Set Function
- These apply to situations where the number of
outcomes in S is uncountably infinite, in which case the
sample space probability is essentially smeared" over
the real number line, or over some interval of the real
number line.
- !f S is a sample space with an uncountable number of
outcomes and if f is a real-valued function defined on S,
then f is said to be a continuous probability function if
!f A is any event defined on S, it must be that
S
(a) ( ) 0 ;
(b) ( ) 1
f x x S
f x dx

=
}
( ) ( )
A
P A f x dx =
}


Random variables
Continuous Random Variables
- Any random variable defined on a continuous sample
space is a continuous random variable and a function
is called a PROBAB!L!TY DENS!TY FUNCT!ON for the
continuous random variable X, defined over the set of
real numbers if
(a) ( ) 0 ;
(b) ( ) 1
(c) ( ) ( ) for any subset of real numbers A
A
f x x
f x dx
P X A f x dx


=
=
}
}

: [0, ) f


Continuous Probability
Function
Show that
qualifies as a continuous probability function.
Find the value of m so that
( ) 6 (1 ), 0 1
0 elsewhere
f x x x x = < <
=
1
( )
2
P X m =


Continuous Probability
Function
1 2 3 4 5 6
1
2
3
x
y
!dentify the probability
function whose graph
appears here.
No. 2.5.2 page 49


Continuous Probability
Function
Sketch the graph of the continuous
probability function
1 1
( ) 3 1 5
2 4
0 elsewhere
f x x x =
=


Continuous Random variables
1 2
1
2
x
y
No. 3.2.11 page 12S
Let Y be a continuous random variable
described by the PDF
2
( ) 3(1 ) , 0 1
Find
1 1
( )
2 4
f y y y
P Y
= < <
>


Continuous Probability
Function
Find the value of c so that
qualifies as a continuous probability function.
2
( ) , 1 1
1
0 elsewhere
c
f x x
x
= < <

=


Cumulative Distribution
Function
!f X is a random variable, then the
function F defined on (-,) by F(t) =
P(X t) is called the cumulative
distribution function of X.


Cumulative Distribution
Function
A coin is tossed two consecutive times. The
random variable X represents the number
of heads in two tosses. Write down the CDF
of X. Sketch its graph


Cumulative Distribution
Function
Since F accumulates all of the probabilities
of the values of X up to and including t, it
has the following properties:
F is non-decreasing
F is right-continuous.
lim ( ) 0
t
F t

=
lim ( ) 1
t
F t

=


Cumulative Distribution
Function Summary Table
F(b
-
) - F(a
-
) a X < b
F(b) - F(a
-
) a X b
F(b
-
) - F(a) a < X < b
F(b) - F(a) a < X b
F(a) - F(a
-
) X = a
1 - F(a
-
) X a
F(a
-
) X < a
1 - F(a) X > a
F(a) X a
Probability of Event Event Concerning X


Cumulative Distribution
Function
Example. A die is loaded in such a way
that the probability associated with a
given face is directly proportional to the
number on that face. Find the
probability function of X, the number
appearing on the face when the die is
rolled once, and find the CDF of X.


Cumulative Distribution
Function
!n the United States, the number of
twin births is approximately 1 in 90.
Let X be the random variable that
represents the number of births in a
certain hospital until the first twins
are born. Write down the CDF of X.


Cumulative Distribution
Function
Find the CDF of the random variable Y
whose density function is
No. 3.4.3 page 14S
3 (1 ) 0 1
( )
1
2 3
2
and zero elsewhere
y y y
f y
y



Cumulative Distribution
Function
1 2 3 4
1
1
2
x
y
0 0
0 1
4
1
( ) 1 2
2
1
2 3
12 2
1 3
x
x
x
F x x
x
x
x
<

<

= <

+ <

Example.
Find:
(a)P(X < 2)
(b)P(X = 2)
(c)P(1 X < 3)
(d) P(X > 3f2)
(e) P(X = 5f2)
(f) P(2 < X 7)


Cumulative Distribution
Function
!f the density function of a continuous
random variable X is continuous then
This follows from the Fundamental
Theorem of Calculus
Therefore, the CDF of continuous random
variables are integrals of their derivatives.
'( ) ( ) ( )
d
F x F x f x
dx
= =
( ) ( )
t
d
f x dx f t
dt

=
}


Cumulative Distribution
Function
Find P( < Y < ) for
No. 3.4.10 page 151
2
0 0
( ) 0 1
1 1
y
F y y y
y
<

= <



Cumulative Distribution
Function
The sales of a snack store on a randomly selected day are X
thousand dollars, where X is a random variable with CDF
Suppose that this snack store's total sales on any given day
are less than $2000. Find the value of k.
Then find P(A) = P( X 3f2) and P(B) = P(X > 1). Are A
and B independent?
2
2
0 0
0 1
( )
2
(4 ) 1 2
1 2
t
t
t
F t
k t t t
t
<

<
=

<



Joint Distributions: The
Bivariate Case
Jointly Discrete {Bivariate) Probability
Functions
Let X and Y be two discrete random variables
defined on the same sample space. Let the
sets of possible values of X and Y be A and B
respectively. The function
P(x,y) = P(X = x, Y = y)
is called the joint probability function of X and Y.
P(x,y) satisfies the following properties:
(a) P(x,y) 0
(b)
,
( , ) 1
x A y B
P x y

=



Jointly Discrete Probability
Functions
Let X and Y have the
joint probability
distribution function :
Find
(a) P(X = 1, Y = 2)
(b) P(X = 0, 1 Y 3)
(c) P(X + Y 1)
(d) P(X > Y)
0 0 3
0 2
1
0
2 1 0
Y
X
1
12
1
6
1
24
1
4
1
4
1
40
1
8
1
20
1
120


Jointly Discrete Probability
Functions
Let X and Y have joint probability function
P(x,y). Let P(x) be the probability function of
X. Then
Similarly, P(y), the probability function of Y
is obtained as
( ) ( ) ( , ) ( , ) ( , )
y B y B
P x P X x P X x Y B P X x Y y P x y

= = = = = = = =

( ) ( ) ( , ) ( , ) ( , )
x A x A
P y P Y y P X A Y y P X x Y y P x y

= = = = = = = =



Jointly Discrete Probability
Functions
Definition.
Let X and Y have joint probability function
P(x,y). Let A be the set of possible values of X
and B be the set of possible values of Y. Then
the individual functions
are called the marginal probability
distribution functions of X and Y,
respectively.
( ) ( , ) and ( ) ( , )
y B x A
P x P x y P y P x y

= =



Narginal Distributions and
!ndependence
Case 1. Narginal distributions for jointly
discrete probability functions
The random variables X and Y are said to be
independent if and only if
for all (x,y) in their range.
( ) ( , ) and ( ) ( , )
y B x A
P x P x y P y P x y

= =

( , ) ( ) ( ) P x y P x P y =


Narginal Distributions and
!ndependence
A supermarket has two
express lines. Let X and Y
denote the number of
customers in the first and in
the second, respectively, at
any given time. During non-
rush, the joint probability
distribution function of X and
Y is summarized in the
following table. Find the
marginal distributions of X
and Y and determine if X and
Y are independent. 0.05
0.025
0 0 3
0.025
0.05 0.05
0 2
0
0.05 0.25 0.20
1
0 0 0.20
0.10
0
3 2 1 0
Y
X


Narginal Distributions and
!ndependence
!f the joint probability distribution of X
and Y is given by
determine the marginal distributions of X
and Y. Determine if X and Y are
independent.
( )
( , ) for x = 0,1,2,3; y =0,1,2
30
x y
P x y
+
=


Jointly Continuous Density
Functions
The function f(x,y) is called the joint
probability density function of X
and Y and it satisfies the following
properties:
( ) ( , ) 0
( ) ( , ) 1
a f x y
b f x y dxdy

=
} }


Jointly Continuous Density
Functions
Definition.
Let X and Y have joint probability density
function f(x,y). Then the individual probability
density functions of X and Y may be obtained
by
These are called the marginal distributions
of X and Y, respectively.
( ) ( , ) f x f x y dy

=
}
( ) ( , ) f y f x y dx

=
}


Narginal Distributions and
!ndependence
Case 2. Narginal distributions for
jointly continuous probability density
functions
The random variables X and Y are said
to be independent if and only if
( ) ( , ) and f ( ) ( , ) f x f x y dy y f x y dx


= =
} }
( , ) ( ) ( ) f x y f x f y =


Narginal Distributions and
!ndependence
A privately owned liquor store operates both a drive-
up 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-up and walk-in
facilities are in use and suppose that the joint density
function of these random variables is given by
(a) Find the marginal density of X.
(b) Find the marginal density of Y.
(c) Find the probability that the drive-in facility is
busy less than one-half of the time.
(d) Determine if X and Y are independent.
2
( 2 ) 0 1, 0 1
( , ) 3
0
x y x y
f x y
elsewhere

+ < < < <


=



Narginal Distributions and
!ndependence
Stores A and B, which belong to the same
owner, are located in two different towns.
!f the probability density function of the
weekly profit of each store in $000 is
given by
and the profit of one store is independent
of the other, what is the probability that
next week, one store makes at least $500
more than the other store?
1 3
( ) 4
0
x
x
f x
elsewhere

< <



Jointly Continuous Density
Functions
A candy company distributes boxes of chocolates
with a mixture of creams, toffees, and cordials.
Suppose that the weight of each box is 1 kilogram,
but the individual weights of the creams, toffees, and
cordials vary from box to box. For a randomly
selected box, let X and Y represent the weights of the
creams and the toffees, respectively, and suppose
that the joint density function of these variables is
given by
Find the probability that in a given box the cordials
account for more than of the weight.
24 0 1, 0 1, 1
( , )
0
xy x y x y
f x y
elsewhere
+
=



Jointly Continuous Density
Functions
Let X denote the reaction time, in seconds, to
a certain stimulant and Y denote the
temperature in (
o
F) at which a certain reaction
starts to take place. Suppose that two random
variables X and Y have the joint density given
by
(a) Find P(0 < X < , < Y < )
(b) Find P(X < Y)
(c) Show that X and Y are !!D.
4 0 1, 0 1
( , )
0
xy x y
f x y
elsewhere
< < < <
=



Jointly Continuous Density
Functions
Let X denote the diameter of an armored
electric cable and Y denote the diameter of the
ceramic mold that makes the cable. Both X and
Y are scaled so that they range between 0 and
1. Suppose that X and Y have the joint density
given by
Find P(X + Y > ).
1
0 1
( , )
0
x y
y f x y
elsewhere

< < <



Jointly Continuous Density
Functions
Suppose that X and Y have the joint
density function
Find
0 1, 0 1
( , )
0
x y x y
f x y
elsewhere
+ < < < <
=

( ) P X Y >