lecturenotes3-10
lecturenotes3-10
2.1 Introduction
A random variable, denoted by a capital letter such as X, is a function mapping from
each outcome in a sample space to the real line:
X : S → R.
{ {
1, if S = HHH 3, if three heads
Z = 2, if S = {HTT, THT, TTH} X = 2, if two heads
3, otherwise 1, if one head
0, if no heads
31
32 Chapter 2. Discrete Random Variables (LECTURE NOTES 3)
The pmf can be described by table, graph or function, these descriptions are called
the distribution of the random variable.
random variable, Z probability mass function (pmf ), f(z) random variable, X probability mass function (pmf ), f(x)
{ {
3, if three heads 1/8, if x = 3
{ 1, if S = HHH
Z = 2, if S = {HTT, THT, TTH}
3, otherwise {
1/8, if z = 1
f(z) = 3/8, if z = 2
4/8 , if z = 3
X = 2, if two heads
1, if one head
0, if no heads
f(x) = 3/8, if x = 2
3/8 , if x = 1
1/8, if x = 0
Figure 2.2: Examples of random variable and probability mass function (pmf)
variable X is
X
F (b) = P (X ≤ b) = f (x), for all real numbers b.
x≤b
The mode of discrete random variable X is the value of X where the pmf is a maxi-
mum. The median is the smallest number m such that
A random variable with two modes is bimodel, with two or more modes, multimodal.
x 0 2 4 6 8 10
f (x) 0.17 0.21 0.18 0.11 0.16 0.17
0 2 4 6 8 10 0 2 4 6 8 10 0 2 4 6 8 10
x x x
(a) (b) (c)
i. Function (a).
0.17, if x = 0
P (X = x) =
0.21, if x = 2
ii. Function (b).
0.18, if x = 4
P (X = x) =
0.11, if x = 6
iii. Function (c).
0.17, if x=0
0.21, if x=2
0.18, if x=4
P (X = x) =
0.11, if x=6
0.16, if x=8
0.17, if x = 10
3. Flipping until a head comes up. A (weighted) coin has a probability of p = 0.7
of coming up heads (and so a probability of q = 1 − p = 0.3 of coming up tails).
Let X be the number of flips until a head comes up or until a total of 4 flips
are made.
P (X ≥ 3 ∩ X ≥ 2) P (X ≥ 3) 0.063 + 0.027
P (X ≥ 3|X ≥ 2) = = = =
P (X ≥ 2) P (X ≥ 2) 1 − 0.7
(a) The chance the first bull’s eye occurs on the first try is, of course, 15%.
The chance the first bull’s eye occurs on the second try equals the chance
a miss occurs on the first try and a bull’s eye occurs on the second try,
f (2) = (0.85)0.15 = (i) 0.1155 (ii) 0.1275 (iii) 0.1385 (iv) 0.2515.
(b) The chance the first bull’s eye occurs on the third try is equal to the chance
of two misses and then a bull’s eye occurs on the third try,
f (3) = (0.85)(0.85)0.15 = (0.85)2 0.15 ≈
(i) 0.078 (ii) 0.099 (iii) 0.108 (iv) 0.158.
(c) The chance the first bull’s eye occurs on the fourth try is
f (4) = (0.85)3 0.15 ≈
(i) 0.078 (ii) 0.092 (iii) 0.108 (iv) 0.151.
36 Chapter 2. Discrete Random Variables (LECTURE NOTES 3)
(d) The chance the first bull’s eye occurs on the eleventh try, x = 11, is
f (11) = q x−1 p = (0.85)11−1 0.15 ≈
(i) 0.01 (ii) 0.02 (iii) 0.03 (iv) 0.04.
(e) Since the chance the first bull’s eye occurs on the xth try is f (x) = q x−1 p,
then the sum of this series
∞ ∞
X X X p
f (x) = f (x) = q x−1 p = =
x∈R x=1 x=1
1−q
p
(i) p (ii) q (iii) q
(iv) 1.
x 0 1 2
f (x) = P (X = x) 0.25 0.5 0.25
1 1
0.75 0.75
0.50 0.50
0.25 0.25
0 1 2 0 1 2
(a) density (b) distribution
(a) f (0) = P (X = 0) =
(i) 0 (ii) 0.25 (iii) 0.50 (iv) 0.75.
(b) f (1) = P (X = 1) =
(i) 0 (ii) 0.25 (iii) 0.50 (iv) 0.75.
(c) f (2) = P (X = 2) =
(i) 0 (ii) 0.25 (iii) 0.50 (iv) 0.75.
(d) F (0) = P (X ≤ 0) = P (X = 0) =
(i) 0 (ii) 0.25 (iii) 0.75 (iv) 1.
Section 2. Probability Mass Functions (LECTURE NOTES 3) 37
(e) F (1) = P (X ≤ 1) = P (X = 0) + P (X = 1) =
(i) 0 (ii) 0.25 (iii) 0.75 (iv) 1.
(f) F (2) = P (X ≤ 2) = P (X = 0) + P (X = 1) + P (X = 2) =
(i) 0 (ii) 0.25 (iii) 0.75 (iv) 1.
(g) Also, if b < 0, F (b) = P (X ≤ b) =
(i) 0 (ii) 0.25 (iii) 0.75 (iv) 1.
(h) And, if b ≥ 2, F (b) = P (X ≤ b) =
(i) 0 (ii) 0.25 (iii) 0.75 (iv) 1.
(i) So, in this case,
0, b<0
0.25, 0≤b<1
F (b) =
0.75,
1≤b<2
1, b ≥ 2.
(a) f (0) = P (X = 0) =
(i) 0 (ii) 16 (iii) 13 (iv) 12 .
(b) f (1) = P (X = 1) = P (X ≤ 1) − P (X ≤ 0) = F (1) − F (0) =
(i) 0 (ii) 16 (iii) 13 (iv) 12 .
38 Chapter 2. Discrete Random Variables (LECTURE NOTES 3)
1 1
1/2 1/2
1/3 1/3
1/6
0 1 2 0 1 2
(a) density (b) distribution
(a) Number of Ears of Corn. The number of ears of corn, Y , on a typical corn
plant has the following probability distribution.
x 0 2 4 6 8 10
f (x) 0.17 0.21 0.18 0.11 0.16 0.17
The mode number of ears of corn with largest probability,
(i) 0 (ii) 2 (iii) 4 (iv) 6.
0 0
0 2 4 6 8 10 0 1 2 3
x x
(a) mode and median number of ears of corn (b) mode and median number of swallows
than or equal to this number and also at least a 50% of getting more than
this number), in other words the median m =
i. 2 ears of corn since there is a 17% + 21% = 38% chance of getting
less than or equal to 2 ears and a 21% + 18% + 11% + 16% + 17%
= 83% chance of getting 2 or more.
ii. between 2 and 4 ears of corn since there is a 17% + 21% = 38% chance
of getting less than or equal to 2 ears and a 18% + 11% + 16% + 17%
= 62% chance of getting 4 or more.
iii. 4 ears of corn since there is a 17% + 21% + 18% = 56% chance of
getting less than or equal to 4 ears and a 18% + 11% + 16% + 17%
= 62% chance of getting 4 or more
(b) Swallows. The number of swallows, X, in any group of three birds is given
by the following probability distribution.
X 0 1 2 3
1 3 3 1
P (X = x) 8 8 8 8
iii. m = 2 because
7 4
P (X ≤ 2) = ≥ 0.5 and P (X ≥ 2) = ≥ 0.5.
8 8
Random variable X is the number of type I objects from the sample of size n; N1 ,
N2 , N , and n are all parameters of this pmf.
where random variable X is the number of successes in n trials; n and p are parameters
of this pmf and “X is b(n, p)” means random variable X is a binomial with parameters
n and p.
The unusual-event principle says if we make an assumption and this assumption leads
to only a small chance of an event occurring, the event is unusual, then the assumption
Section 3. The Hypergeometric and Binomial Distributions (LECTURE NOTES 3)41
is probably incorrect. For example, if we assume X is b(n, p), but find out the observed
event of x successes in n trials is unusual because
P (X ≤ x) ≤ 0.05 or P (X ≥ x) ≤ 0.05,
[1] 0.125
[1] 0.375
[1] 0.0003069143
[1] 9.083563e-06
[1] 0.9999999
[1] 0.3672717
(a) The chance two of the second group of captured fish are tagged is
N1 N2
x n−x
f (2) = =
N
n
32 ×
N
45 ×
N − 45
45 ×
N
2 43 2 32 − 2 43 2
(i) (ii) (iii) ,
N
N
N
3200 32 3200
(b) Guess N = 500. In this case, chance two of 32 fish chosen are tagged is
N1 N2 45 500 − 45
×
x n−x 2 32 − 2
f (2) = = =
N 500
n 32
[1] 0.2405091
44 Chapter 2. Discrete Random Variables (LECTURE NOTES 3)
(c) Guess N = 750. In this case, chance two of 32 fish chosen are tagged is
N1 N2 45 750 − 45
×
x n−x 2 32 − 2
f (2) = = =
N 750
n 32
[1] 0.2853607
(d) Guess N = 1000. In this case, chance two of 32 fish chosen are tagged is
f (2) = (i) 0.24 (ii) 0.26 (iii) 0.29 (iv) 0.32.
dhyper(2,45,955,32) # hypergeometric pmf
[1] 0.2570794
[1] 0.05750646
[1] 0.00473836
[1] 0.9951152
[1] 0.9998536
[1] 0.00488477
(f) Since
P (X ≤ 3) ≈ 0.999 > 0.05 and P (X ≥ 3) ≈ 0.005 < 0.05,
it (i) is (ii) is not unusual 3 engines fail, assuming 11% engine failure.
6. Binomial distribution: shaded region.
Let 0 ≤ x ≤ 1, 0 ≤ y ≤ 1, where part of the square, x < y, is shaded.
x<y
y
0 1
x
(a) If points are taken at random from this square, determine the probability
of choosing a point from the shaded region, which is half the square.
p = (i) 0.025 (ii) 0.050 (iii) 0.069 (iv) 0.500.
(b) If two points are taken at random from a square, what is the chance both
are from the shaded region? Clearly,
p2 = 0.52 = (i) 0.25 (ii) 0.50 (iii) 0.069 (iv) 0.119
or, using
binomial
pmf, since p = 0.5, n = 2, and x = 2, then
2
f (2) = 0.52 0.50 = (i) 0.25 (ii) 0.050 (iii) 0.069 (iv) 0.119.
2
dbinom(2,2,0.5) # binomial pmf
[1] 0.25
(c) If ten points are taken at random from a square, what is the chance seven
are from the shaded region? Using binomial pmf, since p = 0.5, n = 10,
and x =7, then
10
f (7) = 0.57 0.53 = (i) 0.117 (ii) 0.252 (iii) 0.369 (iv) 0.419.
7
Section 3. The Hypergeometric and Binomial Distributions (LECTURE NOTES 3)47
[1] 0.1171875
(d) If n = 11,
p =0.5, x = 3, then
11
f (3) = 0.53 0.58 = (i) 0.081 (ii) 0.231 (iii) 0.258 (iv) 0.319.
3
dbinom(3,11,0.5) # binomial pmf
[1] 0.08056641
[1] 0.984375
[1] 0.1035156
(f) Since
8. Lawyer. A lawyer estimates she wins 40% (p = 0.4) of her cases. Assume
each trial is independent of one another and, in general, this problem obeys
the conditions of a binomial experiment. The lawyer presently represents 10
(n = 10) defendants.
(a) The tabular form of this distribution is given by,
48 Chapter 2. Discrete Random Variables (LECTURE NOTES 3)
r 0 1 2 3 4 5 6 7 8 9 10
P (R = r) 0.006 0.040 0.121 0.215 0.251 0.201 0.111 0.043 0.011 0.002 0.000
p(y)
0.40
0.30
0.20
0.10
0 1 2 3 4 5 6 7 8 9 10
number of cases won, y
Since P (X > 3) = 1 − P (X ≤ 3) ≈
(i) 0.46 (ii) 0.58 (iii) 0.62 (iv) 0.67,
1 - pbinom(3,10,0.4) # 1 - binomial cdf
[1] 0.6177194
and
P (X > 4 + 3, X > 4) P (X > 4 + 3) P (X > 7)
P (X > 4+3|X > 4) = = = ≈
P (X > 4) P (X > 4) P (X > 4)
[1] 0.03350957
[1] 0.0003069143
50 Chapter 2. Discrete Random Variables (LECTURE NOTES 3)
[1] 0.0004400499
10. Multinomial: faculty and subjects. There are 9 different faculty members and
3 subjects: mathematics, statistics and physics. There is a 50%, 35% and 15%
chance a faculty member teaches mathematics, statistics and physics, respec-
tively.
[1] 0.07596914
[1] 0.08863066
If n ≥ 100, np ≤ 100, Poisson pmf can be used to approximate binomial pmf where
λ = np.
λx −λ 50 −5
f (0) = e = e ≈
x! 0!
(i) 0.007 (ii) 0.008 (iii) 0.009.
dpois(0,5) # Poisson pmf
[1] 0.006737947
λx −λ 52 −5
f (2) = e = e ≈
x! 2!
(i) 0.06 (ii) 0.07 (iii) 0.08.
dpois(2,5) # Poisson pmf
[1] 0.08422434
50 −5 51 −5 52 −5
P (X ≤ 2) = e + e + e ≈
0! 1! 2!
(i) 0.08 (ii) 0.12 (iii) 0.18.
ppois(2,5) # Poisson cdf
[1] 0.124652
52 Chapter 2. Discrete Random Variables (LECTURE NOTES 3)
52 −5 53 −5
P (X ≥ 2) = e + e + · · · forever
2! 3!
= 1 − P (X < 2) = 1 − P (X ≤ 1)
= 1 − [P (0) + P (1)]
0
5 −5 51 −5
= 1− e + e ≈
0! 1!
[1] 0.9595723
(5 · 2)2 −5·2
P (2) = e ≈
2!
(i) 0.002 (ii) 0.005 (iii) 0.006.
dpois(2,10) # Poisson pmf, 2 x 5 = 10
[1] 0.002269996
P (X ≤ 3) ≈
[1] 0.01033605
[1] 0.4409074
λx −λ 2.50 −2.5
f (0) = e = e ≈
x! 0!
(i) 0.07 (ii) 0.08 (iii) 0.09.
dpois(0,2.5) # Poisson pmf
[1] 0.082085
P (X ≤ 2) ≈
[1] 0.5438131
P (2 ≤ X ≤ 4) = P (X ≤ 4) − P (X < 2) = P (X ≤ 4) − P (X ≤ 1) ≈
[1] 0.6038805
P (2 ≤ X ≤ 4) = P (X ≤ 4) − P (X < 2) = P (X ≤ 4) − P (X ≤ 1) ≈
[1] 0.1273606
(a) Assume n = 2000 particles are released by iron per microsecond, and
there is a chance p = 0.005 that a particle hits the surrounding field per
microsecond. Since n = 2000 and p = 0.005, then n = 2000 > 100 and
np = 2000(0.005) = 10 ≤ 100 and so the conditions for approximation are
satisfied (ii) violated.
(Exact) binomial
2000!
f (15) = × (0.005)15 × (0.995)1985 ≈
15!(2000 − 15)!
[1] 0.03463059
Approximate Poisson.
since λ = np = 2000(0.005) = (i) 5 (ii) 10 (iii) 15 (iv) 20, then
1015 −10
f (15) = e ≈
15!
(i) 0.00234 (ii) 0.0347 (iii) 0.0445 (iv) 0.0645
dpois(15,10) # approximate Poisson pmf
[1] 0.03471807
(Exact) binomial
1500!
f (15) = × (0.01)15 × (0.99)985 ≈
15!(1500 − 15)!
[1] 0.1029519
Approximate Poisson
since λ = np = 1500(0.01) = (i) 5 (ii) 10 (iii) 15 (iv) 20, then
1515 −15
f (15) = e ≈
15!
(i) 0.1024 (ii) 0.1030 (iii) 0.1345 (iv) 0.1445
dpois(15,15) # approximate Poisson pmf
Section 4. The Poisson Distribution (LECTURE NOTES 3) 55
[1] 0.1024359
1 2 3 4 5 6 7
time subintervals
(a) The Poisson process assumes all time subintervals are created so small one
and only one photon could hit the magnetic detection field during each
subinterval. During seven time subintervals shown in Figure 2.9, three
hits occur in time subintervals 1, 2 and 7 and four misses occur in time
subintervals 3, 4, 5 and 6.
(i) True (ii) False
(b) The Poisson process assumes the chance a photon hits the magnetic de-
tection field during any one time subinterval is p and the chance it misses
is q = 1 − p. It is impossible to have more than one photon hit the mag-
netic detection field during any time subinterval. Consequently, the time
subintervals are infinitesimally small.
(i) True (ii) False
(c) The Poisson process assumes a hit in each time subinterval is independent
of any other hit in other nonoverlapping subintervals.
(i) True (ii) False
(d) If there was a 20% chance, p = 0.2, a photon hit the magnetic detection
field during any time subinterval then the chance of y = 3 hits in the n = 7
time subintervals is given by the binomial,
n x n−x 7
f (3) = p q = 0.23 0.87−3 ≈
x 3
(i) 0.089 (ii) 0.115 (iii) 0.124 (iv) 0.134.
56 Chapter 2. Discrete Random Variables (LECTURE NOTES 3)
[1] 0.114688
(e) If a large number of time subintervals are considered; in other words, as, n
gets bigger, in fact, as n → ∞, it becomes increasingly difficult to calculate
the probability of a number of hits using the binomial. In this case, the
poisson is used instead.
(i) True (ii) False
(f) In general,
λx −λ
n
lim px q n−x = e
n→∞ x x!
where λ = np.
(i) True (ii) False
x 0 1 2 3
frequency 70 17 2 1
(a) Fill in the blank for the relative frequency of stars per tile table:
Section 4. The Poisson Distribution (LECTURE NOTES 3) 57
x 0 1 2 3
frequency 70 17 2 1
70
relative frequency 90
≈ 0.78 0.19 0.02
(b) Average number of stars per tile is
24
λ=
90
(i) 0.21 (ii) 0.24 (iii) 0.27 (iv) 0.29.
(c) Assuming Poisson where λ = 0.27, chance x = 0 stars on one tile is
λx −λ 0.270 −0.27
f (0) = e = e ≈
x! 0!
(i) 0.01 (ii) 0.02 (iii) 0.19 (iv) 0.76.
dpois(0,0.27) # Poisson pmf
[1] 0.7633795
(d) Fill in the blank for the Poisson pmf f (x) of stars per tile table:
x 0 1 2 3
frequency 70 17 2 1
70
relative frequency 90
≈ 0.78 0.19 0.02 0.01
f (x) 0.76 0.03 0.00
The Poisson pmf (i) is (ii) is not a close approximation to the relative
frequency of stars per tiles.
dpois(0:3,0.27) # Poisson pmf for 0,1,2,3