2016 Lecture 3 Ry
2016 Lecture 3 Ry
2016 Lecture 3 Ry
19
Figure 1.1
B1
B2
B3
B4
C1
C2
C3
C4
In this example of Theorem 1.8, the partition is B = {B1, B2, B3, B4} and
Ci = A\Bi for i = 1, . . . , 4. It should be apparent that A = C1 [C2 [C3 [C4.
Theorem 1.10
For a partition {B1, B2, . . . , Bm} with P[Bi] > 0 for all i,
P [A] =
m
X
i=1
P [A|Bi] P [Bi] .
21
21
21
P [A|B2] = 0.9,
P [A|B3] = 0.6.
(1)
The production figures state that 3000 + 4000 + 3000 = 10,000 resistors per hour are produced. The fraction from machine B1 is P[B1] =
3000/10,000 = 0.3. Similarly, P[B2] = 0.4 and P[B3] = 0.3. Now it is a
simple matter to apply the law of total probability to find the acceptable
probability for all resistors shipped by the company:
P [A] = P [A|B1] P [B1] + P [A|B2] P [B2] + P [A|B3] P [B3]
(2)
(3)
For the whole factory, 78% of resistors are within 50 of the nominal
value.
23
Theorem 1.11
Bayes theorem
P [B|A] =
P [A|B] P [B]
.
P [A]
22
23
P [A|B3] P [B3]
.
P [A]
(1)
Since all of the quantities we need are given in the problem description,
our answer is
P [B3|A] = (0.6)(0.3)/(0.78) = 0.23.
(2)
Ques%ons(from(the((e)mailbag(
ECE(226(
Probability(and(Stochas%c(Processes(
P[Intersec%on]??(
(Anyways,(I'm(having(trouble(understanding(how(to(calculate(the(
probability(of(the(intersec%on(of(two(events.(For(example,(assuming(
there(are(6(circles(and(6(squares,(and(one(of(each(shape(is(colored,(the(
probability(of(picking(a(colored(circle(is(
(
P[circle](*(P[colored](=((1/2)(*((1/6)(=(1/12.((
However,(in(another(case(where(there(are(the(same(numbers(of(each(
shapes,(but(two(circles(are(colored((and(no(squares(are(colored),(the(
probability(of(picking(a(colored(circle(is(not(
(
P[circle](*(P[colored](=((1/2)(*((2/12)(=(1/12,((
(
but(is(2/12,(by(logic.(
assuming(there(are(6(circles(and(6(squares,(and(one(of(each(
shape(is(colored,(the(probability(of(picking(a(colored(circle(is(
(
P[circle](*(P[colored](=((1/2)(*((1/6)(=(1/12.((
(
P[circle](=(1/2(
P[colored](=(2/12((
P[circle,colored]=2/12(
However,(in(another(case(where(there(are(the(same(numbers(of(
each(shapes,(but(two(circles(are(colored((and(no(squares(are(
colored),(the(probability(of(picking(a(colored(circle(is((
NOT$P[circle](*(P[colored](=((1/2)(*((2/12)(=(1/12(
P[circle](=(1/2(
P[colored](=(2/12((
P[circle,colored]=2/12(
Section 1.6
Independence
24
24
assuming(there(are(6(circles(and(6(squares,(and(one(of(each(
shape(is(colored,(the(probability(of(picking(a(colored(circle(is(
(
P[circle](*(P[colored](=((1/2)(*((1/6)(=(1/12.((
(
P[circle](=(1/2(
P[colored](=(2/12((
P[circle,colored]=2/12(
However,(in(another(case(where(there(are(the(same(numbers(of(
each(shapes,(but(two(circles(are(colored((and(no(squares(are(
colored),(the(probability(of(picking(a(colored(circle(is((
NOT$P[circle](*(P[colored](=((1/2)(*((2/12)(=(1/12(
P[circle](=(1/2(
P[colored](=(2/12((
P[circle,colored]=2/12(
24
24
24
and
(1)
25
25
(1)
(2)
(4)
(3)
(5)
26
26
26
(1)
(2)
26
27
Quiz 1.6
Monitor two consecutive packets going through a router. Classify each one as video (v)
if it was sent from a Youtube server or as ordinary data (d) otherwise. Your observation
is a sequence of two letters (either v or d). For example, two video packets corresponds
to vv. The two packets are independent and the probability that any one of them is
a video packet is 0.8. Denote the identity of packet i by Ci . If packet i is a video
packet, then Ci = v; otherwise, Ci = d. Count the number NV of video packets in the
two packets you have observed. Determine whether the following pairs of events are
independent:
(a) {NV = 2} and {NV
(b) {NV
1}
1} and {C1 = v}
27
When checking the independence of any two events A and B, its wise to avoid intuition
and simply check whether P[AB] = P[A] P[B]. Using the probabilities of the outcomes,
we now can test for the independence of events.
(a) First, we calculate the probability of the joint event:
P [NV = 2, NV
Next, we observe that P[NV
comparison
P [NV = 2] P [NV
(1)
1] ,
(2)
[Continued]
27
(Continued 2)
(3)
1, C1 = v] .
(4)
(5)
Since P[C1 = d] P[C2 = v] = (0.2)(0.8) = 0.16, we confirm that the events are
independent. Note that this shouldnt be surprising since we used the information
that the packets were independent in the problem statement to determine the
probabilities of the outcomes.
[Continued]
27
(Continued 3)
(6)
(7)
(8)
(9)
Thus,
Section 1.7
Matlab
27
28
Example 1.24
>> X=rand(1,4)
X =
0.0879 0.9626 0.6627
>> X<0.5
ans =
1
0
0
1
0.2023
Since rand(1,4) < 0.5 compares four random numbers against 0.5, the result is a
random sequence of zeros and ones that
simulates a sequence of four flips of a fair
coin. We associate the outcome 1 with
28
28
93
99
77
95
88
57
51
90
Example 1.26
>> s=rng;
>> 50+randi(50,1,12)
ans =
89
76
80
80
>> rng(s);
>> 50+randi(50,1,12)
ans =
89
76
80
80
72
92
58
56
77
78
59
58
72
92
58
56
77
78
59
58
29
29
Quiz 1.7
The number of characters in a tweet is equally likely to be any integer
between 1 and 140. Simulate an experiment that generates 1000 tweets
and counts the number of long tweets that have over 120 characters.
Repeat this experiment 5 times.
29
163
simulate 5 runs of an experiment each with 1000 tweets. In particular, we note that
T=randi(140,1000,5) generates a 1000 5 array T of pseudorandom integers between
1 and 140. Each column of T has 1000 entries representing an experimental run
corresponding to the lengths of 1000 tweets. The comparison T>120 produces a 51000
binary matrix in which each 1 marks a long tweet with length over 120 characters.
Summing this binary array along the columns with the command sum(T>120) counts the
number of long tweets in each experimental run.
The experiment in which we examine the length of one tweet has sample space S =
{s1 , s2 , . . . , s140 } with si denoting the outcome that a tweet has length i. Note that
P[si ] = 1/140 and thus
20
1
= .
(1)
140
7
Thus in each run of 1000 tweets, we would expect to see about 1/7 of the tweets, or
about 143 tweets, to be be long tweets with length of over 120 characters. However,
because the lengths are random, we see that we observe in the neighborhood of 143
long tweets in each run.
P [tweet length > 120] = P [{s121 , s122 , . . . , s140 }] =
Third Edition
Chapter 2 Viewgraphs
Section 2.1
Tree Diagrams
35
36
36
B2 X
HH
XXX
X
HH
XX
event B2N , a nonacceptable re0.04
H
0.1 X N B2 N
HH
0.6
H
0.3
B3 XXXX
0.18
A B3 A
sistor from machine B2, we start
XXX
X
0.12
N B3 N
0.4
at the left and find that the probability 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.
A
B1 A
0.8
N B1 N
0.2
0.9
A B2 A
0.24
0.06
0.36