Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
8/24/2015 ECE 450 1
ECE 450
Homework Set 1 – Part 2 Solutions
8/24/2015 ECE 450 2
1. Pr(7 or 11) on toss of 2 dice
+ 1 2 3 4 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9
4 5 6 7 8 9 10
5 6 7 8 9 10 11
6 7 8 9 10 11 12
Pr(7 or 11) = 8/36 = 2/9
2. Pr(Q of ) in 5-card poker
Pr(Q of ) = 52/5
5
52
4
511
Numerator: 1 way to draw the
Q of ; 51C4 ways to draw the
“other” 4 cards in the hand
8/24/2015 ECE 450 3
3. 4 women check coats; randomly returned;
Pr(all 4 get their coats back)
Numerator: # of ways to correctly return coats = 1
Denominator: # of ways to return coats at random:
4! = 4 3 2 1 = 24
Pr(all 4 get their coats back) = 1/24
4. Passwords (single letter or letter followed by 3 symbols that are letters or digits)
Denominator: # of possible password:
26 + 26*36 + 26*36*36 + 26*36*36*36 =1,247,714
Pr(J & M same password) = 1/1,247,714 8.015*10-7
8/24/2015 ECE 450 4
5. Machine works if at least 6 of 7 parts work;
Pr(part failure) = .2; find Pr(machine failure)
Pr(failure) = 1 – Pr(at least 6 parts work)
= 1 – Pr(exactly 6 parts work or exactly 7 parts work)
= 1 – {Pr(exactly 6 parts work) + Pr(exactly 7 parts work)}
= 4233.)2(.)8(.7
7)2(.)8(.
6
71 0716
8/24/2015 ECE 450 5
6. Given: P(G) = P(B) = ½;
find Pr(G added| B sel.)
Bayes’ Rule: Pr(G added| B sel.)
= Pr(B sel.| G added) Pr(G added)/Pr(B sel.)
Total Prob. on Denominator, Pr(B sel.):
Pr(B sel.) = Pr(B sel.| Gadded) Pr(G added) + Pr(B sel.| B added) Pr(B added)
So,
Pr(G added| B sel.) = 2/(3+x)(1/2) / [ 2/(3+x)(1/2) + 3/(3+x) (1/2)] = 2/5
Now If G added If B added
# boys = #B 2 2 3
# girls = #G x x+1 x
Total # Babies 2+x 3+x 3+x
8/24/2015 ECE 450 6
7. Pr(disease) = Pr(D) = .005; Pr(not
detected|D) = .02; Pr(detected|D’) = .03
Some conclusions based on complements of given info:
Pr(D’) = .995; Pr(det|D) = .98;
Pr(not detected|D’) = .97
Pr(D|det) =)'DPr()'D|Pr(det)DPr()D|Pr(det
)005(.98.
Pr(det)
)DPr()D|Pr(det
995).03(.)005(.98.
)005(.98.
8/24/2015 ECE 450 7
8. Missile launches if both relays fail; Pr(A fails)
= .01, Pr(B fails) = .03, Pr(B fails|A fails) = .06;
a. Pr(launch) = Pr(A fails B fails)
= Pr(A fails) Pr(B fails|A fails) = .01(.06) = .0006
b. Pr(A fails|B fails) = (defn. cond. prob.)
= .0006/.03 = .02
c. Not independent since Pr(A fails|B fails) Pr(A fails)
)failsBPr(
)failsBfailsAPr(
8/24/2015 ECE 450 8
9. Pr(win) = .2 on each toss;
person A goes 1st
Let A denote the event that Person A wins on any particular toss
Let B denote the event that Person B wins on any particular toss
Possible ways for A to win the game:
– A (A wins on 1st toss)
• Probability: (.2)
– A’B’A (A wins on 3rd toss)
• Probability: (.8) (.8) (.2) = (.64) (.2)
– A’B’A’B’A (A wins on 5th toss)
• Probability: (.8) (.8) (.8) (.8) (.2) = (64)2 (.2)
– etc.
• Overall probability that A wins:
– Pr(A wins) = (.2) + (.64)(.2) + (.64)2 (.2) + …
= .2/(1-.64) = 5/9 .5556 Infinite geometric
series, r = .64
8/24/2015 ECE 450 9
10. Pr(spacecraft in zone) = .8;
6 spacecraft
a. Pr(none of 6 in zone) = Pr(0 successes, 6 failures)
b. Pr(at least 1 in zone) = 1 – Pr(all 6 out of zone)
= 1 - .000064 = .999936
c. Pr(3 or more in zone) = 1 – Pr(all out) – Pr(5 out, 1 in)
– Pr(4 out, 2 in)
= .999936 - ___________ - __________ = _____
000064.)2(.)8(.0
6 60
.999936
8/24/2015 ECE 450 10
11. (Haddad) Suppose: 30% of the packets are routed via Channel A;
1% of the packets are lost on Channel A; and
0.5% of the packets are lost on Channel B.
a. If one packet is sent, find the probability that it is lost.
b. If a packet is lost, what is the prob. that it was sent via Channel A?
c. If three packets are sent, what is the probability that all three packets
are lost?
a. Pr(loss) = Pr(loss|A)Pr(A) + Pr(loss|B)Pr(B) (Total Prob. Eq.)
= .01 (.3) + .005 (.7) = .003 + .0035 = .0065
b. Pr(A|loss) = .4615
c. Pr(3 losses in 3 trials) =
= 2.746 x 10^-7
0065./003.0065.
)3(.01.
)lossPr(
)APr()A|lossPr(
303 )0065(.)9935(.)0065(.3
3
8/24/2015 ECE 450 11
12. 26 letters written at random; Pr(x, y adjacent)
___ ___ ___ . . . ___ ___ ___
1 2 3 24 25 26
But it can be “x y” or “y x”, so there are 50 ways to place the x & y
adjacently, with 24! ways to fill in the other letters:
Pr(x, y adjacent) =
# of adjacent pairs of slots
to place the x & y: 25
13/12526
50
!26
!2450
8/24/2015 ECE 450 12
13. Pr(flush) in 5-card poker hand
Numerator = # of ways to get a flush
= (# of ways to get 5 spades) + (# of ways to get 5 clubs) +
(# of ways to get 5 hearts) + (# of ways to get 5 diamonds)
=
Denominator = # of possible 5-card poker hands =
Pr(flush) = .00196
5
134
5
13
5
13
5
13
5
13
5
52
5
52
5
134
8/24/2015 ECE 450 13
14. Eng. spelling: “rigour”; Am. spelling: “rigor”;
select letter at random; Pr(Eng) = .4, Pr(Am) = .6
Bayes: Pr(Eng | vowel) =
=
)vowelPr(
)EngPr()Eng|vowelPr(
...4545.11/5)5/3)(5/2()5/2()2/1(
)5/2()2/1(
Total
Probability on
Denominator
)AmPr()Am|vowelPr()EngPr()Eng|vowelPr(
)EngPr()Eng|vowelPr(
8/24/2015 ECE 450 14
15. Pr(CB|male) = .05; Pr(CB|female) =
.0025; Pr(male|CB) = ? (CB: colorblind)
Bayes’ Rule:
=
)CBPr(
)malePr()male|CBPr()CB|malePr(
)femalePr()female|CBPr()malePr()male|CBPr(
)malePr()male|CBPr(
Total
Probability on
Denominator
21
20
525
500
0525.
05.
0025.05.
05.
)2/1(0025.)2/1(05.
)2/1(05.
17. K = “knows”, K’ = “doesn’t know”;
R = “gets it right”:
Givens: Pr(K) = ¾; Pr(K’) = ¼
Pr(R|K’) = ¼ Pr(R|K) = _____
Find: Pr(K|R) = _____________ / ______ (Bayes’)
= _____________/ [ _______ ____ + ________ ___]
= (1)(3/4) / [(1)(3/4) + (1/4)(1/4)]
= (3/4) / [3/4 + 1/16] = 12/(12+1) = 12/13
8/24/2015 ECE 450 15
8/24/2015 ECE 450 16
18. Box contains 15 sections, 5 defective;
choose 3; Pr(successful communication) = ?
Numerator = # of ways to choose 3 good links from 10
Denominator = # of ways to choose 3 links from all 15 in box
Pr(successful comm.) =
19. Family of 5 childrena. Pr(all same sex) = Pr(all boys) + Pr(all girls)
= (1/2)5 + (1/2)5 = 1/16
2637.91/24)123/(131415
)123/(8910
3
15
3
10
8/24/2015 ECE 450 17
19. Family of 5 children
b. Pr(B B B G G) = (1/2)5 = 1/32
c. Pr(exactly 3 boys) =
d. Pr(at least 1 girl) = 1 – Pr(all 5 are boys)
= 1 – (1/2)5 = 31/32
16/532
10)2/1()2/1(
3
5 23
8/24/2015 ECE 450 18
20. Pr(node failure) = .2
a. Pr(comm) = Pr{A D (B C)}
= Pr(A) Pr(D) Pr(B C) since events are independent
= (.8) (.8) {Pr(B) + Pr(C) – Pr(B C)}
= .64 (.8 + .8 – (.64)) = .6144
b. Pr(B’|comm) =
A
B
D
C
Computer 1 Computer 2
1666.6144.
)2(.8.
6144.
)2(.)DCAPr( 3
8/24/2015 ECE 450 19
a. Pr(0r) = Pr(0r | 0t) Pr(0t) + Pr(0r | 1t) Pr(1t)
= (.8) (.6) + (.1) (.4) = .52
b. Pr(0t |0r)
.6
.4
.8
.9
.1
.2
0
1
0
1
21a. Find Pr(0r)
21b. Find Pr(0t |0r)
9231.52.
)6)(.8(.
)0Pr(
)0Pr()0|0Pr(
r
ttr
21.
8/24/2015 ECE 450 20
22. Verify Part II, Prob. 1: Pr(7 or 11)
MATLAB Code for 10,000 Trials
% program ece_450_hw1
red = randint(10000, 1, [1 6]);
green = randint(10000, 1, [1 6]);
dice = red + green;
flag = (dice == 7) | (dice == 11);
count = 0;
for i = 1:10000
count = count + flag(i);
end;
prob = count/10000
# Trials Pr(7 or 11)
10 .2
100 .25
1000 .2
10,000 .226
Theoretical
Ans.
2/9 = .2222
Note: You may have answers
that vary somewhat from these;
however, for 10,000 trials your
answer should be close to the
theoretical answer.
8/24/2015 ECE 450 21
23. Roll a die; N = # showing; toss coin N
times; Y = # heads showing; find Pr(Y = 0),
Pr(Y = 3); Matlab Simulation Code:
% program ece_450_hw1_prob23
dice = randi([1 6 ] [10000,1]);
Y = zeros(10000,1); % initialize Y
for i = 1:10000 % 10K trials
Y(i) = 0;
N = dice(i);
coin = randi([0 1], [N,1] )% 1 = heads
for j = 1:N
Y(i) = Y(i) + coin(j);
end
end
8/24/2015 ECE 450 22
23. Roll a die; N = # showing; toss coin N
times; Y = # heads showing; find Pr(Y = 0),
Pr(Y = 3)
MATLAB Code, continued
flag0 = (Y == 0); flag3 = (Y == 3);
count0 = sum(flag0);
count3 = sum(flag3);
prob0 = count0/10000
prob3 = count3/10000
Command Window:
>> ece_450_hw1_prob23
prob0 =
0.1655
prob3 =
0.1680
8/24/2015 ECE 450 23
24. Try adding in a 3rd parallel path, through
some node E
Pr(comm) = Pr{A D [(B C) E]}
= Pr(A) Pr(D) Pr[(B C) E] by independence
= (.8) (.8) {Pr(B C) + Pr(E) – Pr[(B C) E]}
= .64 {.96 + .8 - .96(.8)} = .6349 > .62
redundancy 3 is sufficient
A
B
D
C
Computer 1 Computer 2
E
8/24/2015 ECE 450 24
25.
Pr(Error) = Pr(E) = Pr(E | 0t) Pr(0t) + Pr(E | 1t) Pr(1t)
= (1-p) (.5) + (1-p) (.5) = 1 – p .001
p .999
.5
.5
p
p
1-p
1-pFind minimum
acceptable p to get P(E)
.001
(Total Probability Formula)
26. (Cooper & McGillem 1-4.8) Givens: Pr(truck) = ¼;
Pr(unsafe|auto) = 1/8; Pr(unsafe|truck) = 1/20.
a) Pr(truck unsafe) = Pr(unsafe|truck) Pr(truck)
= (1/20) (1/4) = 1/80
b) Pr(truck|unsafe) = Pr(unsafe|truck) Pr(truck)/P(unsafe)
by Bayes’ Rule
Total Prob. on Denom:
Pr(unsafe) = Pr(unsafe|truck) Pr(truck)
+ Pr(unsafe|auto) Pr(auto)
= (1/20) (1/4) + (1/8) (3/4) = 1/80 + 3/32
= 2/160 + 15/160 = 17/160
So, Pr(truck|unsafe) = 2/17
8/24/2015 ECE 450 25
26 continued
c) Pr(truck|previous auto) = Pr(truck) = ¼
(assumes that the event {truck} and the event {car} are
independent)
8/24/2015 ECE 450 26
27. Cooper & McG 1-6.3: Randomly draw 3 cards in
succession from deck of 52; A = King on 1st draw, B = King
on 2nd draw, C = King on 3rd draw
a) A B’ : the event of drawing a King on the 1st draw and
drawing anything but a King on the 2nd draw
Pr(A B’) = Pr(A) Pr(B’|A) = (1/13) (48/51) = .0724
b. A B : the event of drawing a King on the 1st or 2nd draw;
Pr(A B ) = Pr(A) + Pr(B) – Pr(A B)
= (1/13) + (1/13) – Pr(A) Pr(B|A)
= (2/13) – (1/13)(3/51) = .1493
8/24/2015 ECE 450 27
27. Cooper & McG 1-6.3: Randomly draw 3 cards in
succession from deck of 52; A = King on 1st draw, B = King
on 2nd draw, C = King on 3rd draw
d. A’ B’ C’ : the event of drawing none-King on the 1st,
2nd, and 3rd draw
Pr( A’ B’ C’ ) = Pr( (A’ B’) C’)
= Pr((A’ B’)) Pr(C’| (A’ B’) ) **
where Pr(A’ B’) = Pr(A’) Pr(B’|A’)
= (48/52) (47|51) = (12/13)(47/51)
and Pr(C’| (A’ B’) ) = 46/50 = 23/25
Plugging into **: Pr( A’ B’ C’ ) = (12/13)(47/51)(23/25)
= .7826
8/24/2015 ECE 450 28
27. Cooper & McG 1-6.3: Randomly draw 3 cards in
succession from deck of 52; A = King on 1st draw, B = King
on 2nd draw, C = King on 3rd draw
Remaining answers:
c. .99548
e. .07692
f. .93195
8/24/2015 ECE 450 29
28. Cooper & McG, 1-6.5 Two diodes connected in series;
Each has Pr(fails as short) = .05, Pr(fails as open) = .1;
Assume independence; find Pr(series connection functions
as diode).
• Pr(functions as diode) = Pr(both work or (one works and
the other fails as a short)), m.e.
= Pr(both work) + Pr(one works and the other fails
as a short)
= .852 + (.85) .05 + .05 (.85) = .8075
8/24/2015 ECE 450 30
8/24/2015 ECE 450 31
33. Cooper & McGillem, problem 1-10.8a: 10,000
characters are tx’d as a file; Pr(error) = .001 per character;
find Pr(file is tx’d without error).
Pr(file tx’d without error) = Pr(all characters tx’d correctly)
= (.999)10000 = 4.517 x 10 ^(-5)
36. (Lecture 1; Mix) Toss a die, so the sample space is the
set of numbers 1 – 6. Find the entropy in this experiment.
H = average info/event
= 2.585
Events Pr(event) I(event)
1 1/6 Log2(6) = 2.5850
…
6 1/6 Log2(6) = 2.5850
8/24/2015 ECE 450 32
35. (Lecture 1)
a. Consider a quaternary alphabet with 4 equally-likely symbols: {0, 1, 2, 3).
Find the entropy of the alphabet.
b. Find the entropy of the same alphabet if the symbol probabilities are:
Pr(0) = Pr(1) = 1/4; Pr(2) = 1/8; Pr(3) = 3/8. Also determine which of the 4
symbols carries the most information.
a. Information in each of the four symbols: log2(4) = 2 bits; thus H =
average information per symbol = 2.bits
b.
H = ¼ (2 bits) + ¼ (2 bits) + 1/8 (3 bits) + 3/8 (1.415 bits) = 1.9056 bits
Symbol Pr(symbol) I(symbol)
0 ¼ Log2(4) = 2 bits
1 ¼ Log2(4) = 2 bits
2 1/8 Log2(8) = 3 bits
3 3/8 Log2(8/3) = 1.415 bits
2 carries the most
information, since it is
the least likely.