67% found this document useful (3 votes)
3K views

Probability and Statistics 2 Notes

Time is precious, but its precise value is unknown. We will only understand how precious time truly is once we can no longer take advantage of it.

Uploaded by

Kipketer Victor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
67% found this document useful (3 votes)
3K views

Probability and Statistics 2 Notes

Time is precious, but its precise value is unknown. We will only understand how precious time truly is once we can no longer take advantage of it.

Uploaded by

Kipketer Victor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Time is precious, but we do not know yet how precious it really is.

We will only know when we are no longer able to take advantage of it…

STA 2200 PROBABILITY AND STATISTICS II


Purpose By the end of the course the student should be able to solve problems involving
probability distributions of a discrete or a continuous random variable.
Objectives
By the end of this course the student should be able to;
(1) Define the probability mass, density and distribution functions, and to use these to
determine expectation, variance, percentiles and mode for a given distribution
(2) Appreciate the form of the probability mass functions for the binomial, geometric,
hyper-geometric and Poisson distributions, and the probability density functions for the
uniform, exponential, gamma , beta and normal, functions, and their applications
(3) Apply the moment generating function and transformation of variable techniques
(4) Apply the principles of statistical inference for one sample problems.

DESCRIPTION
Random variables: discrete and continuous, probability mass, density and distribution
functions, expectation, variance, percentiles and mode. Moments and moment generating
function. Moment generating function and transformation Change of variable technique for
univariate distribution. Probability distributions: hyper-geometric, binomial, Poisson, uniform,
normal, beta and gamma. Statistical inference including one sample normal and t tests.
Pre-Requisites: STA 2100 Probability and Statistics I, SMA 2104 Mathematics for Science
Course Text Books
1) RV Hogg, JW McKean & AT Craig Introduction to Mathematical Statistics, 6th ed.,
Prentice Hall, 2003 ISBN 0-13-177698-3
2) J Crawshaw & J Chambers A Concise Course in A-Level statistics, with worked examples,
3rd ed. Stanley Thornes, 1994 ISBN 0-534- 42362-0

Course Journals:
1) Journal of Applied Statistics (J. Appl. Stat.) [0266-4763; 1360-0532]
2) Statistics (Statistics) [0233-1888]

Further Reference Text Books And Journals:


a) HJ Larson Introduction to Probability Theory and Statistical Inference(Probability and
Mathematical Statistics) 3rd ed., Wiley, 1982
b) Uppal, S. M. , Odhiambo, R. O. & Humphreys, H. M. Introduction to Probability and
Statistics. JKUAT Press, 2005
c) I Miller & M Miller John E Freund’s Mathematical Statistics with Applications, 7th ed.,
Pearsons Education, Prentice Hall, New Jersey, 2003 ISBN: 0131246461
d) Statistical Science (Stat. Sci.) [0883-4237]
e) Journal of Mathematical Sciences
f) The Annals of Applied Probability

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 1
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

1. RANDOM VARIABLES
1.1 Introduction
In application of probability, we are often interested in a number associated with the outcome
of a random experiment. Such a quantity whose value is determined by the outcome of a
random experiment is called a random variable. It can also be defined as any quantity or
attribute whose value varies from one unit of the population to another.
A discrete random variable is function whose range is finite and/or countable, Ie it can only
assume values in a finite or countably infinite set of values. A continuous random variable is
one that can take any value in an interval of real numbers. (There are uncountably many real
numbers in an interval of positive length.)

1.2 Discrete Random Variables and Probability Mass Function


Consider the experiment of flipping a fair coin three times. The number of tails that appear is
noted as a discrete random variable. X= number of tails that appear in 3 flips of a fair coin.
There are 8 possible outcomes of the experiment: namely the sample space consists of
S  HHH , HHT , HTH , HTT , THH , THT , TTH , TTT
X  0 1, 1, 2 , 1, 2, 2, 3
are the corresponding values taken by the random variable X.
Now, what are the possible values that X takes on and what are the probabilities of X taking a
particular value?
From the above we see that the possible values of X are the 4 values
X = 0, 1, 2, 3
Ie the sample space is a disjoint union of the 4 events {X = j } for j=0,1,2,3
Specifically in our example:
X  0 = HHH X  1 = HHT, HTH, THH
X  2 = TTH, HTT, THT X  3 = TTT
Since for a fair coin we assume that each element of the sample space is equally likely (with
probability 18 , we find that the probabilities for the various values of X, called the probability
distribution of X or the probability mass function (pmf). can be summarized in the following
table listing the possible values beside the probability of that value
X 0 1 2 3
1 3 3 1
P(X=x) 8 8 8 8

Note: The probability that X takes on the value x, ie p(X  x) , is defined as the sum of the
probabilities of all points in S that are assigned the value x.
We can say that this pmf places mass 83 on the value X = 2 .
The “masses” (or probabilities) for a pmf should be between 0 and 1.
The total mass (i.e. total probability) must add up to 1.

Definition: The probability mass function of a discrete variable is a graph, table, or formula
that specifies the proportion (or probabilities) associated with each possible value the random
variable can take. The mass function P(X  x) (or just p(x) has the following properties:
0  p(x)  1 and  p(x)  1
all x
More generally, let X have the following properties
i) It is a discrete variable that can only assume values x1 , x2 , .... xn
ii) The probabilities associated with these values are
P( X  x1 )  p1 , P( X  x2 )  p2 ……. P( X  xn )  pn

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 2
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

n
Then X is a discrete random variable if 0  pi  1 and p
i 1
i 1

Remark: We denote random variables with capital letters while realized or particular values
are denoted by lower case letters.

Example 1
Two tetrahedral dice are rolled together once and the sum of the scores facing down was noted.
Find the pmf of the random variable ‘the sum of the scores facing down.’
Solution
+ 1 2 3 4 Therefore the pmf of X is given by the table
1 2 3 4 5 below
2 3 4 5 6 x 2 3 4 5 6 7 8
1 1 3 1 3 1 1
3 4 5 6 7 P(X=x) 16 8 16 4 16 8 16

4 5 6 7 8 This can also be written as a function


 x161 for x  2 , 3, 4 , 5
X = 1, 2, 3, 4 , 5 , 6 , 7 , 8 P( X  x )   9 x
 16 for x  6 , 7, 8
Example 2
The pmf of a discrete random variable W is given by the table below
W -3 -2 -1 0 1
P(W=w) 0.1 0.25 0.3 0.15 d
Find the value of the constant d, P 3  w  0 , Pw  -1 and P 1  w  1
Solution
 p(W  w)  1  0.1  0.25  0.3  0.15  d  1  d  0.2
all w

P 3  w  0  P(W  3)  P(W  2)  P(W  1)  0.65


Pw  -1  Pw  0  Pw  1  0.15  0.2  0.35
P 1  w  1  P(W  0)  0.15

Example 3
A discrete random variable Y has a pmf given by the table below
Y 0 1 2 3 4
P(Y=y) c 2c 5c 10c 17c
Find the value of the constant c hence computes P1  Y  3
Solution
 p(Y  y)  1  c(1  2  5  10  17)  1  c  351
ally

P1  Y  3  P(Y  1)  P(Y  2)  352  355  15

Exercise 1.1
1. A die is loaded such that the probability of a face showing up is proportional to the face
number. Determine the probability of each sample point.
2. Roll a fair die and let X be the square of the score that show up. Write down the
probability distribution of X hence compute P X  15 and P3  X  30
3. Let X be the random variable the number of fours observed when two dice are rolled
together once. Show that X is a discrete random variable.
4. The pmf of a discrete random variable X is given by P( X  x )  kx for x  1, 2 , 3, 4 , 5 , 6
Find the value of the constant k, P X  4 and P3  X  6
Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 3
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

5. A fair coin is flip until a head appears. Let N represent the number of tosses required to
realize a head. Find the pmf of N
6. A discrete random variable Y has a pmf given by P(Y  y )  c 34  for y  0 ,1, 2 , .....
x

Find the value of the constant c and PX  3


2x
7. Verify that f( x)  for x  1, 2 , .....k can serve as a pmf of a random variable X.
k (k  1)
8. For each of the following determine c so that the function can serve as a pmf of a random
variable X.
a) f( x)  cx for x 1, 2 , 3 , 4 , 5 c) f( x)  c 16  for x  0 ,1, 2 , 3.....
x

b) f( x)  cx 2 for x  0 ,1, 2 , .....k d) f( x)  c2 x for x  0 ,1, 2 , ....


9. A coin is loaded so that heads is three times as likely as the tails. For 3 independent
tosses of the coin find the pmf of the total number of heads realized and the probability of
realizing at most 2 heads.

1.3 Continuous Random Variables and Probability Density Function


A continuous random variable can assume any value in an interval on the real line or in a
collection of intervals. The sample space is uncountable. For instance, suppose an experiment
involves observing the arrival of cars at a certain period of time along a highway on a
particular day. Let T denote the time that lapses before the 1st arrival, then T is a continuous
random variable that assumes values in the interval [0 , )
To illustrate the concept of a probability density function, consider a histogram with unequal
class widths. Frequency density is plotted on the vertical axis, where
frequency
frequency density = .
class width
One can also draw a relative frequency histogram in which the area of a bar corresponds to
the proportion of the data falling into the corresponding interval. The relative frequency is
frequency density
defined as Relative frequency = .
Total frequency
Eg The relative frequency histogram below shows the distribution of ages of the UK
population.

Relative frequency histogram to show


the age distribution in the UK
0.02
Relative frequency

0.015
density

0.01

0.005

0
0 10 20 30 40 50 60 70 80 90 100
Age

The area of each bar corresponds to the proportion of the population with ages in that
interval. The total area of all the bars is 1.
The distribution of the ages can be modelled by a curve. This curve is called a probability
density function.

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 4
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

Definition: A probability density function


(or p.d.f.) is a curve that models the shape
of the distribution corresponding to a
continuous random variable. The function
has several important properties
If f(x) is the p.d.f corresponding to a
continuous random variable X and if f(x) is
defined for    X   then the
following properties must hold:
i) f( x)  0 for all x. i.e. the graph of the p.d.f. never dips below the x-axis.

ii)  f( x) dx  1 for all x . i.e. the total area under a p.d.f. is 1.
-

b
iii) pa  x  b    f( x) dx i.e. probabilities correspond to areas under the curve.
a

Example 1: Sketch the graph of each of the following functions. Decide in each case
 x 3 X  1
whether it could be the equation of a probability density function: (a) f( x)  
 0 elsewhere
 321 (24 x  3x 2  36) 2  X  6 x2  4 x  3 0  X  4
b) f( x)   c) f( x)  
 0 elsewhere  0 elsewhere

Solution
The function is non-negative everywhere.
For f to represent a p.d.f, we need to check
that  f( x) dx  1 . But:
all x

 f( x) dx   x dx   12 x
-3
1

2

0
 0  ( 12 )  12
all x
So f(x) could not represent a probability
density function.

The function is non-negative everywhere.


If f represents a p.d.f., then  f( x) dx  1
all x

6
 f( x) dx   24 x  3x  36dx
1 2
32 2
all x

 1
32 12 x 2
 x 3  36 x 2 
6

 1
32 0  (32)  1

So f(x) could represent a probability density function.

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 5
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

The function is clearly negative for some


values of x.
Consequently f(x) cannot represent a
probability density function.

Remark A crucial property is that, for any real number x, we have P(X  x)  0 (implying
there is no difference between P(X  x) and P(X  x) ); that is it is not possible to talk about
the probability of the random variable assuming a particular value. Instead, we talk about the
probability of the random variable assuming a value within a given interval which is defined
to be the area under the graph of the probability density function between x  a and x  b .
Example 2
The time X, in hours, between computer failures is a continuous random variable with density
e 0.01x for x  0
f(x)   Find  hence compute P50  X  150 and PX  100
0 , elsewhere
Solution

f(x)  0 for all x in 0  x   Thus 1    e 0.01x dx  100 e 0.01x
0
 

0  100    0.01..

Now P50  X  150  0.01 e 0.01x dx   e 0.01x


150

50
  150
50  e 0.5  e 1.5  0.3834005 and

PX  100  0.01 e 0.01x dx   e 0.01x


100

0
 100
0  1  e 1  0.6321206

Example 3 A continuous random variable X is defined by the probability density function

k ( x  1), 1  x  3 a) Sketch the probability density function.


 b) Find the value of the constant k.
f( x)  k (5  x)( x  2) 3  x  5
c) Find P(X > 2).
 0, elsewhere

Solution To find k, we can use the property that
 f( x) dx  1 Note that
all x

(5  x)( x  2)  7 x  10  x2 .

 f( x) dx  k  ( x  1)dx  k  7 x  10  x dx
3 5
2
1 3
all x

 1k   1
2 x2  x 1   
3
7
2 x 2  10 x  13 x 3 
5
3

   ( )  
3
2
1
2
25
6  ( ) 
15
2
16
3  k  163

2
P(X  2)  1  P(X  2)  1  163  ( x  1)dx  1  163
1
1
2

x 2  x 1  1  163 0  ( 12 )  32
2 29

Example 4 A continuous random variable X has a probability density function given by


0.25 , 0  x  2

f(x)  0.5 x  c , 2  x  3 Find c hence compute P1  X  2.5 .
 0 , elsewhere

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 6
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

Solution
12 x  cdx  12  54  c
2 3
all x
f(x)dx  1   1
0 4
dx  
2
 c   34

P1  X  2.5  P1  X  2  P2  X  2.5   12 x  34 dx  14  x 4_ 3x 2


2 2.5 2.5
dx  
2
1
 14  163  167
1 4 2

Exercise 1.2
cx, 0  x  1
1) Suppose that the random variable X has p.d.f. given by f(x)   Find the
0, elsewhere
value of the constant c hence determine m so that PX  m  12
 5x  k , 0  x  3
2) Let X be a continuous random variable with pdf f(x)   Find the value
 0, elsewhere
of the constant k hence compute P1  X  3
k (1  y ), 4  x  7
3) A continuous random variable Y has the pdf given by f(y)   Find
 0, elsewhere
the value of the constant k hence compute PY  5 and P5  Y  6
4) The continuous random variable X has probability density function
k ( x  1)2 , 0  x  2
f( x)   Find the value of the constant k k hence compute P X  1.5
0, otherwise
5) A continuous random variable R is defined by the probability density function
k (5  r ), 0  r  2 a) Sketch the p.d.f of R
f(r )   b) Find k hence compute P(1 ≤ R ≤ 3).
 0, otherwise
6) The life, T hours, of an electrical component is modelled by the probability density
ke0.001t , T  1000
function f(t )  
 0, otherwise
a) Sketch the probability density function.
b) Find the value of the constant k.
c) Find P(1500 ≤ T ≤ 2000).
k (1  y 2 ),  1  x  1
7) A continuous r.v Y has probability density function f( x)   Find
0, otherwise
the value of the constant k hence compute PY  0.5 and P(0.5  Y  0.5)
kx(1  x) , 0  x  1
8) Let X be a continuous r.v witha pdf f ( x)   . Calculate P X  12  14  
0, otherwise
6 , 0  x  2
 1

9) The pdf of a random variable X is given by f ( x)   1


3 , 2  x  4

Sketch the graph of f(x) hence find P(1  x  3)
k (1  x) 2 ,  2  x  0

10) A continuous random variable X has the pdf given by f( x)  4k 0  x  43 Find
0, elsewhere

the value of the constant k hence compute P X  1 and P 1  X  1

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 7
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

 kx, 0  x  2

11) A continuous random variable X has the pdf given by f(x)  k 4  x  2  x  4 Find

 0 , elsewhere
the value of the constant k hence compute P X  3 and P1  X  3
12) The length of time in minutes a customer queue in a post office is a random variable T with pdf
 
c 81  t 2 , 0  t  9
f(t )  
0, elsewhere
a) Find the value of the constant c and the cdf of T
b) Find the probability that a customer will wait for more than 3 minutes
c) A customer has been queuing for 3 minutes, find the probability that this customers will be
queuing for at least 7 minutes
d) Three customers are selected at random, find the probability that exactly 2 of them had to
queue for longer than 3 min

1.4 Distribution Function of a Random Variables


Definition: For any random variable X, we define the cumulative distribution function (CDF),
 x
  P(T  t) If X is discrete
F(x) as F( x)  P X  x   t   for every x.
 x f(t)dt If X is continuous

Here t is introduced to facilitate summation /integration//

Properties of any cumulative distribution function


 lim F(x)  1 and lim F(x)  0
x  x 
 F(x) is a non-decreasing function.
 F(x) ) is a right continuous function of x. In other words lim F(t)  F(x)
tx

Reminder If the cdf of X is F(x) and the pdf is f(x) , then differentiate F(x) to get f(x), and
integrate f(x) to get F(x) ;
Theorem: For any random variable X and real values a < b, Pa  X  b  F(b) - F(a)

Example 1
 1 1  x  for x 1, 2 , 3 , 4 , 5
Let X be a discrete random variable with pmf given by f( x)   20 .
 0 , elsewhere
Determine the cdf of X hence compute P X  3
Solution
 4  x  1  x( x403)
x x
F(x)   f(t)   (t  1) 
t  
1
20
t 1
1
20
(2  3  ....  x)  1 x
20 2

0 for x 1
 x  3)
F( x)   x ( 40 for x 1, 2 , 3 , 4 , 5 Recall for an AP S n n
2 2a  n  1d 
1 for x  5

P X  3  1  P X  3  1  340
6
 11
20

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 8
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

Example 2
Suppose X is a continuous random variable whose pdf f(x) is given by
 1 x, 0  x  2
f( x)   2 . Obtain the cdf of X hence compute P X  23 
 0, elsewhere
Solution
0, x  0
   2
x x
F(x)   f(t)dt   12 tdt  14 t 0  14 x thus F( x)   x4 , 0  x  2
2 x 2

- 0 1, x  2

P X  23   1  P X  23   1  14  23   89
2

Example 3
A continuous random variable X has a probability density function given by
0.25 , 0  x  2

f( x)  0.5 x  c , 2  x  3 Find the cdf of X hence compute P1.5  X  2.5 .
 0 , elsewhere

Solution
 x 1 dt  x
0 4
x
4
F(x)   f(t)dt   x
  12 t - 34 dt  k  x 4-3x  12  k
2
-
2
Under the two levels, F(2) must be the same. (reason for introducing k)
0 for x  0
x
 4 for 0  x  2
 F(2)  12  k  F( x)   2
 4  1 for 2  x  3
x -3x

1, for x  2

P1.5  X  2.5  F(2.5) - F(1.5)  2.5 3( 2.5)
2
 1  1.5
44
 0.3125

Exercise 1.3
x3  k
1. The CDF of a discrete random variable X is given by F( X )  , x  1, 2, 3
40
a) Show that k=13 b) Find the pmf of x
C , 0  x  4
2. The pdf of a continuous random variable X is given by f( x)   x Find the
 0, elsewhere
value of the constant C, the cdf of X and P X  1
kx(1  x), 0  x  1
3. The pdf of a random variable X is given by g( x)   Find the value
 0, elsewhere
of the constant k, the cdf of X and the value of x such that G(x)  12
4. A continuous random variable x has 0), x  2
cumulative distribution function 
F( x)   16 x  13 ,  2  x  4 Find the
 1, x  4

probability density function f(x) of X.

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 9
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

5. A random variable X has p.d.f. 7. A continuous random variable X has


 16 ( x 3  1), 0  x  2 pdf f(x) given by
g( x)   Find the  x2
 0, elsewhere  , 0 x3
c.d.f. of X hence obtain P(X < 1).  45
6. A random variable X has pdf 0.2 , 3  x  4
f( x)  
 12 , 0  x  1 10  x , 4  x  10
  30
f( x)   x  12 1  x  k where k is a 0 , elsewhere
0 , otherwise 

Sketch f(x). Also find the cdf of x and
constant. Sketch a graph of f(x) hence
find the value of k and the cdf of x hence compute p( X  8)
hence compute P(0.5  x  1.5)
9
8. If the cdf of a random variable Y is given by F( y )  1  for Y  3 and
y2
F(x)  0 for Y  3 , find P X  5 , P X  8 and the pdf of X
9. A random variable X has a cdf F(X)  2 x2  x 4 for x  0,1 . Compute P( 14  x  34 ) and
also find the pdf of x
10. Find the cdf of a random variable Y whose pdf is given by;
x 2 , 0  x  1
 13 , 0  x  1 1 , 1  x  2
1  2
a) f( x)   3 , 2  x  4 b) f( x)  (3 x )
 0, elsewhere  2, 2 x3
  0, elsewhere
11. The continuous random variable x has probability density function f(x) given by
k ( x 2  2 x  2), 0  x  3

f(X)  3k 3 x  4 where k is a constant. Show that k  19
 0, elsewhere

a) Find the cumulative distribution function F(x) and the mean of X.
b) Show that the median of X lies between x = 2.6 and x = 2.7
12. The lifetime, X, in tens of hours, of a battery has a cumulative distribution function F(x)
0, x  1

given by F( x)   94 ( x 2  2 x  3) , 1  x  1.5
 1, x  1.5

a) Find the median of X, giving your answer to 3 significant figures.
b) Find, in full, the probability density function of the random variable X.
c) Find P(X> 1.2)
13. The continuous random variable T represents the time in hours that students spend on
homework. The cumulative distribution function of T is
0, t  0

F(t )  k (2t 3  t 4 ) , 0  t  1.5 where k is a positive constant.
 1, t  1.5

a) Show that k  16
27 hence and find the probability density function f(t) of T.
b) Find the proportion of students who spend more than 1 hour on homework.

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 10
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

c) Show that E(T ) = 0.9 and F(E(T )) = 0.4752.


d) A student is selected at random. Given that the student spent more than the mean
amount of time on homework, find the probability that this student spent more than 1
hour on homework.

1.5 Derived Random Variables


Give the pdf of a random variable say X, we can obtain the distribution of a second random
variable say Y provided that we know some functional relationship between X and Y say
Y  u( X ). Eg Y  2 X  3 , Y  X 3 , Y  X  c etc
For a 1-1 relationship between X and Y eg Y  2 X  3, f(x )and g(y) yields exactly the same
probabilities only the random variable and the set of values it can assume changes.

Example 1
 x 6 for x 1, 2 , 3
Give the pmf of a random variable X as f( x)   find the pmf of Y  X 2
0 , elsewhere
Solution
The only values of Y with non-zero probabilities are Y = 1, Y = 4 and Y = 9 . Now
 
PY = 1  P X2 = 1  PX = 1  16  
PY = 4  P X2 = 4  PX = 2  13 and
PY = 9  PX = 9  PX = 3 
2 1
2
In some cases several values of X will give rise to the same value of Y. The procedure is just
the same as above but it is necessary to add the several probabilities that are associated with
each value x that provides a unique value y.

 x 1
 for x  0 , 1, 2 , 3 , 4
Example 2 Given the pmf of a r.v X as f( x)   15 find the pmf of
 0 , elsewhere
Y   X  2
2

Solution
x 0 1 2 3 4
y 4 1 0 1 4

PY = 0  PX = 2  15 PY = 1  PX = 1  PX = 3  152  154  52


PY = 1  PX = 0  PX = 4  151  13  52 Therefore the pmf of Y can be written as
Y 0 1 4
PY = y 2
5
2
5
2
5

\Exercise 1.4
 16 for x 1, 2 , 3 , 4 , 5 , 6
1. Suppose the pmf of a r.v X is given by f( x)   , Obtain the pmf of
0 , elsewhere
Y  2 X and Z  X  3
2

 x2  1
 for x  0 , 1, 2 , 3
2. Let the pmf of a r.v X be given by f( x)   18 , determine the pmf of
 0,
 elsewhere
Y  X 1 2

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 11
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

 x 10 for x  0 , 1, 2 , 3 , 4
3. Suppose the pmf of a r.v X is given by f( x)   , Obtain the pmf of
 0 , elsewhere
Y X 2
 1  for x  1, 2 , 3 , ....
 x

4. Let the pmf of a r.v X be given by f( x)   2 , determine the pmf of



 0 , elsewhere
1 if x is odd
Y
0 if x is even
 16  56  for x  0 ,1, 2 , 3 , ....
 x

5. Suppose the r.v X has a pmf given by f( x)   , Obtain the pmf



 0 , elsewhere
of Y  X  1
6. Let X be a discrete r.v with pmf as tabulated below. Find the pmf of Y  ( X  2) 2
X -2 -1 0 1 2
1 1 1 1 1
P(X=x) 4 8 8 4 4

1.6 Change of Variable Technique


dx
.Let X be a r.v with pdf f(x) and let Y be a function of X, then the pdf of Y, g( y )  f( x)
dy
NB If F(x) is the cdf of a r.v X, then a r.v Y  F(x) has a uniform distribution over 0 , 1

Example 1
5 x 4 , 0  x  1
A continuous r.v X has a pdf given by f( x)   . Determine the pdf of Y  x 3
 0 otherwise
Solution
1 2 
  5 y 3 , 0  x  1
2
dx 1  2 3 dx 4
Yx  X Y   Y g(y)  f(x)  5 y 3  y 3  3
3 1 1
3

dy 3 dy 3 
 0 otherwise
24 x 2 , 0  x  12
Example 2 A r.v X has pdf f( x)   determine the pdf of Y  8 X 3
 0 otherwise
Solution

Y  8 x 3  X  12 Y 3 
1 dx 1  2 3
6y g(y)  f(x)
dx 2
 24 12 y 3  16 y  3  
1 2

1, 0  x  1

dy dy 0, elsewhere
NB Y  8 X 3 is the cdf of X

Exercise 1.5
5 x 4 , 0  x  1
1. For a r.v X with f( x )   , determine the pdf of Y  2 ln x and its range.
 0 otherwise
e  x , x  0
2. A r.v X has pdf f( x)   determine the pdf of Y  X 4
0 otherwise

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 12
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

3. Let X be a continuous random variable with density function f( x)  1


x2
for x  2 and
f( x)  0 otherwise . Determine the density function of Y  1
X 1
.
 2
  X 
4. The probability density function of X is given by f( x)   ( x  4)
2
Obtain
 0 otherwise

the probability density function of Y  tan1 ( 2x )
5. Which transformation will change a r.v X with pdf is as below to a uniform R.V Y whose
2e 2 x , x  0  1 (x - 3), 3  x  5
range is 0  x  1 a) f( x)   b) f( x)   2
 0 otherwise  0 otherwise
 
 for x  1
6. Suppose that X has probability density function f( x)   x ln  If U  X 2 , what
 0 , elsewhere
is the probability density function f(u) of U?

1.7 Expectation and Variance of a Random Variable

1.7.1 Expected Values


One of the most important things we'd like to know about a random variable is: what value
does it take on average? What is the average price of a computer? What is the average value
of a number that rolls on a die? The value is found as the average of all possible values,
weighted by how often they occur (i.e. probability)
Definition: Let X be a random variable with probability distribution p( X  x) . Then the
expected value of X, denoted E (X ) or  , is given by;
 
  xp ( X  x) if X is discrete
E( x)     x   .
  xp ( X  x)dx if X is continuous

Theorem: Let X be a r.v. with probability distribution p(X=x) and let g(x) be a real-valued
function of X. ie , then the expected value of g(x) is given by
 
  g ( x) p( X  x) if X is discrete
Eg( x)   x   .
 g ( x) p( X  x)dx if X is continuous


Theorem: Let X be a r.v. with probability distribution p( X  x) . Then
(i) E(c) = c, where c is an arbitrary constant.
(ii) Eax  b  a  b where a and b are arbitrary constants
(iii) Ekg(x)   kEg(x)  where g(x) is a function of X
n  n
(iv) Eag1 (x)  bg 2 (x)   aEg1 (x)   bEg 2 (x)  and in general E  ci g i (x)    ci Eg i (x) 
 i 1  i 1
are functions of X. This property of expectation is called linearity property
Proof

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 13
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

We will sketch the proof using a continuous random variable since the proof using the
discrete random variable is similar and was also discussed in probability and statistics I.
(i) Ec   cP ( X  x)dx  c  P( X  x)dx  c(1)  c
All x All x

(ii) Eax  b   (ax  b) P( X  x)dx   axP( X  x)dx   bP( X  x)dx


All x All x All x

a  xP( X  x)dx  b  P( X  x)dx  a  b


All x All x

(iii) Ekg(x)    kg( x) P( X  x)dx  k  g ( x) P( X  x)dx  kEg(x) 


All x All x

(iv) Eag1 (x)  bg 2 (x)    ag (x)  bg (x) P( X  x)dx   ag (x) P( X  x)dx   bg (x) P( X  x)dx
1 2 1 2
All x All x All x

 Eag1 (x)   Ebg 2 (x)   aEg1 (x)   bEg 2 (x)  ie from part iii

1.7.2 Variance and Standard Deviation


Definition: Let X be a r.v with mean E (X )   , the variance of X, denoted  2 or Var(X) , is
given by Var ( X )   2  E( X   ) 2 . The units for variance are square units. The quantity that has
the correct units is standard deviation, denoted  . It’s actually the positive square root
of Var(X) .
  Var ( X )  E ( X   ) 2 .
Theorem: Var ( X )  E ( X   ) 2  E ( X ) 2   2
Proof:

Var ( X )  E( X   )2  E X 2  2 X   2  E( X )2  2E( X )   2  E( X )2   2
Theorem: Var (aX  b)  a var( X ) 2

Proof:
Recall that EaX  b  a  b therefore

Var (aX  b)  E(aX  b)  (a  b)  Ea X     E a 2  X     a2 E  X     a 2 var( X )
2 2 2
  2

Remark
(i) The expected value of X always lies between the smallest and largest values of X.
(ii) In computations, bear in mind that variance cannot be negative!

Example 1
Given a probability distribution of X as below, find the mean and standard deviation of X.
X 0 1 2 3
P(X=x) 1/8 1/4 3/8 1/4

Solution
3
X 0 1 2 3 total E ( X )     xp ( X  x)  1.75 and
p ( X  x) 1
8
1
4
3
8
1
4 1 x 0

xp ( X  x) 0 1
4
3
4
3
4
7
4
standard deviation
x 2 p ( X  x) 0 1
4
3
2
9
4 4   E ( X 2 )   2  4  1.752  0.968246

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 14
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

Example 2 The probability distribution of a r.v X is as shown below, find the mean and
standard deviation of; a) X b) Y  12 X  6 .
X 0 1 2
P(X=x) 1/6 1/2 1/3
Solution
2
X 0 1 2 total E ( X )     xp ( X  x)  7 6 and
p ( X  x) 1
6
1
2
1
3 1 x 0

xp ( X  x) 2
E ( X 2 )   x 2 p( X  x)  116
1 2 7
0 2 3 6

x p ( X  x)
2
0 1
2
4
3
11
6 x 0

Standard deviation   E ( X 2 )   2  11
6  (7 6) 2  17
6  1.6833
Now E(Y )  12E( X )  6  12(7 6 )  6  20
Var (Y )  Var (12 X  6)  122  Var ( X )  144  17
6  242.38812
 1 x, 0  x  2
Example 3 A continuous r.v X has a pdf given by f(x)   2 , find the mean
 0, elsewhere
and standard of X
Solution

   
2 2
 4 
E(x)   xf( x)dx   2 x dx  6 x 0  and E(x )   x f( x)dx   12 x 3dx  18 x 4 0  2
2 2
1 2 1 3 2 2
 3  
0 0

Standard deviation   E ( X 2 )   2  2  ( 4 3 )2  3
2

Exercise 1.6
1. Suppose X has a probability mass function given by the table below
X 2 3 4 5 6
P(X=x) 0.01 0.25 0.4 0.3 0.04
Find the mean and variance of; X
2. Suppose X has a probability mass function given by the table below
X 11 12 13 14 15
P(X=x) 0.4 0.2 0.2 0.1 0.1
Find the mean and variance of; X

3. Let X be a random variable with P(X = 1) = 0.2, P(X = 2) = 0.3, and P(X = 3) = 0.5. What is the
expected value and standard deviation of; a) X b) Y  5 X  10 ?
4. A random variable W has the probability distribution shown below,
W 0 1 2 3
P(W=w) 2d 0.3 d 0.1
Find the values of the constant d hence determine the mean and variance of W. Also find
the mean and variance of Y  10 X  25
5. A random variable X has the probability distribution shown below,
X 1 2 3 4 5
P(X=x) 7c 5c 4c 3c c
Find the values of the constant c hence determine the mean and variance of X.
6. The random variable Z has the probability distribution shown below,
Z 2 3 5 7 11

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 15
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

1 1 1
P(Z=z) 6 3 4 x y
If E ( Z )  4 3 , find the values of x and y hence determine the variance of Z
2

 36
m
, m  1, 2 , 3 , ...,8
7. A discrete random variable M has the probability distribution f(m)   ,
 0 , elsewhere
find the mean and variance of M
 510
y
, y  1, 2 , 3 , 4
8. For a discrete random variable Y the probability distribution is f(y)   ,
 0 , elsewhere
calculate E (Y ) and var(Y)
kx for x  1, 2 , 3 , 4
9. Suppose X has a pmf given by f(x)   , find the value of the constant k
 0 , elsewhere
hence obtain the mean and variance of X
kx , x  2, 4, 6

10. A discrete random variable X has a probability function P( X  x)  k x  2, x  8
0, elsewhere

a) Show that k  181 hence find E (X ) and E ( X 2 )
b) Calculate var3  4 X  , give your answer to 3 significant figures.
11 A biased die with six faces is rolled. The discrete random variable X represents the score
of the uppermost face. The probability distribution of X is shown in the table below
X 1 2 3 4 5 6
P(X=x) A a a b B 0.3
a) Given that E(X) = 4.2, find the values of a and b.
 
b) Show that E X 2  20.4 c) Find var 5  3x 
k 1  x 2 , x  1,0,1,2
12 A discrete random variable X has probability function P( X  x)  
0, elsewhere
a) Show that k  16 c) Show that E ( X 2 )  43
b) Find E (X ) d) Find var 1  3x 
13 A team of 3 is to be chosen from 4 girl and 6 boys. If X is the number of girls in the
team, find the probability distribution of X hence determine the mean and variance of X
14 A fair six sided die has; ‘1’ on one face, ‘2’ on two of its faces and ‘3’ on the remaining
three faces. The die is rolled twice. If T is the total score write down the probability
distribution of T hence determine; a) the probability that T is more than 4. b) the mean
and variance of T
kr for 0  r  4
15 The pdf of a continuous r.v R is given by f(r)   , (a) Determine c. hence
 0 , elsewhere
Compute P(1 0  r  2) , E(X) and Var(X).
k (1  10
m
) for M  10
16 A continuous r.v M has the pdf given by f(m)   , find the value of
 0 , elsewhere
the constant k, the mean and the variance of X

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 16
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

k (1  x) for 0  x  1
17 A continuous r.v X has the pdf given by f(x)   , findt the value of
 0 , elsewhere
the constant k. Also find the mean and the variance of X
 d 2 if T  1
18 The lifetime of new bus engines, T years, has continuous pdf f(t)   t find the
 0 , if T  1
value of the constant d hence determine the mean and standard deviation of T
19 An archer shoots an arrow at a target. The distance of the arrow from the centre of the
k (3 + 2x - x 2 ) if x  3
target is a random variable X whose p.d.f. is given by f(x)   find
 0 , if x  3
the value of the constant k. Also find the mean and standard deviation of X
20 The random variable Y has probability density function f(y) given by
ky(a  y ), 0  x  3
f(y)   where k and a are positive constants.
 0, elsewhere
2
a) Explain why a ≥ 3 and then show that k 
9(a  2)
b) Given that E(Y) = 1.75 , show that a = 4 and write down the value of k.
c) For these values of a and k, sketch the probability density function,
d) Write down the mode of Y.
a  bx , 0  x  5
21 A continuous random variable x has the following pdf f( x)   where a and b
0 , otherwise
are constants. Show that 10a  25b  2

a) Given E  X  
35
, find a second equation in a and b hence find the values of a and b.
12
b) Find the median of X
22 The queuing time X minutes of a customer at a till of a supermarket has a pdf
 323 x(k  x) , 0  x  k
f( x)  
0 , otherwise
a) Show that k  4 . Also find E (x) and var(x)
b) Find the probability that a randomly chosen customers queuing time will differ from the mean
by at least half a minute
23 The probability density function f(x) can be written in the following form.
ax , 0  x  2

f( x)  b  ax , 2  x  4
0 , otherwise

a) Find the values of the constants a and b.
b) Show that σ, the standard deviation of X, is 0.816 to 3 decimal places.
c) Find the lower quartile of X.
d) State, giving a reason, whether P(2 – σ < X < 2 + σ) is more or less than 0.5
k (1  x) ,  1  x  0

24 A continuous r.v X has the pdf given by f(x)  2k (1  x), 0  x  1 , find the value of
 0 , elsewhere

the constant k. Also find the mean and the variance of X

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 17
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

e  x for x  0
25 A continuous r.v X has the pdf given by f(x)   , find the mean and
 0 , elsewhere
3x
standard deviation of; a) X b) Y  e 4

1.8 Mode, Median, Quartiles and Percentiles


Another measure commonly used to summarize random variables are the mode and median;
Mode
Mode is the value of x that maximizes the pdf. That is the value of x for which f ' (x) = 0 .
Suppose the p.d.f of a random variable X is defined by the function f(x) for a ≤ x ≤ b.
The mode of X is an x value that produces the largest value for f(x) in the interval a ≤ x ≤ b.
A sketch of the probability density function can be very helpful when determining the mode.

For the 3rd figure, mode can be found using differentiation.

Median
The median, m, of a random variable X is defined to be the value such that “half of the
distribution lies to the left of m and half to the right”. More formally, m should
satisfy FX (m) = P(X  m)  0.5 where F is the cumulative distribution function of X.
Note: If there is a value m such that the graph of y= f(x) is symmetric about x=m, then both
the expected value and the median of X are equal to m.

The lower quartile Q l and the upper quartile Q 3 are similarly defined by
FX (Ql ) = 0.25 and FX (Q3 ) = 0.75
Thus, the probability that X lies between Q l and Q 3 is 0.75 - 0.25 = 0.5 , so the quartiles give
an estimate of how spread-out the distribution is. More generally, we define the nth percentile
of X to be the value of xn such that FX (x n ) = 0.01n or n 100 , that is, the probability that X is
smaller than xn is n%.
2 x, 0  x  1
Example A random variable X has the pdf given by f(x)   State the mode
 0 , elsewhere
hence find the lower, middle and upper quartiles.
Solution
On the interval 0  x  1, f(x) is maximized at x  1 so the mode is 1
On the interval 0  x  1, the cdf of X is given by F(x)  x 2 thus
a) At lower quartile Q l , F(Ql )  Ql  0.25  Ql  0.25  0.5
2

b) At median m, F(m)  m2  0.5  m  0.5  1


2

c) At upper quartile u F(Q3 )  Q3  0.75  Q3  0.75 


2 3
2

Qn Find the 64th percentile of the pdf in the above example.

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 18
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

Exercise 1.7
k (1  x) for 0  x  1
1) A continuous r.v X has the pdf given by f(x)   , find the mode.
 0 , elsewhere
 x 2 ( x  2) 0  x  2
2) A random variable X has p.d.f. f(x)   Find the mode of X.
 0 , otherwise
 1 e  2x for x  0
3) Let X be a continuous random variable with density function f(x)   2 .
 0 , elsewhere
Determine the 25th percentile of the distribution of X.
4) A random variable X is defined by the cumulative distribution function
0, x  2

F( x)  k ( x 2  x  6), 2  x  5
1, x  5

a) Find the value of the constant k hence work out P(3 ≤ X ≤ 4).
b) Obtain and sketch the probability density function.
c) State the mode. Also find median value and the interquartile range.
k ( x 2  2 x  3)11  x  2

5) A random variable X has p.d.f. f(x), where f(x)  k (2  12 x) 2  x  4
 0 , otherwise

a) Find the C.D.F of X and verify that the lower quartile is at x = 2.


b) Obtain the mode andt the median value of X.

2. PROBABILITY DISTRIBUTION
2.1 Discrete Distribution
Among the discrete distributions that we will discuss in this topic includes the Bernoulli,
binomial, Poisson, geometric and hyper-geometric

Definition: A Bernoulli trial is a random experiment in which there are only two possible
outcomes - success and failure. Eg
 Tossing a coin and considering heads as success and tails as failure.
 Checking items from a production line: success = not defective, failure = defective.
 Phoning a call centre: success = operator free; failure = no operator free.
A Bernoulli random variable X takes the values 0 and 1 and P( X  1)  p and
P( X  0 )  1  p
Definition: A r.v X is said to be a real Bernoulli distribution if it’s pmf is given by;
 p x (1  p)1 x for x  0 ,1
P( X  x )  
 0 otherwise
We abbreviate this as X ~ B(p) ie p is the only parameter here. It can be easily checked that
the mean and variance of a Bernoulli random variable are   p and  2  p(1  p1)

2.1.1 Binomial Distribution


Consider a sequence of n independent, Bernoulli trials, with each trial having two possible
outcomes, success or failure. Let p be the probability of a success for any single trial. Let X

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 19
Time is precious, but we do not know yet how precious it really is. We will only know when we are no longer able to take advantage of it…

denote the number of successes on n trials. The random variable X is said to have a binomial
distribution and has probability mass function
P( X  x )n Cr  p x (1  p)n  x for x  0 ,1, 2 ..... n
We abbreviate this as X ~ Bin ( n , p) read as “X follows a binomial distribution with
parameters n and p ”. n Cr Counts the number of outcomes that include exactly x successes
and n  x failures.
The mean and variance of a Binomial random variable are respectively given by;
  np and  2  np(1  p1)
n
Let’s check to make sure that if X has a binomial distribution, then  P( X  x )  1 . We will
x 0
need the binomial expansion for any polynomial:
n n
 p  q n   n Cr  p x q n  x therefore  n Cx  p x (1  p)n  x   p  1  p n  1n  1
x 0 x 0

Example 1
A biased coin is tossed 6 times. The probability of heads on any toss is 0:3. Let X denote the
number of heads that come up. Calculate: (i) P( X  2 ) (ii) P( X  3) (iii) P(1  X  5 )
Solution
If we call heads a success then X has a binomial distribution with parameters n=6 and p=0:3.
(i) P( X  2 )6 C2  (0.3)2 (0.7)4  0.324135
(ii) P( X  3 )6 C3  (0.3)3 (0.7)3  0.18522
(iii) P(1  X  5 )  P( X  2 )  P( X  3 )  P( X  4 )  P( X  5 )
 0.324  0.185  0.059  0.01  0.578

Example 2 A quality control engineer is in charge of testing whether or not 90% of the
DVD players produced by his company conform to specifications. To do this, the engineer
randomly selects a batch of 12 DVD players from each day's production. The day's
production is acceptable provided no more than 1 DVD player fails to meet specifications’.
Otherwise, the entire day's production has to be tested.
a) What is the probability that the engineer incorrectly passes a day's production as
acceptable if only 80% of the day's DVD players actually conform to specification?
b) What is the probability that the engineer unnecessarily requires the entire day's
production to be tested if in fact 90% of the DVD players conform to specifications?
Solution
Let X denote the number of DVD players in the sample that fail to meet specifications.
a) In part a we want P( X  1) with binomial parameters n  12 and p  0.2
P( X  1)  P( X  0 )  P( X  1) 12 C0  (0.2) 0 (0.8)12 12 C1  (0.2)1 (0.8)11
 0.069  0.206  0.275
b) In part b we require P( X  1)  1  P( X  1) with parameters n  12 and p  0.1 .
P( X  1)  P( X  0 )  P( X  1) 12 C0  (0.1)0 (0.9)12 12C1  (0.1)1 (0.9)11  0.659
So P(X  1)  0.341

Example 3 Bits are sent over a communications channel in packets of 12. If the probability
of a bit being corrupted over this channel is 0.1 and such errors are independent, what is the
probability that no more than 2 bits in a packet are corrupted?

Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty By J. K. Kiingati Page 20

You might also like