You are on page 1of 54

Random Variables Discrete Probability Distributions Continuous Random Variables

Lecture 3: Probability Distributions and


Probability Densities - 1

Assist. Prof. Dr. Emel YAVUZ DUMAN

MCB1007 Introduction to Probability and Statistics


İstanbul Kültür University
Random Variables Discrete Probability Distributions Continuous Random Variables

Outline

1 Random Variables

2 Discrete Probability Distributions

3 Continuous Random Variables


Random Variables Discrete Probability Distributions Continuous Random Variables

Outline

1 Random Variables

2 Discrete Probability Distributions

3 Continuous Random Variables


Random Variables Discrete Probability Distributions Continuous Random Variables

Definition 1
If S is a sample space with a probability measure and X is a
real-valued function defined over the elements of S, then X is
called a random variable (or stochastic variable).
In this course we shall always denote random variables by capital
letters such as X , Y etc., and their values by the corresponding
lowercase letters such as x and y , respectively.
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 2
Suppose that a coin is tossed twice so that the sample space is
S = {HH, HT , TH, TT }. Let X represent the number of heads
that can come up. With each sample point we can associate a
number for X as shown in the table:

Sample Point HH HT TH TT
1 1 1 1
Probability 4 4 4 4
x 2 1 1 0

Thus, for example, in the case of HH (i.e., 2 heads), X = 2 while


for TH (1 head), X = 1. It follows that X is a random variable.
Also, we can write P(X = 2) = 14 , P(X = 1) = 14 + 14 = 12 , and
P(X = 0) = 14 .
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 3

A balanced coin is tossed four times. List the elements of the


sample space that are presumed to be equally likely, as this is what
we mean by a coin being balanced, and the corresponding values x
of the random variable X , the total number of heads.
Solution. If H and T stand for heads and tails, the results are as
shown in the following table:
Random Variables Discrete Probability Distributions Continuous Random Variables

Elements of Proba- Elements of Proba-


sample space bility x sample space bility x
1 1
HHHH 16 4 THHT 16 2
1 1
HHHT 16 3 THTH 16 2
1 1
HHTH 16 3 TTHH 16 2
1 1
HTHH 16 3 HTTT 16 1
1 1
THHH 16 3 THTT 16 1
1 1
HHTT 16 2 TTHT 16 1
1 1
HTHT 16 2 TTTH 16 1
1 1
HTTH 16 2 TTTT 16 0

1 4
Thus, we can write P(X = 0) = 16 , P(X = 1) = 16 ,
6 4 1
P(X = 2) = 16 , P(X = 3) = 16 and P(X = 4) = 16 .
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 4

Two socks are selected at random and removed in succession from


a drawer containing five brown socks and three green socks. List
the elements of the sample space, the corresponding probabilities,
and the corresponding values x of the random variable X is the
number of brown socks selected.
Solution. If B and G stand for brown and green, then we have
following probabilities
5 4 20 5 3 15
P(BB) = · = , P(BG ) = · = ,
8 7 56 8 7 56
3 5 15 3 2 6
P(GB) = · = , and P(GG ) = · = ,
8 7 56 8 7 56
and the results are shown in the following table:
Elements of Sample Space BB BG GB GG
Probability 20/56 15/56 15/56 6/56
x 2 1 1 0
Random Variables Discrete Probability Distributions Continuous Random Variables

In all of the examples of this section we have limited our discussion


to discrete sample space, and hence to discrete random variable,
namely, random variables whose range is finite or countably
infinite. Continuous random variables defined over continuous
sample spaces will be taken up in the third section.
Random Variables Discrete Probability Distributions Continuous Random Variables

Outline

1 Random Variables

2 Discrete Probability Distributions

3 Continuous Random Variables


Random Variables Discrete Probability Distributions Continuous Random Variables

Definition 5
If X is a discrete random variable, the function given by

f (x) = P(X = x)

for each x within the range of X is called the probability


distribution (or probability function) of X .

Based on the postulates of probability, it immediately follows that


Theorem 6
A function can serve as the probability distribution of a discrete
random variable X if and only if its values, f (x), satisfy the
conditions
1 f (x) ≥ 0 for each value within its domains;

x f (x) = 1, where the summation extends over all the
2

values within its domain.


Random Variables Discrete Probability Distributions Continuous Random Variables

Example 7
Find a formula for the probability distribution of the total number
of heads obtained in four tosses of a balanced coin.
1 4
Solution. We know that P(X = 0) = 16 , P(X = 1) = 16 ,
6 4 1
P(X = 2) = 16 , P(X = 3) = 16 and P(X = 4) = 16 . Observing
that the numerators of these
4 five
4 fractions,
4 4 1, 4,46, 4, and 1, are
the binomial coefficients 0 , 1 , 2 , 3 , and 4 , we find that
the formula for the probability distribution can be written as
4
x
f (x) = for x = 0, 1, 2, 3, 4.
16
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 8
Check whether the function given by
x +2
f (x) = for x = 1, 2, 3, 4, 5
25
can serve as the probability distribution of a discrete random
variable.
3
Solution. Substituting the different values of x, we get f (1) = 25 ,
4 5 6 7
f (2) = 25 , f (3) = 25 , f (4) = 25 , and f (5) = 25 . Since these
values are all nonnegative, the first condition of Theorem 6 is
satisfied, and since
3 4 5 6 7
f (1) + f (2) + f (3) + f (4) + f (5) = + + + + =1
25 25 25 25 25
the second conditions of Theorem 6 is satisfied. Thus, the given
function can serve as the probability distribution of a random
variable having the range {1, 2, 3, 4, 5}.
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 9
Suppose that a pair of fair dice are to be tossed, and let the
random variable X denote the sum of the points. Obtain the
probability distribution for X .

Solution. The random variable X is the sum of the coordinates for


each point. Thus for (3, 2) we have X = 5. Using the fact that all
36 sample points are equally probable, so that each sample point
has probability 1/36.
First Die

Second
Die

The one is red is the sum


Random Variables Discrete Probability Distributions Continuous Random Variables

x 2 3 4 5 6 7 8 9 10 11 12
1 2 3 4 5 6 5 4 3 2 1
f (x) 36 36 36 36 36 36 36 36 36 36 36
Random Variables Discrete Probability Distributions Continuous Random Variables

Figure 1 : Probability Bar Chart


Random Variables Discrete Probability Distributions Continuous Random Variables

Definition 10
If X is a discrete random variable, the function given by

F (x) = P(X ≤ x) = f (t) for − ∞ < x < ∞
t≤x

where f (t) is the value of the probability distribution of X at t, is


called the distribution function, or the cumulative distribution, of
X.
Random Variables Discrete Probability Distributions Continuous Random Variables

Based on the postulates of probability and some of their immediate


consequences, it follows that
Theorem 11
The values F (x) of the distribution function of a discrete random
variable X satisfy the conditions
1 F (−∞) = 0 and F (∞) = 1;
2 if a < b, then F (a) ≤ F (b) for any real numbers a and b.

If we are given the probability distribution of a discrete random


variable, the corresponding distribution function is generally easy
to find.
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 12
Find the distribution function of the total of heads obtained in four
tosses of a balanced coin.
1 4 6 4
Solution. Given f (0) = 16 , f (1) = 16 , f (2) = 16 , f (3) = 16 , and
1
f (4) = 16 from Example 3, it follows that

1
F (0) = f (0) = ,
16
5
F (1) = f (0) + f (1) = ,
16
11
F (2) = f (0) + f (1) + f (2) = ,
16
15
F (3) = f (0) + f (1) + f (2) + f (3) = ,
16
F (4) = f (0) + f (1) + f (2) + f (3) + f (4) = 1.
Random Variables Discrete Probability Distributions Continuous Random Variables

Hence, the distribution function is given by




⎪ 0 for x < 0,



⎪1 0 ≤ x < 1,

⎪ for

⎨5
16
for 1 ≤ x < 2,
F (x) = 16


11
for 2 ≤ x < 3,

⎪ 16

⎪ 15
3 ≤ x < 4,

⎪ 16 for

⎩1 for x ≥ 4.

Observe that this distribution function is defined not only for the
values taken on by the given random variable, but for all real
5
numbers. For instance, we can write F (1.7) = 16 and F (100) = 1,
although the probabilities of getting at most 1.7 heads or at most
100 heads in four tosses of a balanced coin may not be of any real
significance.
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 13
Find the distribution function of the random variable X of Example
4 and plot its graph.

Solution. Based on the probabilities given in the following table

Elements of Sample Space BB BG GB GG


Probability 20/56 15/56 15/56 6/56
x 2 1 1 0
6 15 15 30 20
we can write f (0) = 56 , f (1) = 56 + 56 = 56 , and f (2) = 56 , so
that
6
F (0) = f (0) = ,
56
36
F (1) = f (0) + f (1) = ,
56
F (2) = f (0) + f (1) + f (2) = 1.
Random Variables Discrete Probability Distributions Continuous Random Variables

Hence, the distribution function of X is given by




⎪ 0 for x < 0,


⎨6 for 0 ≤ x < 1,
F (x) = 56


36
for 1 ≤ x < 2,
⎪ 56

⎩1 for x ≥ 2.

F (x)

36/56

6/56
x
0 1 2
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 14
Find the distribution function of the random variable that has the
probability distribution
x
f (x) = for x = 1, 2, 3, 4, 5.
15
1 2 3 4
Solution. Since f (1) = 15 , f (2) = 15 , f (3) = 15 , f (4) = 15 , and
5
f (5) = 15 , then


⎪ 0 for x < 1,



⎪ 1
1 ≤ x < 2,

⎪ for

⎨3
15

15 for 2 ≤ x < 3,
F (x) =


6
for 3 ≤ x < 4,

⎪ 15
⎪ 10
⎪ 4 ≤ x < 5,

⎪ for

⎩1
15
for x ≥5
Random Variables Discrete Probability Distributions Continuous Random Variables

Theorem 15
If the range of a random variable X consists of the values
x1 < x2 < x3 < · · · < xn , then f (x1 ) = F (x1 ) and

f (xi ) = F (xi ) − F (xi −1 ) for i = 2, 3, · · · , n.


Random Variables Discrete Probability Distributions Continuous Random Variables

Example 16
If X has the distribution function F (1) = 0.25, F (2) = 0.61,
F (3) = 0.83, and F (4) = 1 for x = 1, 2, 3, 4, find the probability
distribution of X .
Solution. We have
f (1) = F (1) = 0.25,
f (2) = F (2) − F (1) = 0.61 − 0.25 = 0.36,
f (3) = F (3) − F (2) = 0.83 − 0.61 = 0.22,
f (4) = F (4) − F (3) = 1 − 0.83 = 0.17.
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 17
If X has the distribution function


⎪ 0 for x < −1,



⎪ 1
− 1 ≤ x < 1,
⎨ 4 for
F (x) = 12 for 1 ≤ x < 3,


⎪ 3 for
⎪ 3 ≤ x < 5,

⎪ 4

1 for x ≥ 5.

find
1 P(X ≤ 3), P(X = 3), P(X < 3);
2 P(X ≥ 1);
3 P(−0.4 < X < 4);
4 P(X = 5);
5 the probability distribution of X .
Random Variables Discrete Probability Distributions Continuous Random Variables



⎪0 for x < −1,



⎪ 1
for − 1 ≤ x < 1,
⎨4
F (x) = 1
for 1 ≤ x < 3,


2

⎪ 3
for 3 ≤ x < 5,

⎪ 4

1 for x ≥ 5.

Solution.
1

3
P(X ≤ 3) =
4
3 1 1
P(X = 3) = − =
4 2 4
1
P(X < 3) =
2
Random Variables Discrete Probability Distributions Continuous Random Variables



⎪0 for x < −1,



⎪ 1
for − 1 ≤ x < 1,
⎨4
F (x) = 1
for 1 ≤ x < 3,


2

⎪ 3
for 3 ≤ x < 5,

⎪ 4

1 for x ≥ 5.

2 P(X ≥ 1) = 1 − P(X < 1) = 1 − 1


4 = 34 .
3 P(−0.4 < X < 4) = 4 − 4 = 2.
3 1 1

4 P(X = 5) = 1 − 34 = 14 .
5 f (−1) = 14 , f (1) = 12 − 14 = 14 , f (3) = 3
4 − 1
2 = 14 ,
f (5) = 1 − 34 = 14 , and 0 elsewhere.
Random Variables Discrete Probability Distributions Continuous Random Variables

Outline

1 Random Variables

2 Discrete Probability Distributions

3 Continuous Random Variables


Random Variables Discrete Probability Distributions Continuous Random Variables

Continuous Random Variables

So far we have considered discrete random variables that can take


on a finite or countably infinite number of values. In applications,
we are often interested in random variables that can take on an
uncountable continuum of values; we call these continuous random
variables.
Consider modeling the distribution of the age that a person dies at.
Age of death, measured perfectly with all the decimals and no
rounding, is a continuous random variable (e.g., age of death could
be 87.3248583585642 years). Other examples of continuous
random variables include: time until the occurrence of the next
earthquake in İstanbul; the lifetime of a battery; the annual rainfall
in Ankara.
Random Variables Discrete Probability Distributions Continuous Random Variables

Because it can take on so many different values, each value of a


continuous random variable winds up having probability zero. If I
ask you to guess someone’s age of death perfectly, not
approximately to the nearest millionth year, but rather exactly to
all the decimals, there is no way to guess correctly - each value
with all decimals has probability zero. But for an interval, say the
nearest half year, there is a nonzero chance you can guess
correctly. So, we have the following definition:
Definition 18
A random variable X is called a continuous random variable if
its distribution function F is a continuous function on R, or
equivalently, if

P(X = x) = 0, for every x ∈ R.


Random Variables Discrete Probability Distributions Continuous Random Variables

The definition of probability in the continuous case presumes for


each random variable the existence of a function, called a
probability density function (pdf), such that areas under the curve
give the probabilities associated with the corresponding intervals
along the horizontal axis. In other words, a probability density
function, integrated form a to b (with a ≤ b), gives the probability
that the corresponding random variable will take on a value on the
interval from a to b.
Definition 19
A function with values f (x), defined over the set of all real
numbers, is called a probability density function (pdf) of the
continuous random variable X if and only if

b
P(a ≤ X ≤ b) = f (x)dx
a

for any real constants a and b with a ≤ b.


Random Variables Discrete Probability Distributions Continuous Random Variables

f (x)

x
a b

Figure 2 : P(a ≤ X ≤ b) = area under the density curve between a and


b.

Theorem 20
If X is a continuous random variable and a and b are real
constants with a ≤ b, then

P(a ≤ X ≤ b) = P(a ≤ X < b) = P(a < X ≤ b) = P(a < X < b).


Random Variables Discrete Probability Distributions Continuous Random Variables

Analogous to Theorem 6, let us now state the following properties


of probability densities, which again follow directly from the
postulates of probability.
Theorem 21
A function can serve as a probability density of a continuous
random variable X if its values, f (x), satisfy the conditions
1 f (x) ≥ 0 for −∞ < x < ∞,

−∞ f (x)dx = 1.
2
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 22
The probability density of the continuous random variable X is
given by
1
for 2 < x < 7,
f (x) = 5
0 elsewhere.

1 Draw its graph and verify that the total area under the curve
(above the x-axis) is equal to 1.
2 Find P(3 < X < 5).

Solution.
f (x)

1
5

x
2 7
Random Variables Discrete Probability Distributions Continuous Random Variables


1
5 for 2 < x < 7,
f (x) =
0 elsewhere.

1 It is clear that f (x) ≥ 0 for all x and




2
7

f (x)dx = f (x) dx + f (x) dx + f (x) dx
−∞ −∞  2  7 
0 1 0
5


7
1 1 7 1
= dx = x  = (7 − 2) = 1.
2 5 5 2 5
2




5 5
1 1 5 1
P(3 < X < 5) = f (x)dx = dx = x  = (5 − 3)
3 3 5 5 3 5
2
= .
5
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 23
The pdf of the random variable X is given by

√c
x
for 0 < x < 4,
f (x) =
0 elsewhere.

Find
1 the value of c,
2 P(X < 0.25) and P(X > 1).
Random Variables Discrete Probability Distributions Continuous Random Variables


√c
x
for 0 < x < 4,
f (x) =
0 elsewhere.

Solution.
1 To satisfy the second condition of Theorem 21, we must have



0
4

f (x)dx = f (x) dx + f (x) dx + f (x) dx
−∞ −∞  0  4 
0 √c 0
x



4 4
4 − 12 +1 
c x 
cx − 2 dx = c 1
1
= √ dx = 
0 x 0 −2 + 1
0

= 2c x|40 = 4c = 1

and it follows that c = 1/4.


Random Variables Discrete Probability Distributions Continuous Random Variables


1

4 x
for 0 < x < 4,
f (x) =
0 elsewhere.


0.25
0
0.25
P(X < 0.25) = f (x)dx = f (x) dx + f (x) dx
−∞ −∞  0 
0 1

4 x


0.25
1 1 √ 0.25 1 √
= √ dx = 2 x  = ( 0.25 − 0)
0 4 x 4 0 2
1
= .
4
Random Variables Discrete Probability Distributions Continuous Random Variables


1

4 x
for 0 < x < 4,
f (x) =
0 elsewhere.



4

P(X < 1) = f (x)dx = f (x) dx + f (x) dx
1 1  4 
1
√ 0
4 x


4
1 1 √ 4 1
= √ dx = 2 x  = (2 − 1)
1 4 x 4 1 2
1
= .
2
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 24

If X has the probability density



ke −3x for x > 0,
f (x) =
0 elsewhere,

find k and P(0.5 ≤ X ≤ 1).

Solution. To satisfy the second condition of Theorem 21, we must


have



t
∞ ∞
−3x e −3x 
f (x)dx = ke dx = k lim
−∞ 0 t→∞ −3 
0
k k k
= − lim (e −3t − e 0 ) = − (0 − 1) = = 1
3 t→∞ 3 3
and it follows that k = 3.
Random Variables Discrete Probability Distributions Continuous Random Variables


3e −3x for x > 0,
f (x) =
0 elsewhere,

For the probability we get



1
1
−3x e −3x 
P(0.5 ≤ X ≤ 1) = 3e dx = 3 = −e −3 + e −1.5
0.5 −3 0.5
≈ 0.1733430918.
Random Variables Discrete Probability Distributions Continuous Random Variables

Definition 25
If X is a continuous random variable and the value of its
probability density at t is f (t), then the function given by

x
F (x) = P(X ≤ x) = f (t)dt for − ∞ < x < ∞
−∞

is called the distribution function, or the cumulative


distribution, of X .

The values F (x) of the distribution function of a continuous


random variable X satisfies the conditions: F (−∞) = 0,
F (∞) = 1, and F (a) ≤ F (b) when a < b.
Random Variables Discrete Probability Distributions Continuous Random Variables

Theorem 26
If f (x) and F (x) are the values of the probability density and the
distribution function of X at x, then

P(a ≤ X ≤ b) = F (b) − F (a)

for any real constants a and b with a ≤ b, and

dF (x)
f (x) =
dx
where the derivative exists.
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 27
Find the distribution function of the random variable X of Example
24, and use it to reevaluate P(0.5 ≤ x ≤ 1).

Solution. For x > 0,



x
x x
F (x) = f (t)dt = 3e −3t dt = −e −3t 0 = 1 − e −3x
−∞ 0

and since F (x) = 0 for x ≤ 0, we can write



0 for x ≤ 0,
F (x) = −3x
1−e for x > 0.
Random Variables Discrete Probability Distributions Continuous Random Variables


0 for x ≤ 0,
F (x) =
1 − e −3x for x > 0.

To determine the probability P(0.5 ≤ X ≤ 1), we use the first part


of Theorem 26, getting

P(0.5 ≤ X ≤ 1) = F (1) − F (0.5)


= (1 − e −3 ) − (1 − e −1.5 )
= −e −3 + e −1.5
≈ 0.1733430918.

This agrees with the result obtained by using the probability


density directly in Example 24.
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 28
Find the distribution function of the random variable X whose
probability density is given by


⎨x for 0 < x < 1,
f (x) = 2 − x for 1 ≤ x < 2,


0 elsewhere.
Random Variables Discrete Probability Distributions Continuous Random Variables



⎨x for 0 < x < 1,
f (x) = 2 − x for 1 ≤ x < 2,


0 elsewhere.

Solution. For 0 < x < 1,



x
x
x
t 2  x2
F (x) = f (t)dt = tdt =  = ,
−∞ 0 2 0 2

for 1 ≤ x < 2,

x
1
x
1
x
F (x) = f (t)dt = f (t)dt + f (t)dt = tdt + (2 − t)dt
−∞ 0 1 0 1
 x
t 
2 1 t2 1 x2 1 x2
=  + 2t − = + 2x − − 2 + = − + 2x − 1,
2 0 2 1 2 2 2 2

and for F (x) = 1 where x ≥ 2.


Random Variables Discrete Probability Distributions Continuous Random Variables

So, we have


⎪0 for x ≤ 0,


⎨ x2 for 0 < x < 1,
F (x) = 2

2

⎪− x2 + 2x − 1 for 1 ≤ x < 2,

⎩1 for x ≥ 2.
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 29
Find a probability density function for the random variable whose
distribution function is given by


⎨0 for x ≤ 0,
F (x) = x for 0 < x < 1,


1 for x ≥ 1.

Solution. Since the given density function is differentiable


everywhere except at x = 0 and x = 1, we differentiate for x < 0,
0 < x < 1, and x > 1, getting 0, 1, and 0. Thus, we can write


⎨0 for x ≤ 0,
f (x) = 1 for 0 < x < 1,


0 for x ≥ 1.
Random Variables Discrete Probability Distributions Continuous Random Variables

To fill the gaps at x = 0 and x = 1, we let f (0) and f (1) both


equal to zero. Actually, it does not matter how the probability
density is defined at these points, but there are certain advantages
for choosing the values in such a way that the probability density is
nonzero over an open interval. Thus, we can write the probability
density of the original random variable as

1 for 0 < x < 1,
f (x) =
0 elsewhere.
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 30
The distribution function of the random variable Y is given by

1 − y92 for y > 3,
F (y ) =
0 elsewhere.

Find P(Y ≤ 5), P(Y > 8) and a probability density function of Y .

Solution.
P(Y ≤ 5) = F (5) = 1 − 9
52
= 16
25 ,
P(Y > 8) = 1 − P(Y ≤ 8) = 1 − F (8) = 1 − 1 + 9
= 9
64 ,
  64
d
1 − 9
y2
= 18
y3
for y > 3,
f (y ) = dy
0 elsewhere.
Random Variables Discrete Probability Distributions Continuous Random Variables

Example 31
The distribution function of the random variable X is given by


⎨0 for x < −1,
F (x) = x+1 for − 1 < x < 1,


2
1 for x ≥ 1.
 
Find P − 12 < X < 12 and P(2 < X < 3).

Solution.
      1
+1 − 12 +1
P − 12 < X < 12 = F 12 − F − 12 = 2
2 − 2 =
4 − 4 = 2.
3 1 1

P(2 < X < 3) = F (3) − F (2) = 1 − 1 = 0.


Random Variables Discrete Probability Distributions Continuous Random Variables

Thank You!!!

You might also like