You are on page 1of 14

EE319 Probability & Random Processes (Spring 2020)

Lecture 2020-04-24

Problems on Bin, Geo, NB

Prof. Dr.-Ing. Mukhtar Ullah


Head of Electrical Engineering
FAST NUCES, Islamabad
The plotting problem
Plot 𝑃 (𝑋 > 𝑥) for a geometric distribution with proba-
bility 0.5 of success.

Solution
Clearly, 𝑋 ∼ Geo0.5 with support ℕ. Since
𝑃 (𝑋 > 𝑥) = 1 − 𝐹𝑋 (𝑥) ,
reflect the CDF plot about the x-axis to get a plot of
−𝐹𝑋 (𝑥) and shift that upward by one unit along the
y-axis.
1.0

0.8

0.6

0.4

0.2

0.0
1 2 3 4 5

1.0

0.8

0.6

0.4

0.2

0.0
1 2 3 4 5
The syntax-error problem
A seasoned programmer makes, on average, one syn-
tax error every third effective page. By effective page is
meant 30 effective lines of code excluding any blank or
comment-only lines. Specify the most adequate distri-
bution for each of the following.
1. The number of syntax errors in a randomly chosen
code of 900 effective lines

2. The number of lines scanned by a compiler to find


the first error

Solution
View each effective line as Bernoulli experiment and a
syntax error, on that line, as a success. For simplicity,
assume that the programmer can make only one syntax
error on any effective line. Alternatively, assume, that
the compiler only records the first syntax error on each
effective line. It is safe to assume that scanning the
effective lines results in a sequence of Bernoulli trials.
“one syntax error every third effective page” translates
to “one syntax error every 90th effective line”, which, in
turn, translates to a relative frequency of 1/90. We can
thus assume a probaility 1/90 of success.
Define RVs
𝑋 ↔ ‘The number of syntax errors in a randomly chosen code of 900 effective lines’
𝐾 ↔ ‘The number of lines scanned by a compiler to find the first error’
Clearly, 𝑋 ∼ Bin900,1/90 and 𝐾 ∼ Geo1/90 .
The playlist problem
An mp3 playlist contains 40 songs in English and 20 in
Urdu. The mp3 player provides a random play function
which allows the user to specify the number of songs to
play and choose one of the two options: with replace-
ment and without replacement.

1. Which option must the user choose so that the


selections can be modeled as Bernoulli trials?

2. With the option chosen above, write an expression


for the number of songs to play so that at least one
Urdu song is more than 90% likely.
Solution
View each song played as a Bernoulli experiment and an
Urdu song as a success. The sequence of songs played
will Bernoulli trials (if and) only if the option “with
replacement” is chosen. The probability of success is
then 20/60.
Define RVs
𝑋𝑛 ↔ ‘The number of Urdu songs in 𝑛 songs played’
Clearly, 𝑋𝑛 ∼ Bin𝑛,1/3 , but we are required to find the
right value of 𝑛 so that
0.9 < 𝑃 (𝑋𝑛 ≥ 1) = 1 − 𝑃 (𝑋𝑛 = 0)
or, equivalently,
0.1 > 𝑃 (𝑋𝑛 = 0) = Bin (0; 𝑛, 1/3) = (2/3) 𝑛
or, equivalently,
(3/2) 𝑛 > 10
or, equivalently,
log 10
𝑛> ≈ 5.678
log 3/2
Thus, at least six songs must be played to ensure the
required probability.

Random walk of a particle


A particle moves along an integer grid in the positive
quadrant of the plane until it is absorbed on either the
x-axis or the y-axis, whichever is reached first. The steps
of the particle are independent of each other. At any
point on the grid, the particle moves left with probability
𝑝 and down with probability 1 − 𝑝. Suppose that the
particle starts at the point (𝑚, 𝑛). What is the probability
of absorption at the point (0, 𝑘) for 𝑘 ∈ {1, 2, . . . , 𝑛}?

Solution
View as success a step to the left made by the particle.
Then, the random walk of the particle can be seen as a
sequence of independent Bernoulli trials each having
success probability 𝑝.
Define RVs
𝑋 ↔ ‘The number of moves until the 𝑚th left move’
Clearly, 𝑋 ∼ NB𝑚,𝑝 , and the required probability is
 
𝑚+𝑛−𝑘−1 𝑚
𝑃 (𝑋 = 𝑚 + 𝑛 − 𝑘) = NB (𝑚 + 𝑛 − 𝑘; 𝑚, 𝑝) = 𝑝 (1 − 𝑝) 𝑘−𝑚
𝑚−1
for 𝑘 ∈ {1, 2, . . . , 𝑛}.

The water boring problem


Water boring service is very expensive and, on top of that,
the water table in a region is unpredictably low. Assume
that, on the average, only a tenth of boring attempts
are successful (within an agreed threshold depth) in the
region. Five friends have pooled their money to get an
economical deal with a water boring company. Write
the distribution of the number of boring attempts to find
the water table for the all the five friends so as to avail
the deal.
Solution
The boring attempts can be modeled as Bernoulli tri-
als each with probability 1/10 of success (i.e., reaching
water table). Define RV
𝑋 ↔ ‘The number of boring attempts until the 5th water table’
Clearly, 𝑋 ∼ NB5,0.1 .

Data communication
Data transmission, as bytes, over a computer interface
is prone to errors. The error in each transmitted byte,
however, is detected with probability 𝑝. If six errors
occur in a ten byte long sequence, the error correction
scheme in place requests a retransmission as soon as
the sixth error is detected. What is the probability of a
retransmission request placed?

Solution
View the error detection as a success. The bytes trans-
mitted can be modeled as Bernoulli trials each with
probability 𝑝 of success. Define RV
𝑋 ↔ ‘The number of bytes transmitted until 6th error detection’
Clearly, 𝑋 ∼ NB6,𝑝 , and the requited probability is
10 10  
Õ Õ 𝑘−1 6
𝑃 (𝑋 ∈ [6 · ·10]) = NB (𝑘; 6, 𝑝) = 𝑝 (1 − 𝑝) 𝑘−6
5
𝑘=6 𝑘=6

The 3-pizza problem


Ten friends went to eat pizza. They ordered one large
pizza, one medium pizza, and one small pizza. The
large pizza has nine slices, the medium has six slices,
and the small has four slices. What is the probability
that a person will have (at least) a slice from each pizza?

Solution
The RVs
𝑋𝑛 ↔ ‘The number of slices a person gets from the pizza with 𝑛 slices’
are distributed as 𝑋𝑛 ∼ Bin𝑛,1/10 because any particu-
lar slice from a particular pizza can go to each person
with the same probability 1/10. It is safe to assume in-
dependence among the three RVs. The probability that
a person will have a slice from each pizza is
𝑃 (𝑋9 = 1, 𝑋6 = 1, 𝑋4 = 1) = 𝑃 (𝑋9 = 1) 𝑃 (𝑋6 = 1) 𝑃 (𝑋3 = 1)
= Bin (1; 9, 1/10) Bin (1; 6, 1/10) Bin (1; 4, 1/10)
     8      5      3
9 1 9 6 1 9 4 1 9
= × × ≈ 0.04
1 10 10 1 10 10 1 10 10
The probability that a person will have at least a slice
from each pizza is
𝑃 (𝑋9 ≥ 1, 𝑋6 ≥ 1, 𝑋4 ≥ 1) = 𝑃 (𝑋9 ≥ 1) 𝑃 (𝑋6 ≥ 1) 𝑃 (𝑋3 ≥ 1)
= [1 − 𝑃 (𝑋9 = 0)] [1 − 𝑃 (𝑋6 = 0)] [1 − 𝑃 (𝑋4 = 0)]
= [1 − Bin (0; 9, 1/10)] [1 − Bin (0; 6, 1/10)] [1 − Bin (0; 4, 1/10)]
"  9# "  6# "  4#
9 9 9
= 1− 1− 1− ≈ 0.08
10 10 10

You might also like