0% found this document useful (0 votes)
237 views17 pages

Experimental Probability in Train Arrivals

The document provides instructions and rules for an assignment on probability and random processes. It includes the following key points in 3 sentences: The assignment does not require submission but provides the solution on a given date and will have a quiz on another date to test understanding of concepts like conditional probability, total probability, and Bayes' rule. There is a zero tolerance policy for plagiarism and cheating, and spending sufficient individual time on each question is recommended before group discussions. The assignment aims to test understanding of creating meaningful partitions and applying probability concepts like conditional probability, total law of probability, Bayes' rule, and tree diagrams.

Uploaded by

Fork No Birta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
237 views17 pages

Experimental Probability in Train Arrivals

The document provides instructions and rules for an assignment on probability and random processes. It includes the following key points in 3 sentences: The assignment does not require submission but provides the solution on a given date and will have a quiz on another date to test understanding of concepts like conditional probability, total probability, and Bayes' rule. There is a zero tolerance policy for plagiarism and cheating, and spending sufficient individual time on each question is recommended before group discussions. The assignment aims to test understanding of creating meaningful partitions and applying probability concepts like conditional probability, total law of probability, Bayes' rule, and tree diagrams.

Uploaded by

Fork No Birta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

National University of Computer & Emerging Sciences

EE319: Probability & Random Processes


Section – A, B, C (Spring 2019)
A02
Instructor(s):
Launch: Solution: ABQ:
Aamer Munir, Moomal Bukhari
SUN, 24th Feb SAT, 2nd Mar TUE, 5th Mar
TA: Sarosh Arif (Batch’16)

SOLUTION NO SUBMISSION REQUIRED


Quit your comfort zone to learn!

Where the
magic
happens
Your
Comfort
Zone

Assignments related tips and notes:


1. No submission is required for this assignment.
2. It is advised that you revise all concepts before attempting this assignment.
3. On the “Solution” date the solution of this assignment will be uploaded so you can learn
from your mistakes.
4. The ABQ date is when a quiz will be held based on questions in this assignment. The
quiz may not have the exact same questions but similar ones. Therefore, focus on
doing the assignments yourself and understanding the underlying concepts.
5. There is a ZERO Tolerance Policy for plagiarism and cheating in all assessments. First
cheating case gets zero. Subsequent cheating case gets ZERO in all ABQs. A gross
violation may be reported to the Department Discipline Committee (DDC).
6. Another assignment can be uploaded before the ABQ is taken.
7. It is recommended that you spend sufficient time on each question (or part) of this
assignment ALONE and come up with your answer before undergoing any group
discussion. If you do it before spending time yourself your mind wouldn’t build the
ability to think independently and originally since it would be biased by others’ ideas.

Rules related to this assignment:


This assignment attempts to test your understanding of:
1. Creating meaningful partitions.
2. Conditional probability
3. Law of Total Probability
4. Tree Diagram
5. Bayes' Rule
Roll No: _____________
Question 1:
For each of the following experiments, 𝐸𝑘 , if the data given is sufficient, create at least two
different but meaningful partitions, and assign value of probability for each event in the
partitions (remember a partition is a collection of ME (for all events𝐴𝑘 in the partition 𝐴𝑖 ∩ 𝐴𝑗 =
∅, 𝑓𝑜𝑟 𝑖 ≠ 𝑗) and CE (⋃𝑛𝑘=1 𝐴𝑘 = 𝑆) events).

Solved example:
𝐸: A medical test was performed on random people. The result was either positive (+),
negative (-), or ambiguous (a). If the result was ambiguous, the test was carried out on the
same person again and again until the test resulted as either positive or negative.

Solution:
The sample space is 𝑆 = {+, 𝑎+, 𝑎𝑎+, 𝑎𝑎𝑎+, 𝑎𝑎𝑎𝑎+, … , −, 𝑎−, 𝑎𝑎−, 𝑎𝑎𝑎−, 𝑎𝑎𝑎𝑎−, … }

Partition 1: Let us make this partition on the interest "the number of times the experiment was
performed". Then the various events 𝐴𝑘 in this partition would be:
𝐴1 = {+, −} corresponding to the experiment being performed once.
𝐴2 = {𝑎+, 𝑎 −} exp performed twice.
𝐴3 = {𝑎𝑎+, 𝑎𝑎 −} exp performed 3 times.
𝐴4 = {𝑎𝑎𝑎+, 𝑎𝑎𝑎 −} exp performed 4 times.
And so on.
In this partition there would be infinite events; 𝐴1 𝑡𝑜 𝐴∞

Partition 2: Let us make this partition on the interest "the outcome of the experiment". Then
the various events 𝐵𝑘 in this partition would be:
𝐵+ = {+, 𝑎+, 𝑎𝑎+, 𝑎𝑎𝑎+, … } corresponding to the outcomes being +.
𝐵− = {−, 𝑎−, 𝑎𝑎−, 𝑎𝑎𝑎−, … } corresponding to the outcomes being -.
In this partition there would only be two events; 𝐵+ and 𝐵−.

Create such partitions for each of the following case:


𝐸1 : A coin is tossed three times.
Solution:
The sample space is 𝑆 = {𝑇𝑇𝑇, 𝑇𝑇𝐻, 𝑇𝐻𝑇, 𝑇𝐻𝐻, 𝐻𝑇𝑇, 𝐻𝑇𝐻, 𝐻𝐻𝑇, 𝐻𝐻𝐻}

Partition 1: Let us make this partition on the interest "the number of heads we got ". Then the
various events 𝐴𝑘 in this partition would be:
𝐴0 = {𝑇𝑇𝑇} corresponding to the event that we got no heads.
𝐴1 = {𝑇𝑇𝐻, 𝑇𝐻𝑇, 𝐻𝑇𝑇} got one heads.
𝐴2 = {𝑇𝐻𝐻, 𝐻𝑇𝐻, 𝐻𝐻𝑇} got two heads.
𝐴3 = {𝐻𝐻𝐻} got three heads.

Partition 2: Let us make this partition on the interest "the second toss is heads". Then the
various events 𝐵𝑘 in this partition would be:
𝐵0 = {𝑇𝑇𝑇, 𝑇𝑇𝐻, 𝐻𝑇𝑇, 𝐻𝑇𝐻} corresponding to the second toss NOT being heads.
𝐵1 = {𝑇𝐻𝑇, 𝑇𝐻𝐻, 𝐻𝐻𝑇, 𝐻𝐻𝐻} corresponding to the second toss being heads.

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 2/17


Roll No: _____________
𝐸2 : A person climbs on the rooftop daily right at sunset and notes the time after which moon is
seen by him. He waits till sunrise. The moon is considered visible even if it is partially visible. It
is possible the moon is not visible throughout the night.
Solution:
Let us assume the length of night is same for all nights and it is 𝑡𝑚𝑎𝑥 . The sample space is 𝑆 =
{𝑡 ∶ 𝑡 ∈ [0, 𝑡𝑚𝑎𝑥 ] 𝑤ℎ𝑒𝑟𝑒 𝑡 = 𝑡𝑚𝑎𝑥 𝑟𝑒𝑝𝑟𝑒𝑠𝑒𝑛𝑡𝑠 𝑡ℎ𝑒 𝑐𝑎𝑠𝑒 𝑚𝑜𝑜𝑛 𝑤𝑎𝑠 𝑁𝑂𝑇 𝑣𝑖𝑠𝑖𝑏𝑙𝑒}

Partition 1: Let us make this partition on the interest "whether moon was visible or not". Then
the various events 𝐴𝑘 in this partition would be:
𝐴𝑆 = {𝑡 ∶ 𝑡 ∈ [0, 𝑡𝑚𝑎𝑥 )} corresponding to the event that the moon was visible.
𝐴𝐹 = {𝑡: 𝑡 = 𝑡𝑚𝑎𝑥 } corresponding to the event that the moon is not visible.

Partition 2: Let us make this partition on the interest "the moon was visible by the hour 𝑘".
Then the various events 𝐵𝑘 in this partition would be:
𝐵0 = {𝑡 = 0} corresponding to the moon being visible immediately.
𝐵1 = {𝑡: 0 < 𝑡 ≤ 1} corresponding to the moon being visible by first hour.
In general
𝐵𝑘 = {𝑡: 0 < 𝑡 ≤ 𝑘} corresponding to the moon being visible by 𝑘 𝑡ℎ hour.

𝐸3 : Draw two cards from a deck of 52 distinct cards with replacement after the first draw. With
replacement means the first card is drawn, noted, and put back in the deck of cards and the
second is drawn again at random.
Solution:
If the cards are numbered from 1 - 52, they would be easier to refer to.
𝑆 = {(1,1), (1,2), (1,3), … , (1,52),
(2,1), (2,2), (2,3), … , (2,52),

(52,1), (52,2), (52,3), … , (52,52)}
Partition 1: Let us make this partition on the interest "Card 1 drawn". Then the various events
𝐴𝑘 in this partition would be:
𝐴1 = {(1,1), (1,2), … , (1,13)} corresponding to the event that Card 1 drawn is 1.
𝐴2 = {(2,1), (2,2), … , (2,13)} corresponding to the event that Card 1 drawn is 2.
𝐴𝑘 = {(𝑘, 1), (𝑘, 2), … , (𝑘, 13)} corresponding to the event that Card 1 drawn is k, where 1 ≤
𝑘 ≤ 52.

Partition 2: Let us make this partition on the interest "Card 1 and 2 are same". Then the
various events 𝐵𝑘 in this partition would be:
𝐵1 = {(1,1), (2,2), … , (52,52)} corresponding to the event that Card 1 drawn 1 is equal to card
2.
𝐵2 = 𝐵1𝑐 corresponding to the event that Card 1 drawn is 2.

𝐸4 : A C++ function prime() returns a random prime integer. A program needs two different
prime numbers.
Solution:
𝑆 = {(2,3), (2,2,3), (2,2,2,3), … , (2,2, … ,3), (2,5), (2,2,5), … , (2,2, … ,5), (2,7), (2,2,7), …,
(2,2, … ,7), … , (3,5), (3,3,5), … , (3,3, … ,5), (3,7), (3,3,7), … , (3,3, … ,7), … , … }

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 3/17


Roll No: _____________
Partition 1: Let us make this partition on the interest "Number of times the function had to be
called for two distinct primes". Then the various events 𝐴𝑘 in this partition would be:
𝐴2 = {(2,3), (3,2), (2,5), (5,2), (2,7), (7,2), … } function called 2 times.
𝐴3 = {(2,2,3), (3,2,2), (2,2,5), (5,5,2), (2,2,7), (7,7,2), … } function called 3 times.
And so on.

Partition 2: Let us make this partition on the interest "product of the two prime numbers".
Then the various events 𝐵𝑘 in this partition would be:
𝐵6 = {(2,3), (2,2,3), … , (3,2), (3,3,2), … } for a product of 6.
𝐵10 = {(2,5), (2,2,5), … , (5,2), (5,5,2), … } for a product of 10.
𝐵14 = {(2,7), (2,2,7), … , (7,2), (7,7,2), … } for a product of 14.
And so on.

𝐸5 : An experiment consists of selecting a number 𝑥 from the interval [0, 1) and a number 𝑦
from the interval [0,2) to form a point ( 𝑥, 𝑦 ).
Solution:
𝑆 = {(𝑥, 𝑦): 0 ≤ 𝑥 < 1, 0 ≤ 𝑦 < 2}
Partition 1: Let us make this partition on the interest "unit areas along y-axis". Then the
various events 𝐴𝑘 in this partition would be:
𝐴1 = {(𝑥, 𝑦): 0 ≤ 𝑥 < 1, 0 ≤ 𝑦 < 1}
𝐴2 = {(𝑥, 𝑦): 0 ≤ 𝑥 < 1, 1 ≤ 𝑦 < 2}
Partition 2: Let us make this partition on the interest "circular strips w width thick around the
center". Then the various events 𝐵𝑘 in this partition would be:
𝐵1 = {(𝑥, 𝑦): (x – 0.5)2 + (y– 1)2 ≤ w2 }
2
𝐵2 = {(𝑥, 𝑦): 𝑤 2 < (x – 0.5)2 + (y– 1)2 ≤ 2w }
2
𝐵3 = {(𝑥, 𝑦): 2𝑤 2 < (x – 0.5)2 + (y– 1)2 ≤ 3w }
In general
2
𝐵𝑘 = {(𝑥, 𝑦): (𝑘 − 1)𝑤 2 < (x – 0.5)2 + (y– 1)2 ≤ kw }

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 4/17


Roll No: _____________
Question 2: Two seven-sided dice

You roll two seven-sided dice. The sides of each die are numbered from 1 to 7. The dice are
“fair” (all sides are equally likely), and the two die rolls are independent.

Part A: Event A is “the total is 14” (i.e., the sum of the results of the two die rolls is 14).

1. Is event A independent of the event “at least one of the dice resulted in a 5”?
2. Is event A independent of the event “at least one of the dice resulted in a 1”?

Part B: Event B is “the total is 12.”

1. Is event B independent of getting “doubles” (i.e., both dice resulting in the same
number)?
2. Given that the total was 12, what is the probability that at least one of the dice resulted
in a 5?

|S| = 7x7 = 49, All outcomes equally likely as dice are fair.

Part A:
A = { (7,7) }
Pr(A) = 1/49
1:
𝐹 = { (5,1), (5,2), (5,3), (5,4), (5,5), (5,6), (5,7), (1, 5), (2, 5), (3, 5), (4, 5), (6, 5), (7, 5)}
𝑃𝑟(𝐹) = 13/49, (Note: also |F|c = 6x6 = 36, |F| =|S|-36=13)
𝐴 ∩ 𝐹 = 𝛷, (Note: this alone is enough to rule out independence if none of A and F are Φ)
𝑃𝑟(𝐴 ∩ 𝐹) = 𝑃𝑟(𝛷) = 0 ≠ 𝑃𝑟(𝐴). 𝑃𝑟(𝐹)
Hence A and F are not independent.
2:
Through a similar argument as above, they are not independent.

Part B:
𝐵 = { (5,7), (6,6), (7,5) }
𝑃𝑟(𝐵) = 3/49
1:
𝐷 = { (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7) }
𝑃𝑟(𝐷) = 7/49
𝐵 ∩ 𝐷 = { (6,6) }
𝑃𝑟(𝐵 ∩ 𝐷) = 1/49 = 0.020408 ≠ 𝑃𝑟(𝐵). 𝑃𝑟(𝐷) = 3/49 𝑥 7/49 = 0.00875
Hence B and D are not independent.
2:
𝑃𝑟(𝐹 | 𝐵) = 𝑃𝑟(𝐹 ∩ 𝐵}/𝑃𝑟(𝐵) = 𝑃𝑟{ (5,7), (7,5) }/(3/49) = (2/49) / (3/49) = 2/3

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 5/17


Roll No: _____________
Question 3: Reliability

Consider the communication network shown in the figure below and suppose that each link
can fail with probability p. Assume that failures of different links are independent.

1. Assume that p = 3/8. Find the probability that there exists a path from A to B along
which no link has failed. (Give a numerical answer.)

2. Given that exactly one link in the network has failed, find the probability that there
exists a path from A to B along which no link has failed. (Give a numerical answer.)

1:
Define events Fi = "Link i has failed", Wi = Link i is working", W = “a path from A to B
exists)”, then
𝑃𝑟(𝐹𝑖 ) = 𝑝 = 3/8, 𝑃𝑟 (𝑊𝑖 ) = 1 − 𝑝 = 5/8

𝑊 = (𝑊1 𝑎𝑛𝑑 𝑊2 𝑎𝑛𝑑 𝑊5 ) 𝑂𝑅 (𝑊3 𝑎𝑛𝑑 𝑊4 𝑎𝑛𝑑 𝑊5 )


𝑊 = 𝑊1 , 𝑊2 , 𝑊5 𝑈 𝑊3 , 𝑊4 , 𝑊5
𝑃𝑟(𝑊) = Pr(𝑊1 , 𝑊2 , 𝑊5 𝑈 𝑊3 , 𝑊4 , 𝑊5 )
𝑃𝑟(𝑊) = Pr(𝑊1 , 𝑊2 , 𝑊5 ) + Pr(𝑊3 , 𝑊4 , 𝑊5 ) − Pr(𝑊1 , 𝑊2 , 𝑊5 , 𝑊3 , 𝑊4 , 𝑊5 )

𝑃𝑟(𝑊) = 𝑃𝑟(𝑊1 ). 𝑃𝑟(𝑊2 ). 𝑃𝑟(𝑊5 ) + 𝑃𝑟(𝑊3 ). 𝑃𝑟(𝑊4 ). 𝑃𝑟(𝑊5 )


− 𝑃𝑟(𝑊1 ). 𝑃𝑟(𝑊2 ). 𝑃𝑟(𝑊3 ). 𝑃𝑟(𝑊4 ). 𝑃𝑟(𝑊5 )

𝑃𝑟(𝑊) = (1 − 𝑝)3 + (1 − 𝑝)3 − (1 − 𝑝)5 = 2(1 − 𝑝)3 − (1 − 𝑝)5


5 3 5 5
𝑃𝑟(𝑊) = 2 ( ) − ( )
8 8
𝑃𝑟(𝑊) = 0.3929

Alternate: First consider probability that link 1 and 2 are up, and Link 3 and 4 are up,
then consider the probability for the parallel path to be up and then consider the final
series path to be up. However, the expression in p may come out to be different but the
value would be the same. Try it. The expression you would get would be
Pr(𝑊) = {1 − [1 − (1 − 𝑝)2 ]2 }. (1 − 𝑝)
2:
Define event Oi = "only link i has failed", E = "exactly one link in the network has failed”
then
Pr(Oi) =p(1-p)4

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 6/17


Roll No: _____________
Pr(E) = Pr(O1 U O2 U O3 U O4 U O5) = 5Pr(Oi) since {O1,O2,O3,O4,O5} forms a partition
of E.
Pr(W ∩ E) = Pr(O1 U O2 U O3 U O4) = 4Pr(Oi) since failure of link 5 would fail the whole
system.
The required probability is Pr(W | E)=Pr(W∩E)/Pr(E)=[ 4Pr(Oi)]/[ 4Pr(Oi)]=4/5

Alternate 1: This can also be found from intuitive reasoning.


Since all links are equally likely to fail and since exactly one link has failed, each link
has the same probability 1/5 of being the one that failed. There will be no path
from A to B only in the case where the link that failed is Link 5, which happens with
probability 1/5. Therefore, the desired probability is 1 − 1/5 = 4/5.

Alternate 2: Since all events Oi are equally likely to occur conditional on E and since
exactly one of them has occurred, each has the same conditional probability
𝑃𝑟(𝑂𝑖 |𝐸) = 1/5. There will be no path from A to B only in the case where the link that
failed is Link 5, which happens with probability 𝑃𝑟(𝑂5 |𝐸) = 1/5. Therefore, 𝑃𝑟(𝑊|𝐸) =
1 − 1/5 = 4/5.

Alternate 4: Define event Oi = "only link i has failed", E = "exactly one link in the
network has failed, then
𝑃𝑟(𝑂𝑖 ) = 𝑝(1 − 𝑝)4
𝑃𝑟(𝐸) = 𝑃𝑟(𝑂1 𝑈 𝑂2 𝑈 𝑂3 𝑈 𝑂4 𝑈 𝑂5 ) = 5. 𝑃𝑟(𝑂𝑖 ) = 5𝑝(1 − 𝑝)4
because{𝑂1 , 𝑂2 , 𝑂3 , 𝑂4 , 𝑂5 } forms a partition of 𝐸.

So Pr(link from A to B exists given that only one link has failed) = 𝑃𝑟(𝑊 | 𝐸)
In a reduced universe where event E has occurred, W should be checked to see how it
occurs under 5 scenarios.
Pr(𝑊|𝐸) = Pr(𝑂1 |𝐸) . Pr(𝑊|𝑂1 , 𝐸) + Pr(𝑂2 |𝐸) . Pr(𝑊|𝑂2 , 𝐸) + Pr(𝑂3 |𝐸) . Pr(𝑊|𝑂3 , 𝐸)
+ Pr(𝑂4 |𝐸) . Pr(𝑊|𝑂4 , 𝐸) + Pr(𝑂5 |𝐸) . Pr(𝑊|𝑂5 , 𝐸)
where
Pr(𝑂1 , 𝐸) Pr(𝑂1 ) p(1 − p)4 1
Pr(𝑂1 |𝐸) = = = 4
=
Pr(𝐸) Pr(𝐸) 5p(1 − p) 5
and
Pr(𝑊, 𝑂1 , 𝐸) Pr(𝑂1 )
Pr(𝑊|𝑂1 , 𝐸) = = =1
Pr(𝑂1 , 𝐸) Pr(𝑂1 )
which is true for all Oi except O5, where

Pr(𝑊, 𝑂5 , 𝐸) Pr((W1 , W2 , W5 U W3 , W4 , W5 ), 𝑂5 , 𝐸)
Pr(𝑊|𝑂5 , 𝐸) = =
Pr(𝑂5 , 𝐸) Pr(𝑂5 )
Pr(W1 , W2 , W5 , O5 , E U W3 , W4 , W5 , 𝑂5 , 𝐸) Pr(∅, ∅) Pr(∅)
= = = =0
Pr(𝑂5 ) Pr(𝑂5 ) Pr(𝑂5 )
as W = W 1W 2W 5 U W 3W4W 5

Pr(𝑊|𝐸) = Pr(O1 ) + Pr(𝑂2 ) + Pr(𝑂3 ) + Pr(𝑂4 ) + Pr(𝑂5 )


1 4
Pr(𝑊|𝐸) = 4. =
5 5

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 7/17


Roll No: _____________
Question 4: Akbar lost his son

Akbar has a big family. He traveled with all his family to many cities over an excursion trip. At
some point, he discovered he has lost his son. He was able to narrow down his search to two
cities; he lost his son in either city A (with probability 0.4) or in city B (with probability 0.6). If his
son is in city A and Akbar spends a day searching for it in city A, the conditional probability that
he will find his son that day is 0.25. Similarly, if his son is in city B and Akbar spends a day
looking for it there, he will find his son that day with probability 0.15.

His son cannot go from one city to the other. Akbar can search only in the daytime, and he can
travel from one city to the other only overnight.

His son is alive during day 0, when Akbar loses him, and during day 1, when Akbar starts
searching. He is alive during day 2 with probability 2/3. In general, for n ≥ 1, if his son is alive
during day n − 1, then the probability he is alive during day n is 2/(n + 1). His son can only die
overnight. Akbar stops searching as soon as he finds his son, either alive or dead.

a) In which city should Akbar look on the first day of the search to maximize the
probability he finds his son that day?

b) Akbar looked in city A on the first day but didn’t find his son. What is the probability that
his son is in city A?

c) Akbar flips a fair coin to determine where to look on the first day and finds his son on
the first day. What is the probability that he looked in city A?

d) Akbar decides to look in city A for the first two days. What is the probability that he
finds his son alive for the first time on the second day?

e) Akbar decides to look in city A for the first two days. Given that he did not find his son
on the first day, find the probability that he does not find his son dead on the second
day.

f) Akbar finally finds his son on the fourth day of the search. He looked in city A for the
first 3 days and in city B on the fourth day. Given this information, what is the
probability that he found his son alive?

Please note that I have tried to explain things a bit too. In solving a problem in exam, many
details are not needed.

This problem is a perfect example of how it matters to be meticulous in solving problems in


this course.

Note that in any question the important part is how you formulate the question into relevant
events that you would work with onwards. Once this is properly done, the rest is not a big deal.
So read the question carefully, ignore the extra 'details' but note the 'actions' that take place
and/or the 'facts' that are being reported. Give more time to thinking and formulation than you
are used to.
So when you read this question carefully you note that:
NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 8/17
Roll No: _____________

The big issue is Akbar's son has been lost, he will attempt to search for him, in two cities, one
day per city and the result of a day's search would be whether found or not. Besides this the
worry is whether he is alive or dead and the chances of death increase with every passing
day.

The following events cover the various details presented in the problem:
Event A = Son is in city A, Event B = Son is in city B
Event Fi = Son Found on ith day, Event Fi' = Son not found on ith day
th
Event SA = City A is searched on i day, Event SB = City B is searched on ith day

The choices Akbar has and various probabilities are as presented in the tree-diagram below.

F1

0.25

0.4 0.75

F 1’
SA
Pr(SA)
0.6
1.0
B F 1’
A F 1’
1.0
Pr(SB) 0.4

SB
F1

0.6 0.15

0.85

F 1’

CAUTION:
Please note that although I have written single events at nodes and leaves of the tree to avoid
clutter, each of them is an intersection of all the events starting from root of the tree (left) to
that node/leaf. For example the node A (on top of the tree) is actually A ∩ SA, and the leaf on
top is actually 𝐹1 ∩ 𝐴 ∩ 𝑆𝐴 . This will be true for all subsequent trees in this question (and
elsewhere).

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 9/17


Roll No: _____________
There is an important thing to learn here. If Akbar chooses to search in city A, i.e., event SA
occurs, then Akbar's perception is that the probability of his son being in city A is 0.4 and in
city B is 0.6. However, if the son is indeed in city A, there are two possibilities that he would be
found (F) or not found (F') but in city B there would only be one possibility that it cannot be
found! This is because a child cannot be at two places simultaneously.

Note that this is different from the Radar detection example. If a Radar detects an airplane
there may or may not be an airplane actually in the air. But if Akbar finds his son, it is for sure
he is not in the other city.

Furthermore, please note (a very important point) that whether the son is alive or dead does
not depend on whether he has been found or not. It is only dependent on time, i.e., probability
of him being alive reduces with time.

Probability for son to be alive on ith day is


2
Pr(𝐿𝑖 ) =
𝑖+1

Now let us continue to the question parts. Note that if you are able to comprehend a question
and write it correctly in terms of the events you have defined, solving it is a piece of cake. This
is a learning. In case you cannot convert a question being asked into the events you have
specified convincingly, you may need to revisit and redo your defining of the events.

a) In which city should Akbar look on the first day of the search to maximize the
probability he finds his son that day?

Here Akbar wants to make a choice between cities A and B so he should see searching which
one will produce a higher probability to find his son on the first day.

Pr(Finding son on first day given that A was chosen to search) =

Pr(𝐹1 | 𝑆𝐴 ) = Pr(𝐹1 ∩ 𝐴|𝑆𝐴 ) = 0.4 𝑥 0.25 = 0.1

as F1 can only occur in city A and remember each leaf is an intersection. [If you pay close
attention, this is application of Law of Total Probability for an event under a condition.]

Similarly, Pr(Finding son on first day given that B was chosen to search) =

Pr(𝐹1 | 𝑆𝐵 ) = Pr(𝐹1 ∩ 𝐵|𝑆𝐵 ) = 0.6 𝑥 0.15 = 0.09


Since
Pr(𝐹1 | 𝑆𝐴 ) > Pr(𝐹1 | 𝑆𝐵 )

he should choose city A to search on first day.

[Note that this is Bayesian inference. Although his initial belief was greater for his son to be in
city B, based on what chances does he have in finding his son in each city, he should not opt
for a case purely based on his initial beliefs alone.]

b) Akbar looked in city A on the first day but didn’t find his son. What is the
probability that his son is in city A?

Question translates to finding


Pr(son is in city A given that son not found in city A on day 1) =

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 10/17


Roll No: _____________

Pr(𝐴 ∩ 𝐹1′ ∩ 𝑆𝐴 )
Pr(𝐴|𝐹1′ ∩ 𝑆𝐴 ) =
Pr(𝐹1′ ∩ 𝑆𝐴 )

Note that since everything happens under the condition that SA has occurred (i.e., being
searched in city A) we can consider the sub-tree for SA as follows:
F1

0.25

0.4 0.75

SA F1’

0.6
1.0
B F1’
Thus
Pr(𝐴 ∩ 𝐹1′ ) Pr(𝐴 ∩ 𝐹1′ ) 0.4 ∗ 0.75 1
Pr(𝐴|𝐹1′ ) = ′ = ′) ′ = =
Pr(𝐹1 ) Pr(𝐴 ∩ 𝐹1 + Pr(𝐵 ∩ 𝐹1 ) 0.4 ∗ 0.75 + 0.6 ∗ 1.0 3

c) Akbar flips a fair coin to determine where to look on the first day and finds his
son on the first day. What is the probability that he looked in city A?

For this part refer to the original tree. The flipping fair coin part gives probabilities
Pr(SA) = 0.5 and Pr(SB) = 0.5.

Let us see what does the question translate to.


Pr(he searched in city A given that he found his son on first day) =

Pr(𝑆𝐴 ∩ 𝐹1 ) Pr(𝑆𝐴 ∩ 𝐴 ∩ 𝐹1 )
Pr(𝑆𝐴 | 𝐹1 ) = =
Pr(𝐹1 ) Pr(𝑆𝐴 ) . Pr(𝐴 ∩ 𝐹1 |𝑆𝐴 ) + Pr(𝑆𝐵 ) . Pr(𝐵 ∩ 𝐹1 |𝑆𝐵 )

0.5 ∗ 0.4 ∗ 0.25 10


= = = 0.52632
0.5 ∗ 0.4 ∗ 0.25 + 0.5 ∗ 0.6 ∗ 0.15 19

since he flipped the coin, he could have searched in city A as well as city B. So the event F1
could have occurred in both cities and hence according to LTP we get the denominator term.

d) Akbar decides to look in city A for the first two days. What is the probability that
he finds his son alive for the first time on the second day?

Pr(finds son in city A and on second day and is alive given that he searched in city on first
day and he searched in city A on second day)=
Pr(finds son in city A and on second day and is alive and did not find his son on first day
given that he searched in city on first day and he searched in city A on second day)=

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 11/17


Roll No: _____________
Pr(𝐴 ∩ 𝐹2 ∩ 𝐹1′ ∩ 𝐿2 |𝑆𝐴 ) = Pr(𝐿2 |𝑆𝐴 ) . Pr(𝐴 ∩ 𝐹2 ∩ 𝐹1′ |𝑆𝐴 )

This is because his being alive on 2nd day is independent of other factors, i.e., where was he
searched for and whether he was in city A or B. Also once again we can look at the sub-tree
for SA.
F1

0.25

F2
A
0.25
0.4 0.75

SA F1’

0.75
0.6
1.0
F 2’
B F1’

2
Pr(𝐿2 |𝑆𝐴 ) . Pr(𝐴 ∩ 𝐹2 ∩ 𝐹1′ |𝑆𝐴 ) = ∗ 0.4 ∗ 0.25 ∗ 0.75 = 0.05
2+1

e) Akbar decides to look in city A for the first two days. Given that he did not find
his son on the first day, find the probability that he does not find his son dead on
the second day.

Although Akbar is searching for his son in city A, not finding his son dead on the second day
could mean two things, (i) he found his son on second day but alive, and (ii) he did not find his
son, alive or dead, on second day. So the event of interest here is not simple.

Let us check the complement event, that the probability that Akbar finds his son dead on the
second day, which is a definitive case, so let us use this:

Pr(dead and on second day and not found on first and in city A given that he chose to
search in A)=
1
Pr(𝐿′2 ∩ 𝐹2 ∩ 𝐹1′ ∩ 𝐴|𝑆𝐴 ) = Pr(𝐿′2 |𝑆𝐴 ). Pr(𝐹2 ∩ 𝐹1′ ∩ 𝐴|𝑆𝐴 ) = (0.25 ∗ 0.75 ∗ 0.4) = 0.025
3
Thus the probability for the event of interest, i.e. that Akbar does not find his son dead on the
second day is 1-0.025 = 0.975

f) Akbar finally finds his son on the fourth day of the search. He looked in city A for
the first 3 days and in city B on the fourth day. Given this information, what is the
probability that he found his son alive?

We would need to define new events if we need to capture every detail of this problem.
Because in saying SA we have had no consideration of days. However, luckily, a little thought
over this problem would resolve it.

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 12/17


Roll No: _____________
Suppose we were in no mood to think, and suppose the redefinition of some events would be
like this:
SAi = Search in city A on day i, SBi = Search in city B on day i
then
Pr(alive on day 4 given that he was searched in city A on day 1 and not found, in A on
day 2 and not found, in A on day 3 and not found, in B on day 4 and found)=

Pr(𝐿4 |𝑆𝐴1 ∩ 𝐹1′ ∩ 𝑆𝐴2 ∩ 𝐹2′ ∩ 𝑆𝐴3 ∩ 𝐹3′ ∩ 𝑆𝐵4 ∩ 𝐹4 )

For son to be alive on day 4, he must be alive on all previous days, thus this is like saying:

Pr(𝐿4 ∩ 𝐿3 ∩ 𝐿2 ∩ 𝐿1 |𝑆𝐴1 ∩ 𝐹1′ ∩ 𝑆𝐴2 ∩ 𝐹2′ ∩ 𝑆𝐴3 ∩ 𝐹3′ ∩ 𝑆𝐵4 ∩ 𝐹4 ) = Pr(𝐿4 ∩ 𝐿3 ∩ 𝐿2 ∩ 𝐿1 )

because for son to be alive, does not depend on which city was chosen to be searched, where
he actually was and only depends on which day he was found.
2 2 2 2
Pr(𝐿4 ∩ 𝐿3 ∩ 𝐿2 ∩ 𝐿1 ) = Pr(𝐿4 ) . Pr(𝐿3 ) . Pr(𝐿2 ) . Pr(𝐿1 ) = .1 = = 0.13333
4 +13 +12 +1 15

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 13/17


Roll No: _____________
Question 5: Woes of marital life

Every morning, before leaving for university, Aamer checks whether his wife has prepared his
lunch box or not. On any given day, with probability 0.8 the lunch box is "prepared" and with
probability 0.2 it is "not prepared". If the lunch box is "not prepared", the probability of him
taking food from the Cafe is 0.8. On the other hand, if the lunch box is “prepared”, the
probability of him taking food from Cafe is 0.1 (being a professor, says it all).

1. One day, Aamer missed checking whether the lunch box was prepared or not and he
took food from Cafe. What is the probability that the lunch box was “prepared”?

2. Aamer misses checking the lunch box in the morning with probability 0.15 on any day
in the year. If he misses checking it, Aamer will flip a fair coin to decide whether to take
food from Cafe or not. (We assume that the result of the coin flip is independent from
the checking of lunch box and his wife's routine.) On any day he checks the lunch box,
if it is "prepared” he will always take food from the lunch box, and if it is “not prepared”
he will take food from Cafe. Let C be the event that “Aamer is taking food from Cafe”,
and let P be the event that the lunch box is “prepared”. Are events C and P
independent?

3. Aamer is not having food from Cafe and he has not brought the lunch box. What is the
probability that he checked the lunch box in the morning?\

The various events in this question are as follows:


Event A = Aamer checks lunch, Event A' = Aamer does not check lunch
Event P = Lunch box is prepared, Event P' = Lunch box is not prepared
Event C = Aamer eats from Cafe Event C' = Aamer does not eat from Cafe

The overall tree diagram based on what information is given can be thought of as follows
under two scenarios, (i) whether Aamer checked for his lunch box, or (ii) not. We can make
two separate trees but I have merged into one.

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 14/17


Roll No: _____________
C
0.1

P
0.8
0.9
C’
A C
0.8
0.2
Pr(A) P’

0.2
C’
C
0.8
Pr(A’)
0.8 P
A’
0.2
C’
C
0.8
0.2
P’

0.2
C’
OR
C
0.1

P
0.8
0.9
C’
A C
0.8
0.2
Pr(A) P’

0.2
C’

C
Pr(A’) 0.8
A’

0.2
C’
Since it does not matter whether the lunchbox was prepared or not if Aamer has not checked
it, whence he would not take it to university, and when he has not taken lunchbox to university,
he would eat from cafe with probability 0.8 and won't eat with probability 0.2.

1. One day, Aamer missed checking whether the lunch box was prepared or not
and he took food from Cafe. What is the probability that the lunch box was
“prepared”?

For this part we look into the lower universe of the above tree diagram, i.e., where Aamer
missed checking the lunch box. Assume a tree that starts from A'.

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 15/17


Roll No: _____________
′)
Pr(𝑃 ∩ 𝐶|𝐴 0.8 ∗ 0.8 0.64
Pr(𝑃|𝐶 ∩ 𝐴′ ) = = = = 0.8
Pr(𝐶|𝐴′ ) 0.8 ∗ 0.8 + 0.2 ∗ 0.8 0.8

2. Aamer misses checking the lunch box in the morning with probability 0.15 on
any day in the year. If he misses checking it, Aamer will flip a fair coin to decide
whether to take food from Cafe or not. (We assume that the result of the coin flip
is independent from the checking of lunch box and his wife's routine.) On any
day he checks the lunch box, if it is "prepared” he will always take food from the
lunch box, and if it is “not prepared” he will take food from Cafe. Let C be the
event that “Aamer is taking food from Cafe”, and let P be the event that the lunch
box is “prepared”. Are events C and P independent?

For the above tree diagram, Pr(A') = 0.15, Pr(A) = 0.85, and in lieu of new information, we
need to modify the tree diagram:
1.0
P C’
0.8

A
0.2 1.0
0.85 P’ C

C
0.5

0.15 0.8 P

A’ 0.5
C’
C
0.5
0.2
P’

0.5
C’
To prove whether P and C are independent we need to prove the following:
Pr(𝑃 ∩ 𝐶) = Pr(𝑃) . Pr(𝐶)
Pr(𝑃) = 0.8
and is not dependent on whether Aamer checked the lunch box or not. For Pr(C) we need to
employ LTP as C can occur under different scenarios (two of them here, as is clear from tree
diagram above).
Pr(𝐶) = Pr(𝐴) . Pr(𝐶|𝐴) + Pr(𝐴′ ) . Pr(𝐶|𝐴′ )
Pr(𝐶) = Pr(𝐴) . Pr(𝑃′ ∩ 𝐶|𝐴) + Pr(𝐴′ ) . [Pr(𝑃 ∩ 𝐶|𝐴′ ) + Pr(𝑃′ ∩ 𝐶|𝐴′ )]
Pr(𝐶) = 0.85 ∗ 0.2 ∗ 1.0 + 0.15 ∗ [0.8 ∗ 0.5 + 0.2 ∗ 0.5]
Pr(𝐶) = 0.245
whereas Pr(𝑃 ∩ 𝐶) = Pr(𝐴) . 𝑃𝑟(𝑃 ∩ 𝐶|𝐴) + Pr(𝐴′) . 𝑃𝑟(𝑃 ∩ 𝐶|𝐴′)
Pr(𝑃 ∩ 𝐶) = 0.85 ∗ 0 + 0.15 ∗ 0.8 ∗ 0.5
Pr(𝑃 ∩ 𝐶) = 0.06
and we see that Pr(𝑃 ∩ 𝐶) ≠ Pr(𝑃) . Pr(𝐶)
NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 16/17
Roll No: _____________
Thus P and C are not independent.

3. Aamer is not having food from Cafe and he has not brought the lunch box. What
is the probability that he checked the lunch box in the morning?

Let event L = Carry lunchbox and L' = does not carry lunch box, then we can modify the tree
now as:
C
0.1
1.0 L
P
0.8
0.9
C’
A C
0.2 0.8
p P’ 1.0
L’

0.2
C’

C
1-p 0.8
A’ L’
1.0
0.2
C’
Although for this part, the probabilities Pr(A) and Pr(A') are not given and we should have used
p and (1-p) respectively, but let us use the values from part 2 to get a definitive answer.

Pr(𝐴, 𝐶 ′ , 𝐿′ ) Pr(𝐴, 𝑃′, 𝐶 ′ , 𝐿′ )


Pr(𝐴|𝐶 ′ , 𝐿′ ) = =
Pr(𝐶 ′ , 𝐿′ ) Pr(𝐴, 𝐶 ′ , 𝐿′ ) + Pr(𝐴′ , 𝐶 ′ , 𝐿′ )
Pr(𝐴, 𝑃′, 𝐶 ′ , 𝐿′ )
=
Pr(𝐴, 𝑃, 𝐶 ′ , 𝐿′ ) + Pr(𝐴, 𝑃′, 𝐶 ′ , 𝐿′ ) + Pr(𝐴′ , 𝑃, 𝐶 ′ , 𝐿′ ) + Pr(𝐴′ , 𝑃′, 𝐶 ′ , 𝐿′ )
0.85 ∗ 0.2 ∗ 1.0 ∗ 0.2
=
0 + 0.85 ∗ 0.2 ∗ 1.0 ∗ 0.2 + 0.15 ∗ 0.8 ∗ 1.0 ∗ 0.2 + 0.15 ∗ 0.2 ∗ 1.0 ∗ 0.2
0.034
𝑃𝑟(𝐴|𝐶 ′ , 𝐿′ ) = = 0.53125
0.064

NUCES-FAST Islamabad: Spring’19: PRP (EE) Assign # 02 - Sol Page 17/17

You might also like