Eec 161 Ch02-Annotated
Eec 161 Ch02-Annotated
Sequential Experiments
Section 2.1
Tree Diagrams
ree ia rams
For the resistors of Example 1.19, we used A to denote the event that
a randomly chosen resistor is “within 50 ⌦ of the nominal value.” This
could mean “acceptable.” We use the notation N (“not acceptable”) for
the complement of A. The experiment of testing a resistor can be viewed
as a two-step procedure. First we identify which machine (B1, B2, or B3)
produced the resistor. Second, we find out if the resistor is acceptable.
Draw a tree for this sequential experiment. What is the probability of
choosing a resistor from machine B2 that is not acceptable?
Example 2.1 Solution
0.8
⇠⇠⇠ A •B1 A 0.24 This two-step procedure is shown
⇠⇠⇠
⇠⇠ 0.06
0.3 B1 0.2 N •B1 N in the tree on the left. To use the
0.9
⇠ A •B2 A
⇠⇠ 0.36
HH
0.4 ⇠⇠⇠
B2 XXXX
⇠⇠ tree to find the probability of the
H XXXX
HH
H 0.1 N •B2 N 0.04 event B2N , a nonacceptable re-
0.3 HH
B3 XXXX0.6 A •B3 A 0.18
XX
XX
sistor from machine B2, we start
0.4 N •B3 N 0.12
at the left and find that the prob-
ability of reaching B2 is P[B2] = 0.4. We then move to the right to B2N
and multiply P[B2] by P[N |B2] = 0.1 to obtain P[B2N ] = (0.4)(0.1) =
0.04.
PC Ba NJ P C NI BI PCB
B A A BE PCBs
PC P
0 X 0.3 0,18
Example 2.2 Problem
A A
s
Ge n
PC Gil
pl
G Uri
p Gan
Example 2.2 Solution
0.8 G2 •G1 G2
⇠
⇠⇠ 0.4 The tree for the two-light
I
experi-
⇠ ⇠⇠⇠
⇠
0.5 G ⇠⇠
1 XXXXX ment is shown on the left. The prob-
XXX
X
X 0.1
0.2 R2 •G1 R2 ability that the second light is green
HH
H
HH
is
H 0.2
⇠⇠⇠
⇠G2 •R1 G2 0.1
HH
⇠⇠⇠⇠
0.5 H
H R ⇠⇠
1 XXXXX
XXX
P [G2] = P [G1G2] + P [R1G2]
X
X R2 •R1 R2 0.4
0.8
= 0.4 + 0.1 = 0.5. (1)
The event W that you wait for at least one light is the event that at least
one light is red.
Suppose you have two coins, one biased, one fair, but you don’t know
which coin is which. Coin 1 is biased. It comes up heads with probability
3/4, while coin 2 comes up heads with probability 1/2. Suppose you pick
a coin at random and flip it. Let Ci denote the event that coin i is picked.
Let H and T denote the possible outcomes of the flip. Given that the
outcome of the flip is a head, what is P[C1|H], the probability that you
picked the biased coin? Given that the outcome is a tail, what is the
probability P[C1|T ] that you picked the biased coin?
Example 2.3 Solution
First, we construct the sample tree on the
3/4 ⇠⇠
⇠ H •C1 H 3/8
⇠⇠
⇠⇠ left. To find the conditional probabilities,
⇠⇠
⇠ C1 ⇠
1/2 ⇠⇠ T •C1 T 1/8 we see
⇠ 1/4
⇠⇠⇠
⇠⇠⇠
XXXX
XXX P [C1 H]
XX
X
1/2 C2 XXX
1/2
H •C2 H 1/4 P [C1 |H] =
XXX
XXX
P [H]
1/2 X T •C2 T 1/4 P [C1 H]
=
P [C1 H] + P [C2 H]
From the leaf probabilities in the sample
tree,
3/8 3
P [C1 |H] = = .
3/8 + 1/4 5
Similarly,
P [C1 T ] P [C1 T ] 1/8 1
P [C1 |T ] = = = = . (1)
P [T ] P [C1 T ] + P [C2 T ] 1/8 + 1/4 3
As we would expect, we are more likely to have chosen coin 1 when the first flip is
heads, but we are more likely to have chosen coin 2 when the first flip is tails.
Quiz 2.1
Let Fi denote the event that that the user is found on page i. The tree
for the experiment is
The user is found unless all three paging attempts fail. Thus the proba-
bility the user is found is
Counting Methods
Theorem 2.1
I 17 I
Example 2.5 Problem
771111 AAAA
it
5251
Example 2.5 Solution
52 ⇥ 51 ⇥ · · · ⇥ 46 = 674,274,182,400 . (1)
Theorem 2.3
N
k
Example 2.9
• The number of combinations of seven cards chosen from a deck of 52 cards is
⇣52⌘ 52 ⇥ 51 ⇥ · · · ⇥ 46
= = 133,784,560, (1)
7 2 ⇥ 3 ⇥ ··· ⇥ 7
which is the number of 7-combinations of 52 objects. By contrast, we found in
Example 2.5 674,274,182,400 7-permutations of 52 objects. (The ratio is 7! =
5040).
• There are 11 players on a basketball team. The starting lineup consists of five
players. There are 11
5
= 462 possible starting lineups.
There are four queens in a deck of 52 cards. You are given seven cards at
random from the deck. What is the probability that you have no queens?
Example 2.10 Solution
Otherwise, with probability 48/52, select another card from the remain-
ing 51 cards and observe whether it is a queen. This outcome of this
subexperiment has probability 4/51. If the second card is not a queen, an
outcome with probability 47/51, continue until you select a queen or you
have seven cards with no queen. Using Qi and Ni to indicate a “Queen”
or “No queen” on subexperiment i, the tree for this experiment is
4 Q1 4 Q2 4 Q3 4 Q7
52 51 50 46
N1 N2 N2 ... N7
48/52 47/51 46/50 42/46
There are four queens in a deck of 52 cards. You are given seven cards
at random from the deck. After receiving each card you return it to the
deck and receive another card at random. Observe whether you have not
received any queens among the seven cards you were given. What is the
probability that you have received no queens?
Example 2.11 Solution
The sample space contains 527 outcomes. There are 487 outcomes with
no queens. The ratio is (48/52)7 = 0.5710, the probability of receiv-
ing no queens. If this experiment is considered as a sequence of seven
subexperiments, the tree looks the same as the tree in Example 2.10,
except that all the horizontal branches have probability 48/52 and all the
diagonal branches have probability 4/52.
Example 2.12 Problem
A laptop computer has USB slots A and B. Each slot can be used for
connecting a memory card (m), a camera (c) or a printer (p). It is possible
to connect two memory cards, two cameras, or two printers to the laptop.
How many ways can we use the two USB slots?
Example 2.12 Solution
For five subexperiments with sample space Ssub = {0, 1}, what is the
number of observation sequences in which 0 appears n0 = 2 times and 1
appears n1 = 3 times?
Example 2.17 Solution
{00111, 01011, 01101, 01110, 10011, 10101, 10110, 11001, 11010, 11100} .
Theorem 2.6
h IIn no
I ntfn.net
Theorem 2.7
Subexperiment Procedure
0 Label n0 slots as s0 .
1 Label n1 slots as s1 .
... ...
m 1 Label the remaining nm 1 slots as sm 1.
There are nn0 ways to perform subexperiment 0. After n0 slots have been labeled, there
are n n1n0 ways to perform subexperiment 1. After subexperiment j 1, n0 + · · · + nj 1
slots have already been filled, leaving n (n0 +···+n
nj
j 1)
ways to perform subexperiment j.
From the fundamental counting principle,
⇣ n ⌘⇣n n ⌘⇣n n n1 ⌘ ⇣n n · · · nm 2 ⌘
0 0 0
M = ···
n0 n1 n2 nm 1
n! (n n0 )! (n n0 · · · nm 2 )!
= ··· . (1)
(n n0 )!n0 ! (n n0 n1 )!n1 ! (n n0 · · · nm 1 )!nm 1 !
Canceling the common factors, we obtain the formula of the theorem.
Example 2.18 Problem
In Example 2.16, we determine that with four possible grades there are
410 = 1,048,576 ways of assigning grades to ten students. However, now
we are limited to choosing n0 = 2 students to receive an A, n1 = 3
students to receive a B, n2 = 3 students to receive a C and n3 = 4
students to receive an F . The number of ways that fit the curve is the
multinomial coefficient
⇣ n ⌘ ⇣ 10 ⌘ 10!
= = = 25,200. (1)
n0 , n1 , n2 , n3 2, 3, 3, 2 2!3!3!2!
Quiz 2.2
(b) An experiment that can yield all possible code words with two zeroes is to choose
which 2 bits (out of 4 bits) will be zero. The other two bits then must be ones. There
are 42 = 6 ways to do this. Hence, there are six code words with exactly two zeroes.
For this problem, it is also possible to simply enumerate the six code words:
1100, 1010, 1001,
0101, 0110, 0011.
(c) When the first bit must be a zero, then the first subexperiment of choosing the
first bit has only one outcome. For each of the next three bits, we have two choices.
In this case, there are 1 ⇥ 2 ⇥ 2 ⇥ 2 = 8 ways of choosing a code word.
(d) For the constant ratio code, we can specify a code word by choosing M of the bits
to be ones. The other N M bits will be zeroes. The number of ways of choosing such
a code word is MN
. For N = 8 and M = 3, there are 83 = 56 code words.
Section 2.3
Independent Trials
Example 2.19 Problem
What is the probability P[E2,3] of two failures and three successes in five
independent trials with success probability p.
I 11 A D D I
S S S
F F Z
Ci p
l P Ci pl P P p p
F S S F S
I P P
1 P
P P z
E P CI p
Example 2.19 Solution
theorem E l P
Binomial
É 1 pkg n k
I Pta k o
Example 2.20 Problem
In this case, we have five trials corresponding to the five times the binary
symbol is sent. On each trial, a success occurs when a binary symbol is
received correctly. The probability of a success is p = 1 q = 0.9. The
error event E occurs when the number of successes is strictly less than
three:
h i h i h i
P [E] = P E0,5 + P E1,4 + P E2,3 (1)
⇣5⌘ ⇣5⌘ ⇣5⌘
= q5 + pq 4 + p2q 3 = 0.00856. (2)
0 1 2
By increasing the number of binary symbols per information bit from 1
to 5, the cellular phone reduces the probability of error by more than one
order of magnitude, from 0.1 to 0.0081.
Theorem 2.9
Continuing with Example 2.16, suppose that for each student all four grades
have probability 0.25, independent of any other student. Suppose there are
100 students, what is the probability of exactly 25 students of each grade?
Example 2.23 Solution
1
0.25 0.25
2 3
0.25 0.25
Quiz 2.3
Reliability Analysis
Figure 2.2
W1
W1 W2 W3 W2
W3
An operation consists of two redundant parts. The first part has two
components in series (W1 and W2) and the second part has two compo-
nents in series (W3 and W4). All components succeed with probability
p = 0.9. Draw a diagram of the operation and calculate the probability
that the operation succeeds.
P
CINI OMID
P WI U Wo
Figure 2.3
W1 W2 W5
W3 W4 W6
Matlab
Figure 2.4
Y =
Columns 1 through 12
47 52 48 46 54 48 47 48 59 44 49 48
Columns 13 through 24
42 52 40 40 47 48 48 48 53 49 45 61
Columns 25 through 36
60 59 49 47 49 45 48 51 48 53 52 53
Columns 37 through 48
56 54 60 53 52 51 58 47 50 48 44 49
Columns 49 through 60
50 46 52 50 51 51 57 50 49 56 44 56
>> X=rand(100,60)<0.5; The Matlab code for this task appears on the left.
>> Y=sum(X,1)
The 100 ⇥ 60 matrix X has i, jth element X(i,j)=0
(tails) or X(i,j)=1 (heads) to indicate the result of flip i of subexperiment
j. Since Y sums X across the first dimension, Y(j) is the number of
heads in the jth subexperiment. Each Y(j) is between 0 and 100 and
generally in the neighborhood of 50. The output of a sample run is shown
in Figure 2.4.
Example 2.26 Problem
Note that “ help hist” will show the variety of ways that the hist function
can be called. Morever, X=hist(G,T) does more than just count the
number of elements of G that equal each element of T. In particular,
hist(G,T) creates bins centered around each T(j) and counts the number
of elements of G that fall into each bin.
Quiz 2.5
The flip of a thick coin yields heads with probability 0.4, tails with prob-
ability 0.5, or lands on its edge with probability 0.1. Simulate 100 thick
coin flips. Your output should be a 3 ⇥ 1 vector X such that X1, X2, and
X3 are the number of occurrences of heads, tails, and edge.
Quiz 2.5 Solution
For a Matlab simulation, we first generate a vector R of 100 random numbers. Second,
we generate vector X as a function of R to represent the 3 possible outcomes of a flip.
That is, X(i)=1 if flip i was heads, X(i)=2 if flip i was tails, and X(i)=3) is flip i landed
on the edge. The matlab code is
R=rand(1,100);
X=(R<= 0.4) ...
+ (2*(R>0.4).*(R<=0.9)) ...
+ (3*(R>0.9));
Y=hist(X,1:3)
These three cases will have probabilities 0.4, 0.5 and 0.1. Lastly, we use the hist
function to count how many occurences of each possible value of X(i).