Unit 2a
Unit 2a
BA/BSc II Semester
(STB 251)
by
2 Lecture notes by Dr. Haseeb Athar, Department of Statistics & O.R., A.M.U., Aligarh, India
Random Variable
S X
2
HH
HT 1
TH
TT 0
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.
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
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
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}.
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
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
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.
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
i) f ( x) 0 for every x
y f ( x)
ii) f ( x)dx 1 x
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
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.
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
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
2. lim F ( x) 0 or F () 0
x
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.
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
X: 2 1 0 1 2 3
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
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
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
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
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
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
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
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