Department of Statistics & O.R.
Aligarh Muslim University Aligarh
BA/BSc II Semester
Probability and Probability Distributions
(STB 251)
by
Dr. Haseeb Athar
Unit - II
Contents:
Random Variable
Discrete Random Variable
Probability Mass Function
Continuous Random Variable
Probability Density Function
Distribution Function and it’s Properties
2 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
Random Variable
Need for Random Variable
In any random experiment the points of the sample space may be numeric or non-numeric.
For example, if we roll a die, then sample space is S={1,2,3,4,5,6}, which is numeric. But,
when we toss two unbiased coins together, then sample space is S={HH, HT, TH, TT},
which is non-numeric or descriptive.
In the real world, the outcomes of many random experiments may be non-numeric. Thus, it is
inconvenient to deal with these descriptive outcomes mathematically. In scientific
community, we always feel convenient in dealing with numerical outcomes, whether the
outcomes of a random experiment results are numeric or non-numeric. Hence, for ease of
manipulation, we may assign a real number to each of the outcomes using a fixed rule or
mapping. For example, when we toss a coin, we get two outcomes, namely head or tail.
Instead of dealing the outcomes descriptively as head or tail; we can assume numerical
values, say ‘1’ to head and ‘0’ to tail. This interpretation is easy and attractive from
mathematical point of view and also practically meaningful.
Definition of Random Variable
A random variable (r.v.) is a real valued function defined over the sample space of a random
experiment.
Let X be a real valued function that assigns a real number X (s) to every element
s S (i.e. X : S R) , where S is the sample space corresponding to the random experiment
E. Then X is called a random variable.
Example 2.1
Suppose that we toss two coins. The sample space associated with this experiment is
S = {HH , HT , TH , TT}.
Then we can define a random variable X as follows:
X: The number of heads obtained in two tosses. Then assigned numerical values to the
outcomes are
X(HH) = 2, X(HT) = 1, X(TH) = 1 , X(TT) = 0.
S X
2
HH
HT 1
TH
TT 0
Note that the set of possible values of the random variable X is
X {0,1, 2}
Note: X is a single valued function.
3 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
Discrete Random Variable
A random variable (r.v.) is said to be discrete if its set of possible values is either finite or
countably infinite.
Examples:
1. Roll a die and define
X: Number shown at top
Then set of possible values of X is {1,2,3,4,5,6}, which is finite set. Thus, X is a
discrete r.v.
2. Let X be the number of wattsap messages received between given time period. Then
set of possible values of is {0,1,2,3…}, which is countably infinite set. Thus, X is a
discrete random variable.
Probability Mass Function
Let X be a discrete r.v. having possible values x1, x2 ,..., xi ,... , then with each possible value
of X there associate a real number pi P( X xi ) p( xi ) , such that
i) 0 p( xi ) 1 for every i 1, 2,...,
ii) p( xi ) 1
i 1
where, p( xi ) P( X xi ) is the probability that the r.v. X can take value xi . The set of
p( xi ) is called probability mass function (pmf) and set of xi , p( xi ) is called probability
distribution.
Example 2.2: Two coins are tossed. Then sample space is {HH, HT, TH, TT}.
Define X: Number of heads coming up.
Here, set possible values of X is {0, 1, 2} and probability at each value of X is
1
P(TT)=P( X 0)
4
1
P(HT,TH) P( X 1)
2
1
P(HH) P( X 2)
4
Thus, probability distribution is
X : 0 1 2
P( X x) : 0.25 0.5 0.25
Here 0 p( xi ) 1 and p( xi ) 1
i 1
Therefore, above probability distribution is the valid probability distribution.
4 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
Example 2.3: A shipment of 8 similar microcomputers 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 defectives.
Solution: The sample space associated with the experiment of purchasing two defective
computers is S = {NN, DN, ND, DD}
Let X be the number of defective computers purchased. Then the set of possible values of X
is {0, 1, 2}.
No. of ways in which out of 8 computers 2 computers can be selected 8C2
Consider the following events
( X 0) {0D and 2N} n( X 0) 3C0 5C2
( X 1) {1D and 1N} n( X 1) 3C1 5C1
( X 2) {2D and 0 N} n( X 2) 3C2 5C0
n( X 0) 3C0 5C2 10
P( X 0) 8
n( S ) C2 28
n( X 1) 3C1 5C1 15
P( X 1) 8
n( S ) C2 28
n( X 2) 3C2 5C0 3
P( X 2) 8
n( S ) C2 28
In general, for X 0,1, 2 , we can write
n( X x) 3Cx 5C2 x
P( X x) 8
n( S ) C2
Therefore, probability distribution of X is
X 0 1 2
P( X x ) 10/28 15/28 3/28
Finally, we can write
3 5
x 2 x ; x 0, 1, 2
P( X x) 8
2
0; otherwise
Note: The above probability distribution is Hypergeometric Distribution.
5 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
Continuous Random Variable
A r.v. X is said to be continuous if it can take all possible values between certain limits.
Examples:
1. A class is given 30 min. test. Let X be the time taken by the student who finishes first.
Then set of all possible value of X is {X : 0 X 30} , which is infinite set. Hence, X is
a continuous random variable.
2. Let T be the lifetime of an item put on test. Then set of all possible values of T is
{T : 0 T }, which is infinite set. Hence, T is a continuous random variable.
3. Let X be the number of points between 1 and 2. Then set of possible values of X is
{X : 1 X 2}, which is infinite set. Hence, X is a continuous random variable.
Probability Density Function
x x
Consider the small interval x , x of length x 0 around the point x . Let
2 2
f ( x) be any continuous function of x , so that f ( x)dx represents the probability that X
x x
falls in the infinitesimal interval x , x . That is
2 2
x x
P( x X x ) f X ( x)dx
2 2
Then f ( x) is called probability density
function (pdf), if it satisfies the following
conditions: f ( x)dx
i) f ( x) 0 for every x
y f ( x)
ii) f ( x)dx 1 x
iii) For any two real numbers a and b ,
such that a b , then x x
(x ) (x )
b
P(a X b) a f ( x)dx 2 2
6 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
Remarks:
i) If X is a continuous random variable, then it can assume infinite number of values in
an interval. This interval may be finite or infinite.
For example:
X (0,10) : finite interval
X (0, ) : infinite interval
X (, ) : infinite interval
x
ii) P( X x0 ) 0 as x 0 f ( x)dx 0 .
0
iii) P(a X b) P(a X b)
P(a X b)
P(a X b)
Example 2.4: Suppose X is a continuous r.v. and f ( x) be a continuous function of X and
defined as
f ( x) 0, x 2
1
(3 2 x), 2 X 4
18
0, otherwise
i) Show that f ( x) is a pdf.
ii) Find the probability that a variate having this density will fall in the interval 2 X 3 .
Solution:
i) Here f ( x) 0 for every x in the given interval.
and
2 4
f ( x)dx f ( x)dx 2 f ( x)dx 4 f ( x)dx
1 4
0 (3 2 x)dx 0
18 2
1
Hence f ( x) is a density function.
3
ii) P(2 X 3) 2 f ( x)dx
1 3 4
2
(3 2 x )dx .
18 9
7 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
Example 2.5: Check the validity of following density function.
f ( x) 6x(1 x), 0 X 1
Solution: f ( x) 0 x (0,1)
and
1 1
0 f ( x)dx 0 6 x(1 x)dx
6 0 xdx 0 x2 dx 1 .
1 1
Hence f ( x) is a density function.
Example 2.6: Let X be a continuous random variable with pdf
f ( x) kx, 0 X 1
k, 1 X 2
k (3 x), 2 X 3
0, otherwise
Solution: We know that
f ( x)dx 1
1 2 3
0 f ( x)dx 1 f ( x)dx 2 f ( x)dx 3 f ( x)dx 1
1 2 3
or 0 kx dx 1 k dx 2 (3 x)k dx 3 0. dx 1
1 3
x2 x2
k k x 1 3k x 2 k 0 1
2 3
or
2 0 2 2
k 9k
or k 3k 2k 1
2 2
1
k .
2
Practice Problem 2.1: Let X is a continuous random variable. Show that following the are
valid density functions.
i) f ( x) px p1,0 x 1
ii) f ( x) e x , x 0.
iii) f ( x) 1, 0 x 1 .
1
iv) f ( x) , a xb
ba
8 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
Practice Problem 2.2: Let the r.v X has density function
f ( x) ke x (1 e x ), x 0 .
Find the value of k such that f ( x) is a density function.
Practice Problem 2.3: Suppose that the error in the reaction temperature, in 0C , for a
controlled laboratory experiment is a continuous random variable X having the following
probability density function:
1 2
x ; 1 x 2
f ( x) 3
0 ; elsewhere
a) Check the validity of above density function
b) Compute P 0 x 1
Cumulative Distribution Function
Let X be a random variable, discrete or continuous. We define F to be the cumulative
distribution function (cdf) or distribution function (df) of the X , where F ( x) P( X x) .
If X is a discrete random variable with pmf p( x) , then
F ( x) P( X x) p( x)
x
If X is a continuous random variable with pdf f ( x) , then
x
F ( x) P( X x) f (t )dt
Properties of Distribution Function
1. The function F is non-decreasing. That is, if x1 x2 , then F ( x1 ) F ( x2 ) .
2. lim F ( x) 0 or F () 0
x
and lim F ( x) 1 or F () 1
x
3. a) If F be the cdf of a continuous random variable with pdf f , then
d
i) f ( x ) F ( x ) for all x at which F is differentiable.
dx
ii) P(a X b) P( X b) P( X a)
F (b) F (a)
b) If X is a discrete random variable with possible values x1, x2 ,..., and
x1 x2 ... xi 1 xi ... , then
i) P( X xi ) F ( xi ) F ( xi 1 )
9 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
ii) P(a X b) P( X b) P( X a) F (b) F (a)
P(a X b) P(a X b) P( X a) F (b) F (a) p(a)
P(a X b) P(a X b) P( X b) F (b) F (a) p(b)
Discrete Case
Let the discrete random variable X takes values x1, x2 ,..., xn with respective probabilities
p1, p2 ,..., pn and let x1 x2 ... xn . Then
F ( x1 ) P( X x1 ) 0
F ( x1 ) P( X x1 ) P( X x1 ) P( X x1 ) 0 p1
F ( x2 ) P( X x2 ) P( X x2 ) P( X x2 ) p1 p2
F ( xi ) P( X xi ) P( X xi ) P( X xi ) p1 p2 ... pi 1 pi
F ( xn ) P( X xn ) P( X xn ) P( X xn ) p1 p2 ... pn1 pn
Therefore,
0 ; X x1
p ; x X x
1 1 2
p1 p2 ; x2 X x3
F ( x) P( X x)
p1 p2 ... pi 1 pi ; xi X xi 1
1; xn X
Example 2.7: Suppose that the random variable X assumes the values 0, 1 and 2 with
probabilities 10/28, 15/28 and 3/28 respectively.
i) Determine the distribution function of X .
ii) Using cdf, find F (0.5), F (1.5), F (3.8), P(0.5 X 1.5) and P(1 X 2) .
Solution:
We know that
F ( x) P( X x) p( x)
x
For X 0 : F (0) P( X 0) 0
10 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
10
For 0 X 1 : F (1) P( X 1) P( X 0)
28
10 15 25
For 1 X 2 : F (2) P( X 2) P( X 0) P( X 1)
28 28 28
For X 2(2 X ) : F () P( X ) P( X 1) P( X 0) P( X 1)
10 15 3
1
28 28 28
Therefore, the cdf or df of random variable X is
0 ; x0
10
; 0 x 1
28
F ( x) P( X x)
25 ; 1 x 2
28
1 ; x2
F (0.5) P( X 0.5) 0
25
F (1.5) P ( X 1.5) F (1)
28
F (3.8) P( X 3.8) F (2) 1
P(0.5 X 1.5) F (1.5) F (0.5)
25 10 15
28 28 28
25 3
P (1 X 2) F (2) F (1) 1
28 28
Example 2.8: A random variable X has probability function
x 1
p ( x) , x 0,1, 2
6
0, otherwise
i) Check, whether above is valid probability distribution.
ii) Find cumulative distribution function of X.
Solution: The probability distribution is given as
X : 0 1 2
P( X x ) : 1/6 1/3 1/2
i) Here 0 p( x) 1 and p( x) 1
Therefore, above probability distribution is the valid probability distribution.
11 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
ii) In X 0 : F ( x) P( X 0) 0
In 0 X 1: F ( x) P( X 1) P( X 0) 1/ 6
In 1 X 2 : F ( x) P( X 2) P( X 0) P( X 1)
1 1 1
6 3 2
In 2 X (or X 2) : F ( x) P( X ) P( X 0) P( X 1) P( X 2)
1 1 1
1
6 3 2
Therefore, cdf of r.v. X is
0 ; x0
1
; 0 x 1
6
F ( x) P( X x)
1 ; 1 x 2
2
1 ; x2
Example 2.9: A random variable X has the following probability function
X: 2 1 0 1 2 3
P( X x) : 0.1 k 0.2 2k 0.3 3k
i) Find k.
ii) Evaluate P( X 2), P( X 2), P(| X | 2) .
iii) Find the minimum value of k such that P( X 1) 0.36 .
iv) Determine distribution function of X.
Solution: (i) We know that
p ( x) 1
0.1 k 0.2 2k 0.3 3k 1
or k 1 / 15
(ii) P( X 2) P( X 2) P( X 1) P( X 0) P( X 1)
0.1 k 0.2 2k 0.3 3k
0.3 0.2 0.5
P( X 2) 1 P( X 2) 1 0.5 0.5
P(2 X 2) P( X 1) P( X 0) P( X 1)
k 0.2 2k 3k 0.2 0.2 0.2 0.4
12 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
(iii) P( X 1) P( X 2) P( X 1) P( X 0) P( X 1)
0.1 k 0.2 2k
3k 0.3
Now, we have
P( X 1) 0.36
3k 0.3 0.36
or 3k 0.06
k 0.02
(iv) The cdf of r.v. X is
0 ; X 2
1
; 2 X 1
10
F ( x) P( X x)
14 ; 1 X 3
15
1 ; X 3
Example 2.10: Let X be a random variable, such that
P( X 2) P( X 1) P( X 1) P( X 2)
and P( X 0) P( X 0) P( X 0).
Write down probability distribution of X. Also, determine distribution function of X.
Solution: Let
P( X 2) P( X 1) P( X 1) P( X 2) k
P( X 0) P( X 0) P( X 0) p .
Since P( X 0) P( X 0) P( X 0) 1
3 p 1 or p 1/ 3
Therefore,
P( X 0) P( X 0) P( X 0) 1/ 3
1
Now P ( X 0)
3
P( X 2) P( X 1) 1/ 3
or 2k 1 / 3
k 1/ 6
Therefore, probability distribution of X is
X: 2 1 0 1 2
P( X x) : 1/6 1/6 1/3 1/6 1/6
13 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
Now we have to find distribution of X is
In X 2 : F ( x) P( X 2) 0
In 2 X 1: F ( x) P( X 1) P( X 2) 1/ 6
In 1 X 0 : F ( x) P( X 0) P( X 1) P( X 2)
1 1 1
6 6 3
In 0 X 1: F ( x) P( X 1) P( X 2) P( X 1) P( X 0)
1 1 1 2
6 6 3 3
In 1 X 2 : F ( x) P( X 2) P( X 2) P( X 1) P( X 0) P( X 1)
1 1 1 1 5
6 6 3 6 6
In 2 X : F ( x) P( X ) P( X 2) P( X 1) P( X 0)
P( X 1) P( X 2) 1
Therefore, cdf of r.v. X is
0 ; X 2
1
; 2 X 1
6
1
; 1 X 0
3
F ( x) P( X x)
2 ; 0 X 1
3
5
; 1 X 2
6
1 ; X 2
Example 2.11: The distribution function F ( x) of a r.v. X is defined as follows:
F ( x) A, X 1
B, 1 X 0
C, 0 X 2
D, 2 X
where A, B, C and D are constants. Determine the values of A, B, C and D , it is given that
1 2
P ( X 0) and P ( X 1)
6 3
Solution:
A F () 0
14 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
P( X 0) F (0) F (0) C B
1
P ( X 0) C B (*)
6
P( X 1) 1 P( X 1)
1 F (1) 1 C
2 2 1
1 C , then C 1 .
3 3 3
1
Using (*), we get B
6
and F () D 1 .
Finally, A 0, B 1/ 6, C 1/ 3 and D 1 .
Practical Problem 1: From a lot containing 12 items, 4 of which are defective, 5 are chosen
at random. If X be the number of defectives found in the sample.
(a) Write down probability distribution of X,
i) if items are chosen by without replacement procedure.
ii) If items are chosen by with replacement procedure.
b) Check the validity of above written probability distributions.
c) Compute P( X 1) , P(1 X 3) and P( X 3) for both the cases
d) Determine cumulative distribution function of X. Also find the probability given in
(c) using cdf and compare.
Continuous Case:
Example 2.12: Suppose that the error in the reaction temperature, in 0C , for a controlled
laboratory experiment is a continuous random variable X having the following probability
density function:
1 2
x ; 1 x 2
f ( x) 3
0 ; elsewhere
a) Find the cdf
b) Compute P 0 X 1
Solution: (a)
For x 1
x x
F x f(t)dt 0 dt 0
- -
15 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
For -1 x 2
x 1 x x
1 1
F x f(t)dt 0 dt t 2 dt t 2 dt
- - -1 3 -1 3
1 3
( x 1)
9
For x 2
x 1 2 x
1
F x f(t)dt 0 dt t 2 dt 0 dt = 1
- - -1 3 2
Therefore, cdf is
0 ; x 1
1
F ( x) P ( X x) ( x3 1) ; 1 x 2
9
1 ; x 2
(b) P(0 X 1) F (1) F (0)
2 1 1
9 9 9
Example 2.13: The probability density function of a random variable X is
x, 0 X 1
f ( x ) 2 x, 1 X 2
0, X 2
Compute the cdf of X.
Solution:
For any x in X 0
x x
F ( x) P( X x) f (t )dt 0. dt 0
For any x in 0 X 1
x x x2
F ( x) P( X x) 0 f (t )dt 0 t dt
2
For any x in 1 X 2
x
F ( x) P( X x) f (t )dt
0 1 x
f (t )dt 0 f (t )dt 1 f (t )dt
1 x
0 0 tdt 1 (2 t )dt
1 x2 1 x2
2x 2 2x 1
2 2 2 2
16 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
For every x in X 2
x
F ( x) P ( X x) f (t )dt
0 1 2
f (t )dt 0 f (t )dt 1 f (t )dt 2 f (t )dt
1 2
0 0 tdt 1 (2 t )dt 0
1 1
2 2 1
2 2
Therefore, cdf is
0 ; X 0
2
x ; 0 X 1
F ( x) P( X x) 2
x2
2 x 1 ; 1 X 2
2
1; X 2
Example 2.14: The diameter of an electric cable, say X is assumed to be continuous random
variable with pdf
f ( x) 6x(1 x), 0 X 1
i) Obtain the expression for the cdf of X.
ii) Determine a number b such that P( X b) 2P( X b) .
Solution: (i) The cdf of X is given by
x
F ( x) P( X x) f (t )dt
x
0 6t (1 t )dt
3x2 2x3 , X 1
(ii) We have given that
P( X b) 2P( X b)
or P( X b) 2[1 P( X b)]
2
or P ( X b)
3
2
F (b)
3
6b 9b3 2 0
2
Now solve above equation to get the value of b.
17 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
Example 2.15: Let X be a continuous rv with pdf given as
f ( x) ke x (1 e x ), X 0, 0.
Find k and compute the P( X 1) using cdf.
Solution: We know that
f ( x)dx 1
Thus,
x x
0 ke (1 e )dx 1
Consider 1 e x t e x dx dt , then
k 1
tdt 1
0
k 2
x
Now F ( x) P( X x) 0 f (t )dt
2 0 e t (1 e t )dt
x
Again suppose 1 e t z e t dt dz and t 0 z 0; t x z 1 e x
Therefore,
1e x
F ( x) 20 z dz 1 2e x e2 x , X 0 .
Now P( X 1) 1 P( X 1)
1 F (1)
2e e2 , 0 .
Practice Problem 2.5: Let X is a continuous random variable. Find cdf for following pdfs
i) f ( x) px p1,0 x 1
ii) f ( x) px p1,1 x
iii) f ( x) e x , x 0.
iv) f ( x) 1, 0 x 1 .
1
v) f ( x) , a xb
ba
Practice Problem 2.6: An unbiased die is rolled. If the die shows 1 or 2, a number is
selected at random from the interval [0, 1]. If the die shows 3, 4, 5 or 6, a number is selected
at random from the interval [1, 2]. Find the distribution function of the number selected.
18 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India