Probability and Statistics 201-SN1-RE • CEGEP, Montreal

Corrected exercises: probability and conditional probability (201-SN1-RE)

Here are ten corrected exercises on probability and conditional probability for the Probability and Statistics course, 201-SN1-RE, in the Science program at CEGEP, preceded by a list of direct calculations.

What the set covers, the traps it targets

They cover the random experiment, the sample space and events, the axiomatic definition of probability and its properties, the complement, the union and the intersection, mutually exclusive events and independent events, conditional probability, the multiplication rule, the probability tree, the contingency table, the law of total probability and Bayes' theorem, proved in exercise 5, as well as the Monty Hall problem.

By the end of the set, you can prove the rules of calculation from the three axioms (exercise 1), tell mutually exclusive from independent events by calculation and by proof (exercise 2), read a conditional probability in a table (exercise 3), reason on a pedigree (exercise 4), turn a condition around with Bayes' theorem (exercises 5, 7, 9 and 10) and compute the reliability of components in series and in parallel (exercise 6). The situations come from the natural sciences: bird songs picked up by a recorder, a muon telescope, environmental DNA of invasive species, the transmission of a recessive disease, contaminated wells, a hydrometric station, weather forecasting.

The traps covered in detail: adding the probabilities of overlapping events (exercise 1), confusing mutually exclusive with independent (exercises 2 and 8), answering 12\frac{1}{2} instead of 23\frac{2}{3} for the healthy sister of an affected child (exercise 4), treating two children of the same parents as independent (exercise 4), reading P(C∣S)P(C\mid S) as P(S∣C)P(S\mid C) (exercises 5 and 8), adding reliabilities in parallel (exercise 6), concluding “one chance in two” in front of two closed doors (exercise 7) and taking the sensitivity of a test for the probability of being contaminated (exercise 10). Exercises 9 and 10 are complete studies, from the data to the written decision rule.

The thread of the set: after the bar, the sample space changes. P(A∣B)P(A\mid B) counts AA among only the cases where BB occurs. Mutually exclusive, the condition wipes out AA; independent, it changes nothing; and turning the bar around changes the denominator, and therefore the number. Do each exercise in full before opening the solution.

  • 11 corrected exercises • 110 points • 150 minutes
  • Self-checking, 86 answers
  • Calculator
Start exercise 0.1 The chapter sheet

Course recap

  • • AXIOMS: P(E)≥0P(E)\ge 0; P(Ω)=1P(\Omega)=1; if E∩F=∅E\cap F=\varnothing, P(E∪F)=P(E)+P(F)P(E\cup F)=P(E)+P(F). Everything else is proved: P(E‾)=1−P(E)P(\overline{E})=1-P(E), P(E∪F)=P(E)+P(F)−P(E∩F)P(E\cup F)=P(E)+P(F)-P(E\cap F), P(∅)=0P(\varnothing)=0.
  • • CONDITIONAL PROBABILITY: if P(B)>0P(B)>0, P(A∣B)=P(A∩B)P(B)P(A\mid B)=\dfrac{P(A\cap B)}{P(B)}. The condition BB becomes the sample space: P(B)P(B) goes in the denominator. In general P(A∣B)≠P(B∣A)P(A\mid B)\neq P(B\mid A).
  • • MULTIPLICATION RULE: P(A∩B)=P(B) P(A∣B)P(A\cap B)=P(B)\,P(A\mid B). On a probability tree, multiply along a path; the branches coming out of the same node add up to 11.
  • • INDEPENDENCE: AA and BB are independent if P(A∩B)=P(A)P(B)P(A\cap B)=P(A)P(B), that is, when P(B)>0P(B)>0, P(A∣B)=P(A)P(A\mid B)=P(A). MUTUALLY EXCLUSIVE: A∩B=∅A\cap B=\varnothing. Two mutually exclusive events with nonzero probabilities are never independent.
  • • LAW OF TOTAL PROBABILITY: if B1B_{1}, ..., BnB_{n} form a partition of Ω\Omega, P(A)=∑jP(Bj) P(A∣Bj)P(A)=\sum_{j}P(B_{j})\,P(A\mid B_{j}).
  • • BAYES' THEOREM: P(Bi∣A)=P(A∣Bi) P(Bi)∑jP(A∣Bj) P(Bj)P(B_{i}\mid A)=\dfrac{P(A\mid B_{i})\,P(B_{i})}{\sum_{j}P(A\mid B_{j})\,P(B_{j})}. Numerator: one path of the tree; denominator: all the paths that lead to AA.
  • • RELIABILITY, independent components: in series, p1p2p_{1}p_{2}; in parallel, 1−(1−p1)(1−p2)1-(1-p_{1})(1-p_{2}).

Calculations: complement, union, conditional probability, independence

Exercise 0.1: Computing with the rules of probability: twelve direct calculations

13 answers to check

In each line, AA and BB are two events of the same random experiment, and the data given are enough. Compute the probability asked for, as an exact decimal or to three decimal places, or answer the question.

One single move carries the whole list: before writing a number, say WHAT you are counting among. A plain probability counts in the whole sample space; a conditional probability P(A∣B)=P(A∩B)P(B)P(A\mid B)=\dfrac{P(A\cap B)}{P(B)} counts in BB only, and it is P(B)P(B) that goes in the denominator.

  • a) P(A)=0.37P(A)=0.37: compute P(A‾)P(\overline{A}).
  • b) P(A)=0.45P(A)=0.45, P(B)=0.32P(B)=0.32, P(A∩B)=0.12P(A\cap B)=0.12: compute P(A∪B)P(A\cup B).
  • c) Same data as in b): compute P(A∣B)P(A\mid B).
  • d) Same data as in b): compute P(B∣A)P(B\mid A), to three decimal places.
  • e) Same data as in b): compute P(A∩B‾)P(A\cap\overline{B}).
  • f) Same data as in b): compute P(A‾∩B‾)P(\overline{A}\cap\overline{B}).
  • g) AA and BB are independent, P(A)=0.4P(A)=0.4 and P(B)=0.25P(B)=0.25: compute P(A∩B)P(A\cap B).
  • h) Same data as in g): compute P(A∪B)P(A\cup B).
  • i) AA and BB are mutually exclusive, P(A)=0.4P(A)=0.4 and P(B)=0.25P(B)=0.25: compute P(A∪B)P(A\cup B) and P(A∣B)P(A\mid B).
  • j) P(B)=0.3P(B)=0.3, P(A∣B)=0.8P(A\mid B)=0.8 and P(A∣B‾)=0.1P(A\mid\overline{B})=0.1: compute P(A)P(A).
  • k) Same data as in j): compute P(B∣A)P(B\mid A), to three decimal places.
  • l) P(A)=0.6P(A)=0.6, P(B)=0.5P(B)=0.5 and P(A∩B)=0.3P(A\cap B)=0.3: are AA and BB independent?

Type your answers, the page tells you right or wrong 0/13

a)
b)
c)
d)
e)
f)
g)
h)
i)
j)
k)
l)
Show the solution

Answers

  • a) P(A‾)=0.63P(\overline{A})=0.63
  • b) P(A∪B)=0.65P(A\cup B)=0.65
  • c) P(A∣B)=0.375P(A\mid B)=0.375
  • d) P(B∣A)≈0.267P(B\mid A)\approx 0.267
  • e) P(A∩B‾)=0.33P(A\cap\overline{B})=0.33
  • f) P(A‾∩B‾)=0.35P(\overline{A}\cap\overline{B})=0.35
  • g) P(A∩B)=0.1P(A\cap B)=0.1
  • h) P(A∪B)=0.55P(A\cup B)=0.55
  • i) P(A∪B)=0.65P(A\cup B)=0.65 and P(A∣B)=0P(A\mid B)=0
  • j) P(A)=0.31P(A)=0.31
  • k) P(B∣A)≈0.774P(B\mid A)\approx 0.774
  • l) Yes: P(A)P(B)=0.3=P(A∩B)P(A)P(B)=0.3=P(A\cap B)
a)

The complement: P(A‾)=1−P(A)=1−0.37=0.63P(\overline{A})=1-P(A)=1-0.37=0.63.

b)

Addition rule for a union:

P(A∪B)=0.45+0.32−0.12=0.65\displaystyle P(A\cup B)=0.45+0.32-0.12=0.65

The intersection is subtracted because it is counted once in P(A)P(A) and once in P(B)P(B).

c)

The condition BB becomes the sample space, so P(B)P(B) goes in the denominator:

P(A∣B)=0.120.32=0.375\displaystyle P(A\mid B)=\dfrac{0.12}{0.32}=0.375
d)

Same intersection, different sample space:

P(B∣A)=0.120.45≈0.267\displaystyle P(B\mid A)=\dfrac{0.12}{0.45}\approx 0.267

Pitfall: believing that P(B∣A)=P(A∣B)P(B\mid A)=P(A\mid B). The numerator is the same, the denominator is not, and the two numbers differ as soon as P(A)≠P(B)P(A)\neq P(B).

e)

AA splits into two disjoint pieces, A∩BA\cap B and A∩B‾A\cap\overline{B}:

P(A∩B‾)=P(A)−P(A∩B)=0.45−0.12=0.33\displaystyle P(A\cap\overline{B})=P(A)-P(A\cap B)=0.45-0.12=0.33
f)

“Neither AA nor BB” is the complement of “AA or BB” (De Morgan's law, A‾∩B‾=A∪B‾\overline{A}\cap\overline{B}=\overline{A\cup B}):

P(A‾∩B‾)=1−0.65=0.35\displaystyle P(\overline{A}\cap\overline{B})=1-0.65=0.35
g)

Independent: the probability of the intersection is the product.

P(A∩B)=0.4×0.25=0.1\displaystyle P(A\cap B)=0.4\times 0.25=0.1
h)

The addition rule always holds:

P(A∪B)=0.4+0.25−0.1=0.55\displaystyle P(A\cup B)=0.4+0.25-0.1=0.55

Pitfall: adding 0.4+0.250.4+0.25 as if AA and BB were mutually exclusive. Two independent events with nonzero probabilities have an intersection of nonzero probability.

i)

Mutually exclusive: A∩B=∅A\cap B=\varnothing, so P(A∩B)=0P(A\cap B)=0 and the union is a plain sum, P(A∪B)=0.65P(A\cup B)=0.65.

And P(A∣B)=00.25=0P(A\mid B)=\dfrac{0}{0.25}=0: knowing that BB occurred rules out AA. Compare with g), where the same probabilities give an intersection of 0.10.1.

j)

BB and B‾\overline{B} split the sample space. Law of total probability:

P(A)=P(B)P(A∣B)+P(B‾)P(A∣B‾)=0.3×0.8+0.7×0.1=0.31\displaystyle P(A)=P(B)P(A\mid B)+P(\overline{B})P(A\mid\overline{B})=0.3\times 0.8+0.7\times 0.1=0.31
k)

Turn the condition around, with the result of j) in the denominator:

P(B∣A)=P(A∩B)P(A)=0.240.31≈0.774\displaystyle P(B\mid A)=\dfrac{P(A\cap B)}{P(A)}=\dfrac{0.24}{0.31}\approx 0.774

This is Bayes' theorem, on two branches.

l)

Compare the intersection with the product: P(A)P(B)=0.6×0.5=0.3=P(A∩B)P(A)P(B)=0.6\times 0.5=0.3=P(A\cap B). The events are independent.

Check with the definition: P(A∣B)=0.30.5=0.6=P(A)P(A\mid B)=\dfrac{0.3}{0.5}=0.6=P(A), knowing BB changes nothing for AA.

Tick the exercises you have done or want to review: a free account, no password, keeps your ticks and your right answers from one visit to the next, tells you which chapter to tackle next and lets you ask for the exercise you are missing. Create your space, an email is enough.

Part A: the basics (/50)

Exercise 1: From the axioms to the rules of calculation: songs picked up by a recorder in the forest

8 answers to check

An automated acoustic recorder is attached to a tree in a mixed forest. Every morning in June, its software identifies the species that produced the first vocalization detected after dawn. Over one season, the observed frequencies give the model in the table, which we adopt: the random experiment is “record the species of the first vocalization on a morning chosen at random”, and only these seven species are detected at that hour. The probability of the Tree Swallow was erased from the report.

Let MM be the event “the species is migratory” and NN the event “the species nests in a cavity”. The diagram places each species, by its code, in MM, in NN, in both or in neither.

Recall the three axioms of a probability PP on a sample space Ω\Omega: (A1) P(E)≥0P(E)\ge 0 for every event EE; (A2) P(Ω)=1P(\Omega)=1; (A3) if E∩F=∅E\cap F=\varnothing, then P(E∪F)=P(E)+P(F)P(E\cup F)=P(E)+P(F).

CodeSpeciesMigratoryNestProbability
THermit Thrushyeson the ground0.20
OOvenbirdyeson the ground0.16
WWhite-throated Sparrowyeson the ground0.24
STree Swallowyescavity?
CBlack-capped Chickadeenocavity0.14
HHairy Woodpeckernocavity0.06
JCanada Jaynobranch0.08
ΩMNTOWSCHJ
  • a) Describe the sample space Ω\Omega. Find the probability of the Tree Swallow, naming the axioms you use.
  • b) Using the diagram, compute P(M)P(M), P(N)P(N) and P(M∩N)P(M\cap N).
  • c) Compute P(M∪N)P(M\cup N) with the addition rule, then with the complementary event. Translate M∪N‾\overline{M\cup N} into a sentence.
  • d) Prove, from axioms (A1) to (A3) alone, that P(E‾)=1−P(E)P(\overline{E})=1-P(E), then that P(E∪F)=P(E)+P(F)−P(E∩F)P(E\cup F)=P(E)+P(F)-P(E\cap F) for any two events EE and FF.
  • e) A student notices that P(M)+P(N)>1P(M)+P(N)>1 and concludes that the model is wrong, since a probability never exceeds 11. Is the model inconsistent? Justify.
  • f) Compute P(M∣N)P(M\mid N) and P(N∣M)P(N\mid M), to three decimal places. Explain in one sentence why these two numbers differ.

Type your answers, the page tells you right or wrong 0/8

a)
b)
c)
e)
f)
Show the solution

Answers

  • a) Ω={T,O,W,S,C,H,J}\Omega=\{T,O,W,S,C,H,J\}; P({S})=0.12P(\{S\})=0.12
  • b) P(M)=0.72P(M)=0.72, P(N)=0.32P(N)=0.32, P(M∩N)=0.12P(M\cap N)=0.12
  • c) P(M∪N)=0.92P(M\cup N)=0.92; M∪N‾\overline{M\cup N}: “the species is a year-round resident and does not nest in a cavity”, that is {J}\{J\}
  • d) Proofs with (A2) and (A3) on a partition into disjoint pieces
  • e) No: P(M)+P(N)=1.04P(M)+P(N)=1.04 counts P(M∩N)=0.12P(M\cap N)=0.12 twice
  • f) P(M∣N)=0.375P(M\mid N)=0.375; P(N∣M)≈0.167P(N\mid M)\approx 0.167: the denominators differ
a)

An outcome is a species: Ω={T,O,W,S,C,H,J}\Omega=\{T,O,W,S,C,H,J\}, seven outcomes that are NOT equally likely.

The seven elementary events are pairwise disjoint and their union is Ω\Omega. By (A3) applied step by step, then (A2):

P({T})+P({O})+⋯+P({J})=P(Ω)=1\displaystyle P(\{T\})+P(\{O\})+\dots+P(\{J\})=P(\Omega)=1
P({S})=1−(0.20+0.16+0.24+0.14+0.06+0.08)=1−0.88=0.12\displaystyle P(\{S\})=1-(0.20+0.16+0.24+0.14+0.06+0.08)=1-0.88=0.12

The result is nonnegative, as (A1) requires: the completed model is a probability.

b)

Add the species of each region, which are pairwise disjoint, by (A3):

P(M)=P({T,O,W,S})=0.20+0.16+0.24+0.12=0.72\displaystyle P(M)=P(\{T,O,W,S\})=0.20+0.16+0.24+0.12=0.72
P(N)=P({S,C,H})=0.12+0.14+0.06=0.32\displaystyle P(N)=P(\{S,C,H\})=0.12+0.14+0.06=0.32

M∩N={S}M\cap N=\{S\}, the only migratory species that nests in a cavity: P(M∩N)=0.12P(M\cap N)=0.12.

c)

With the addition rule:

P(M∪N)=0.72+0.32−0.12=0.92\displaystyle P(M\cup N)=0.72+0.32-0.12=0.92

With the complement: M∪N‾=M‾∩N‾\overline{M\cup N}=\overline{M}\cap\overline{N}, the species is not migratory AND does not nest in a cavity. That is the Canada Jay alone, hence P(M∪N)=1−0.08=0.92P(M\cup N)=1-0.08=0.92.

The two calculations agree: that is the check to make every time there are two routes.

d)

Complement. EE and E‾\overline{E} are disjoint and E∪E‾=ΩE\cup\overline{E}=\Omega. By (A3) then (A2):

P(E)+P(E‾)=P(Ω)=1P(E)+P(\overline{E})=P(\Omega)=1, so P(E‾)=1−P(E)P(\overline{E})=1-P(E).

Union. Cut into disjoint pieces: E∪F=E∪(F∩E‾)E\cup F=E\cup(F\cap\overline{E}) and F=(F∩E)∪(F∩E‾)F=(F\cap E)\cup(F\cap\overline{E}). By (A3), twice:

P(E∪F)=P(E)+P(F∩E‾)P(E\cup F)=P(E)+P(F\cap\overline{E}) and P(F)=P(F∩E)+P(F∩E‾)P(F)=P(F\cap E)+P(F\cap\overline{E})

Take P(F∩E‾)=P(F)−P(E∩F)P(F\cap\overline{E})=P(F)-P(E\cap F) from the second equality and substitute it into the first:

P(E∪F)=P(E)+P(F)−P(E∩F)\displaystyle P(E\cup F)=P(E)+P(F)-P(E\cap F)

The mutually exclusive case is only the special case P(E∩F)=0P(E\cap F)=0: the plain sum is axiom (A3), not a general rule.

e)

No. P(M)+P(N)=0.72+0.32=1.04P(M)+P(N)=0.72+0.32=1.04 is not the probability of any event: S is counted once in MM and once in NN.

The axioms say nothing about the sum of the probabilities of two overlapping events. The probability of the union, on the other hand, is 0.92≤10.92\le 1.

Pitfall: adding the probabilities of two events without checking that they are disjoint. Going over 11 is the sign of a nonempty intersection here, not of an error in the model.

f)

Given NN, the sample space becomes N={S,C,H}N=\{S,C,H\}, with probability 0.320.32:

P(M∣N)=P(M∩N)P(N)=0.120.32=0.375\displaystyle P(M\mid N)=\dfrac{P(M\cap N)}{P(N)}=\dfrac{0.12}{0.32}=0.375

Given MM, the sample space becomes M={T,O,W,S}M=\{T,O,W,S\}, with probability 0.720.72:

P(N∣M)=0.120.72≈0.167\displaystyle P(N\mid M)=\dfrac{0.12}{0.72}\approx 0.167

Same numerator, the Tree Swallow, but not the same sample space: among the cavity nesters it weighs a lot; among the migrants it is drowned out. That is the thread of the whole set.

Exercise 2: Mutually exclusive or independent: the two plates of a muon telescope

8 answers to check

A laboratory muon telescope stacks two scintillator plates, S1 and S2, each connected to a photomultiplier tube. A coincidence unit counts a particle only if BOTH plates responded. For a muon that goes through both plates, let D1D_{1} be “S1 detects it” and D2D_{2} “S2 detects it”. The measured efficiencies are P(D1)=0.96P(D_{1})=0.96 and P(D2)=0.93P(D_{2})=0.93, and we assume that D1D_{1} and D2D_{2} are independent: the light produced in one plate has no influence on detection in the other.

We also model the nature of a charged particle that reaches the telescope: it is a muon (event UU) with probability 0.750.75, an electron (event EE) with probability 0.200.20, and some other particle otherwise.

S1PMT1S2PMT2ANDcoincidenceμ
  • a) Compute the probability that a muon going through the telescope is counted by the coincidence unit.
  • b) Compute P(D1∪D2)P(D_{1}\cup D_{2}) in two ways: with the addition rule, then with the complementary event.
  • c) Prove that if two events AA and BB are independent, then AA and B‾\overline{B} are independent too. Deduce the probability that a muon is seen by S1 but missed by S2.
  • d) Are the events UU and EE mutually exclusive? Are they independent? Justify each answer with a calculation.
  • e) Prove that two mutually exclusive events with nonzero probabilities are never independent. Are the events D1D_{1} and D2D_{2} mutually exclusive?
  • f) Compute P(E∣U)P(E\mid U), then P(E∣U‾)P(E\mid\overline{U}). Interpret these two values.

Type your answers, the page tells you right or wrong 0/8

a)
b)
c)
d)
e)
f)
Show the solution

Answers

  • a) P(D1∩D2)=0.8928≈0.893P(D_{1}\cap D_{2})=0.8928\approx 0.893
  • b) P(D1∪D2)=0.9972P(D_{1}\cup D_{2})=0.9972
  • c) P(D1∩D2‾)=0.96×0.07=0.0672P(D_{1}\cap\overline{D_{2}})=0.96\times 0.07=0.0672
  • d) Mutually exclusive: yes; independent: no, 0≠0.150\neq 0.15
  • e) P(A∩B)=0<P(A)P(B)P(A\cap B)=0<P(A)P(B); D1D_{1} and D2D_{2} are not mutually exclusive
  • f) P(E∣U)=0P(E\mid U)=0; P(E∣U‾)=0.8P(E\mid\overline{U})=0.8
a)

The muon is counted if S1 AND S2 detect it. The two events are independent, so:

P(D1∩D2)=P(D1)P(D2)=0.96×0.93=0.8928≈0.893\displaystyle P(D_{1}\cap D_{2})=P(D_{1})P(D_{2})=0.96\times 0.93=0.8928\approx 0.893

Nearly one muon in nine escapes the count, although each plate sees more than nine in ten: requiring a coincidence costs efficiency, and that is the price of a reduced background.

b)

With the union:

P(D1∪D2)=0.96+0.93−0.8928=0.9972\displaystyle P(D_{1}\cup D_{2})=0.96+0.93-0.8928=0.9972

With the complement: “at least one plate” has complement “no plate”, and D1‾\overline{D_{1}}, D2‾\overline{D_{2}} are independent (question c):

1−P(D1‾)P(D2‾)=1−0.04×0.07=1−0.0028=0.9972\displaystyle 1-P(\overline{D_{1}})P(\overline{D_{2}})=1-0.04\times 0.07=1-0.0028=0.9972
c)

AA splits into two disjoint pieces, A∩BA\cap B and A∩B‾A\cap\overline{B}, so P(A∩B‾)=P(A)−P(A∩B)P(A\cap\overline{B})=P(A)-P(A\cap B). With the independence of AA and BB:

P(A∩B‾)=P(A)−P(A)P(B)=P(A)(1−P(B))=P(A)P(B‾)\displaystyle P(A\cap\overline{B})=P(A)-P(A)P(B)=P(A)\bigl(1-P(B)\bigr)=P(A)P(\overline{B})

This is exactly the definition of the independence of AA and B‾\overline{B}.

Application: P(D1∩D2‾)=0.96×0.07=0.0672P(D_{1}\cap\overline{D_{2}})=0.96\times 0.07=0.0672.

d)

A particle cannot be both a muon and an electron: U∩E=∅U\cap E=\varnothing, the events are mutually exclusive.

Independence: P(U∩E)=0P(U\cap E)=0 whereas P(U)P(E)=0.75×0.20=0.15P(U)P(E)=0.75\times 0.20=0.15. The two numbers differ, so UU and EE are NOT independent.

Pitfall: saying “they have nothing to do with each other, so they are independent”. Knowing that the particle is a muon rules out the electron: that is the strongest dependence there is.

e)

If A∩B=∅A\cap B=\varnothing with P(A)>0P(A)>0 and P(B)>0P(B)>0, then P(A∩B)=0P(A\cap B)=0 while P(A)P(B)>0P(A)P(B)>0 as the product of two strictly positive numbers. The equality required for independence is impossible.

Conversely, D1D_{1} and D2D_{2} are independent and P(D1∩D2)=0.8928≠0P(D_{1}\cap D_{2})=0.8928\neq 0: they are not mutually exclusive, most muons are seen by both plates.

The two words even say almost the opposite: mutually exclusive, the occurrence of one tells you everything about the other; independent, it tells you nothing at all.

f)

Given UU, the electron is ruled out: P(E∣U)=P(E∩U)P(U)=0P(E\mid U)=\dfrac{P(E\cap U)}{P(U)}=0.

Given U‾\overline{U}, the sample space shrinks to the particles that are not muons, with probability 0.250.25; the electron is one of them:

P(E∣U‾)=P(E∩U‾)P(U‾)=0.200.25=0.8\displaystyle P(E\mid\overline{U})=\dfrac{P(E\cap\overline{U})}{P(\overline{U})}=\dfrac{0.20}{0.25}=0.8

A condition changes the sample space in which you count: it can wipe out a probability or multiply it by four. Neither value equals P(E)=0.20P(E)=0.20, which confirms that UU and EE are dependent.

Exercise 3: Reading a contingency table: environmental DNA of an invasive mussel by season

10 answers to check

A team looks for the DNA of the zebra mussel, an invasive species, in the water of lakes where its presence has already been confirmed by divers. Each one-litre sample is filtered, then the species' DNA is searched for by amplification. The table gives the result of 200200 samples by season. A sample is drawn at random from the 200200; let DD be “the species' DNA is detected”, and SpSp, SuSu and FaFa the season of the sample (spring, summer, fall).

In addition, 120120 of these samples were filtered on a type A membrane, and 3636 of them gave a detection.

SpringSummerFallTotal
Detected1536960
Not detected454451140
Total608060200
  • a) Compute P(D)P(D), P(Su)P(Su) and P(D∩Su)P(D\cap Su).
  • b) Compute P(D∣Su)P(D\mid Su) and P(Su∣D)P(Su\mid D). Explain, using the table, why these two numbers differ.
  • c) Compute P(D∣Sp)P(D\mid Sp) and P(D∣Fa)P(D\mid Fa).
  • d) Is detection independent of the season of the sample? Justify with a comparison.
  • e) Find P(D)P(D) again from the conditional probabilities of b) and c) and the proportions of the three seasons only. Name the formula used.
  • f) Let AA be “the sample was filtered on a type A membrane”. In these data, are DD and AA independent? Can we conclude that the type of membrane has no effect at all on detection?

Type your answers, the page tells you right or wrong 0/10

a)
b)
c)
d)
e)
f)
Show the solution

Answers

  • a) P(D)=0.3P(D)=0.3, P(Su)=0.4P(Su)=0.4, P(D∩Su)=0.18P(D\cap Su)=0.18
  • b) P(D∣Su)=0.45P(D\mid Su)=0.45; P(Su∣D)=0.6P(Su\mid D)=0.6: denominators 8080 and 6060
  • c) P(D∣Sp)=0.25P(D\mid Sp)=0.25; P(D∣Fa)=0.15P(D\mid Fa)=0.15
  • d) No: P(D∣Su)=0.45≠P(D)=0.3P(D\mid Su)=0.45\neq P(D)=0.3
  • e) Law of total probability: 0.3×0.25+0.4×0.45+0.3×0.15=0.30.3\times 0.25+0.4\times 0.45+0.3\times 0.15=0.3
  • f) Yes, P(D∣A)=0.3=P(D)P(D\mid A)=0.3=P(D); but an equality in a sample does not prove the absence of an effect
a)

Read the totals and the relevant cell, out of the 200200 samples:

P(D)=60200=0.3P(D)=\dfrac{60}{200}=0.3, P(Su)=80200=0.4P(Su)=\dfrac{80}{200}=0.4, P(D∩Su)=36200=0.18P(D\cap Su)=\dfrac{36}{200}=0.18

b)

Given summer, the sample space becomes the Summer column, 8080 samples:

P(D∣Su)=3680=0.45\displaystyle P(D\mid Su)=\dfrac{36}{80}=0.45

Given DD, the sample space becomes the Detected row, 6060 samples:

P(Su∣D)=3660=0.6\displaystyle P(Su\mid D)=\dfrac{36}{60}=0.6

The cell 3636 is the same; the condition chooses the total you divide by. With probabilities: 0.180.4\dfrac{0.18}{0.4} versus 0.180.3\dfrac{0.18}{0.3}.

Pitfall: answering 0.180.18, the probability of the intersection, to a conditional question. “Among the summer samples” restricts the sample space; “detected and in summer” does not.

c)

Same move in the other two columns:

P(D∣Sp)=1560=0.25P(D\mid Sp)=\dfrac{15}{60}=0.25 and P(D∣Fa)=960=0.15P(D\mid Fa)=\dfrac{9}{60}=0.15

d)

If detection were independent of the season, we would have P(D∣Su)=P(D)P(D\mid Su)=P(D). But 0.45≠0.30.45\neq 0.3: detection depends on the season.

The product confirms it: P(D)P(Su)=0.12P(D)P(Su)=0.12 whereas P(D∩Su)=0.18P(D\cap Su)=0.18.

A plausible biological explanation, which the data alone do not prove: in warm water the mussel is more active and releases more DNA, especially during reproduction.

e)

The three seasons form a partition of the sample space. Law of total probability:

P(D)=P(Sp)P(D∣Sp)+P(Su)P(D∣Su)+P(Fa)P(D∣Fa)\displaystyle P(D)=P(Sp)P(D\mid Sp)+P(Su)P(D\mid Su)+P(Fa)P(D\mid Fa)
P(D)=0.3×0.25+0.4×0.45+0.3×0.15=0.075+0.18+0.045=0.3\displaystyle P(D)=0.3\times 0.25+0.4\times 0.45+0.3\times 0.15=0.075+0.18+0.045=0.3

This is the direct reading of a) again. The figure in the solution shows it: each column has the probability of its season as its width, the blue part has the conditional probability as its height, and its area is the probability of the intersection.

f)

P(D∣A)=36120=0.3=P(D)P(D\mid A)=\dfrac{36}{120}=0.3=P(D): in these 200200 samples, DD and AA are independent.

That does not allow us to state that the membrane has no effect at all. An exact equality in a sample is fragile: a few more samples would shift it, and a real effect could be masked by the season if the membranes were not used in the same proportions in every season.

Deciding whether a difference observed in a contingency table reveals a real dependence is the purpose of the chi-square test of independence, seen later in the course.

springP = 0.30.25summerP = 0.40.45fallP = 0.30.15detectednot detected

Exercise 4: Mendelian genetics: why the healthy sister is a carrier with probability 2/3

6 answers to check

A hereditary disease is caused by a recessive allele aa of an autosomal gene; the normal allele AA is dominant. Only aaaa individuals are affected; AaAa individuals are called healthy carriers. In the family shown in the pedigree, Hugo is affected, while his two parents and his sister Leah are not. Leah has a partner, Mark, with no family history of the disease.

Model adopted: each parent passes on one of their two alleles with probability 12\frac{1}{2}, independently of the other parent and from one child to the next; a person from the general population, healthy and with no family history, is a carrier with probability 130\frac{1}{30} (a value chosen for the exercise, of the same order as for several recessive diseases).

?LeahMarkHugoIIIIIImalefemaleaffectedunborn
  • a) Justify that both of Hugo's parents are carriers, with genotype AaAa.
  • b) For a child of these parents, compute the probabilities of the genotypes aaaa, AaAa and AAAA using a tree of the two alleles passed on.
  • c) Leah is not affected. Show that the probability that she is a carrier is 23\frac{2}{3}, and not 12\frac{1}{2}.
  • d) Compute the probability that the first child of Leah and Mark is affected.
  • e) Leah and Mark are planning two children. Compute the probability that at least one of the two is affected, to five decimal places.
  • f) A student answers e) with 1−(1−1180)21-\left(1-\frac{1}{180}\right)^{2}. Explain why this calculation is wrong.

Type your answers, the page tells you right or wrong 0/6

b)
c)
d)
e)
Show the solution

Answers

  • a) Hugo is aaaa: he received an aa from each parent, who are healthy, hence AaAa
  • b) P(aa)=14P(aa)=\frac{1}{4}, P(Aa)=12P(Aa)=\frac{1}{2}, P(AA)=14P(AA)=\frac{1}{4}
  • c) P(Aa∣healthy)=1/23/4=23P(Aa\mid\text{healthy})=\dfrac{1/2}{3/4}=\dfrac{2}{3}
  • d) 23×130×14=1180≈0.00556\frac{2}{3}\times\frac{1}{30}\times\frac{1}{4}=\frac{1}{180}\approx 0.00556
  • e) 23×130×716=7720≈0.00972\frac{2}{3}\times\frac{1}{30}\times\frac{7}{16}=\frac{7}{720}\approx 0.00972
  • f) The status of the two children is not independent: both depend on the same parental genotypes
a)

Hugo is affected, so he is aaaa: he received one allele aa from his father and one allele aa from his mother.

Each parent therefore carries at least one aa; neither is affected, so neither is aaaa. Both are AaAa.

b)

A two-level tree: the father's allele (AA or aa, 12\frac{1}{2} each), then the mother's (12\frac{1}{2} each). The transmissions are independent, so multiply along a path:

P(aa)=12×12=14P(aa)=\frac{1}{2}\times\frac{1}{2}=\frac{1}{4} and P(AA)=14P(AA)=\frac{1}{4}

AaAa gathers two disjoint paths, (AA from the father, aa from the mother) and (aa from the father, AA from the mother): P(Aa)=14+14=12P(Aa)=\frac{1}{4}+\frac{1}{4}=\frac{1}{2}.

Check: 14+12+14=1\frac{1}{4}+\frac{1}{2}+\frac{1}{4}=1.

c)

We know that Leah is not aaaa. The event “healthy” is {AA,Aa}\{AA, Aa\}, with probability 34\frac{3}{4}, and “carrier” is contained in “healthy”:

P(Aa∣healthy)=P(Aa)P(healthy)=1/23/4=23\displaystyle P(Aa\mid\text{healthy})=\dfrac{P(Aa)}{P(\text{healthy})}=\dfrac{1/2}{3/4}=\dfrac{2}{3}

Pitfall: answering 12\frac{1}{2}, the probability of being a carrier BEFORE knowing that Leah is healthy. The information “healthy” removes the case aaaa from the sample space, and the two remaining cases AAAA and AaAa do not weigh the same: AaAa comes from two paths, AAAA from only one.

d)

The child can be affected only if Leah AND Mark are carriers, and the child then receives aa from both. The genotypes of Leah and Mark are independent (Mark is not related to the family), so multiply along the path of the tree:

P(affected)=23×130×14=2360=1180≈0.00556\displaystyle P(\text{affected})=\dfrac{2}{3}\times\dfrac{1}{30}\times\dfrac{1}{4}=\dfrac{2}{360}=\dfrac{1}{180}\approx 0.00556

The other paths (Leah AAAA, or Mark AAAA) give a healthy child with certainty: they count for 00 in the law of total probability.

e)

First condition on the parents' genotypes. If both are carriers, each child is affected with probability 14\frac{1}{4}, independently of the other:

P(at least one affected∣two carriers)=1−(34)2=716\displaystyle P(\text{at least one affected}\mid\text{two carriers})=1-\left(\dfrac{3}{4}\right)^{2}=\dfrac{7}{16}

Otherwise, no child is affected. By the law of total probability:

P=23×130×716=141440=7720≈0.00972\displaystyle P=\dfrac{2}{3}\times\dfrac{1}{30}\times\dfrac{7}{16}=\dfrac{14}{1440}=\dfrac{7}{720}\approx 0.00972
f)

The calculation 1−(1−1180)2≈0.011081-\left(1-\frac{1}{180}\right)^{2}\approx 0.01108 assumes that “the first child is affected” and “the second child is affected” are independent. They are not: both require Leah and Mark to be carriers.

Knowing that the first child is affected proves that both parents are carriers, and the probability that the second child is affected jumps from 1180\frac{1}{180} to 14\frac{1}{4}.

Pitfall: confusing independence GIVEN the genotypes, which is true in this model, with plain independence, which is false. Here the error overestimates the risk by about 14%14\%.

Leah AaMark Aachild aa1/180healthy childMark AALeah AA2/31/301/43/429/301/3

Exercise 5: Bayes' theorem proved, then applied: three types of wells and a positive analysis

9 answers to check

In a rural region, private wells are classified into three types: deep drilled tubular wells (TT), 60%60\% of the wells; dug surface wells (SS), 15%15\%; driven filter points (FF), the rest. A sampling campaign gave, for each type, the proportion of wells where coliform bacteria are present: 5%5\% of the tubular wells, 16%16\% of the surface wells and 8%8\% of the filter points (data for the exercise).

A well is chosen at random; let CC be “the water contains coliforms”. The laboratory analysis is considered error-free here; the imperfect test is the subject of exercise 10.

TCCSCCFCC0.600.05?0.150.16??0.08?
  • a) Complete the tree: give P(F)P(F) and the three probabilities P(C‾∣T)P(\overline{C}\mid T), P(C‾∣S)P(\overline{C}\mid S), P(C‾∣F)P(\overline{C}\mid F).
  • b) Compute P(C)P(C), naming the formula used.
  • c) Prove Bayes' theorem: if B1B_{1}, ..., BnB_{n} form a partition of Ω\Omega with P(Bj)>0P(B_{j})>0 for every jj, and if P(A)>0P(A)>0, then P(Bi∣A)=P(A∣Bi)P(Bi)∑j=1nP(A∣Bj)P(Bj)P(B_{i}\mid A)=\dfrac{P(A\mid B_{i})P(B_{i})}{\sum_{j=1}^{n}P(A\mid B_{j})P(B_{j})}.
  • d) The analysis of a well chosen at random reveals coliforms. Compute P(T∣C)P(T\mid C), P(S∣C)P(S\mid C) and P(F∣C)P(F\mid C), to three decimal places.
  • e) Which type of well is the most likely for a contaminated well? Compare with the type of well that is most often contaminated, and explain the difference.

Type your answers, the page tells you right or wrong 0/9

a)
b)
d)
e)
Show the solution

Answers

  • a) P(F)=0.25P(F)=0.25; 0.950.95, 0.840.84 and 0.920.92
  • b) Law of total probability: P(C)=0.074P(C)=0.074
  • c) Definition of conditional probability in the numerator, law of total probability in the denominator
  • d) P(T∣C)≈0.405P(T\mid C)\approx 0.405, P(S∣C)≈0.324P(S\mid C)\approx 0.324, P(F∣C)≈0.270P(F\mid C)\approx 0.270
  • e) Tubular (0.4050.405), whereas the highest rate is that of the surface wells (0.160.16)
a)

The three types form a partition: P(F)=1−0.60−0.15=0.25P(F)=1-0.60-0.15=0.25.

Under each node, the two branches add up to 11: P(C‾∣T)=0.95P(\overline{C}\mid T)=0.95, P(C‾∣S)=0.84P(\overline{C}\mid S)=0.84, P(C‾∣F)=0.92P(\overline{C}\mid F)=0.92.

b)

TT, SS, FF form a partition of the sample space; law of total probability:

P(C)=P(T)P(C∣T)+P(S)P(C∣S)+P(F)P(C∣F)\displaystyle P(C)=P(T)P(C\mid T)+P(S)P(C\mid S)+P(F)P(C\mid F)
P(C)=0.60×0.05+0.15×0.16+0.25×0.08=0.030+0.024+0.020=0.074\displaystyle P(C)=0.60\times 0.05+0.15\times 0.16+0.25\times 0.08=0.030+0.024+0.020=0.074

Order of magnitude check: 0.0740.074 does lie between the smallest rate, 0.050.05, and the largest, 0.160.16, and close to the rate of the most common type.

c)

Step 1, the numerator. By definition, P(Bi∣A)=P(Bi∩A)P(A)P(B_{i}\mid A)=\dfrac{P(B_{i}\cap A)}{P(A)}, and, again by definition, P(A∣Bi)=P(A∩Bi)P(Bi)P(A\mid B_{i})=\dfrac{P(A\cap B_{i})}{P(B_{i})}, hence P(Bi∩A)=P(A∣Bi)P(Bi)P(B_{i}\cap A)=P(A\mid B_{i})P(B_{i}).

Step 2, the denominator. The BjB_{j} are pairwise disjoint with union Ω\Omega, so the A∩BjA\cap B_{j} are pairwise disjoint with union AA. By additivity:

P(A)=∑j=1nP(A∩Bj)=∑j=1nP(A∣Bj)P(Bj)\displaystyle P(A)=\sum_{j=1}^{n}P(A\cap B_{j})=\sum_{j=1}^{n}P(A\mid B_{j})P(B_{j})

Step 3, substitute:

P(Bi∣A)=P(A∣Bi)P(Bi)∑j=1nP(A∣Bj)P(Bj)\displaystyle P(B_{i}\mid A)=\dfrac{P(A\mid B_{i})P(B_{i})}{\sum_{j=1}^{n}P(A\mid B_{j})P(B_{j})}

The hypotheses are all used: P(Bj)>0P(B_{j})>0 so that P(A∣Bj)P(A\mid B_{j}) makes sense, P(A)>0P(A)>0 to divide. The formula is therefore not one more theorem to memorize: it is the definition written twice.

d)

Numerators: the three paths that end in CC. Denominator: their sum, P(C)=0.074P(C)=0.074.

P(T∣C)=0.0300.074≈0.405\displaystyle P(T\mid C)=\dfrac{0.030}{0.074}\approx 0.405
P(S∣C)=0.0240.074≈0.324\displaystyle P(S\mid C)=\dfrac{0.024}{0.074}\approx 0.324
P(F∣C)=0.0200.074≈0.270\displaystyle P(F\mid C)=\dfrac{0.020}{0.074}\approx 0.270

Check: the three add up to 11, because given CC the well is always of one of the three types.

e)

The most likely type for a contaminated well is the tubular well, with 0.4050.405, even though it is the type LEAST often contaminated (5%5\%).

The highest rate is that of the surface wells, P(C∣S)=0.16P(C\mid S)=0.16, but they make up only 15%15\% of the wells: they contribute 0.0240.024 of probability in total, against 0.0300.030 for the tubular wells, which are four times as numerous.

Pitfall: reading P(C∣S)P(C\mid S), “among the surface wells, how many are contaminated”, as P(S∣C)P(S\mid C), “among the contaminated wells, how many are surface wells”. The first counts in branch SS, the second in the set of all paths that end in CC.

The two inform different decisions: P(C∣S)P(C\mid S) says which type to monitor first; P(T∣C)P(T\mid C) says where most of the contaminated wells will be found.

Part B: problems and reasoning (/50)

Exercise 6: Reliability in series and in parallel: a remote hydrometric station through a whole winter

6 answers to check

A remote station measures the water level of a river and transmits its data. It works for a winter month if the level sensor LL works, if at least one of the two power supplies works (solar panel with battery P1P_{1}, backup battery pack P2P_{2}), if the data logger EE works, and if at least one of the two transmitters works (satellite SS, cellular modem RR). The diagram gives, under each component, its probability of working for the whole month.

In questions a) to e), the six components are assumed independent. A component and the event “it works for the whole month” are denoted by the same name.

L0.98P10.90P20.85E0.99S0.95R0.80power supplytransmission
  • a) Prove that two independent components connected in parallel, with reliabilities pp and qq, form a block with reliability 1−(1−p)(1−q)1-(1-p)(1-q).
  • b) Compute the reliability of the power supply block and that of the transmission block.
  • c) Compute the probability that the station works for the whole month, to four decimal places.
  • d) The budget allows ONE single component or block to be duplicated by an identical component connected in parallel. Which one should be duplicated to increase the reliability of the station the most? Justify with calculations.
  • e) The station broke down during the month. Compute the probability that the sensor LL failed, to three decimal places.
  • f) In reality, an ice storm can knock out the panel and the backup battery together. A study then estimates P(P1‾∩P2‾)=0.06P(\overline{P_{1}}\cap\overline{P_{2}})=0.06, the other assumptions being unchanged. Recompute the reliability of the station, to four decimal places, and comment.

Type your answers, the page tells you right or wrong 0/6

b)
c)
d)
e)
f)
Show the solution

Answers

  • a) P(A∪B)=1−P(A‾∩B‾)=1−(1−p)(1−q)P(A\cup B)=1-P(\overline{A}\cap\overline{B})=1-(1-p)(1-q)
  • b) Power supply 0.9850.985; transmission 0.990.99
  • c) 0.98×0.985×0.99×0.99≈0.94610.98\times 0.985\times 0.99\times 0.99\approx 0.9461
  • d) The sensor LL: the reliability rises to 0.96500.9650, against at most 0.96030.9603 for the other choices
  • e) P(L‾∣failure)=0.020.0539≈0.371P(\overline{L}\mid\text{failure})=\dfrac{0.02}{0.0539}\approx 0.371
  • f) 0.98×0.94×0.99×0.99≈0.90290.98\times 0.94\times 0.99\times 0.99\approx 0.9029: a common-cause failure ruins the redundancy
a)

The block works if AA OR BB works: that is the union. Its complement, by De Morgan, is A‾∩B‾\overline{A}\cap\overline{B}: both have failed.

AA and BB are independent, so A‾\overline{A} and B‾\overline{B} are too (exercise 2, question c, applied twice):

P(A∪B)=1−P(A‾)P(B‾)=1−(1−p)(1−q)\displaystyle P(A\cup B)=1-P(\overline{A})P(\overline{B})=1-(1-p)(1-q)

In series, the block requires AA AND BB: that is the intersection, with probability pqpq by independence.

b)

Power supply: 1−0.10×0.15=1−0.015=0.9851-0.10\times 0.15=1-0.015=0.985.

Transmission: 1−0.05×0.20=1−0.010=0.991-0.05\times 0.20=1-0.010=0.99.

Pitfall: adding, 0.90+0.85=1.750.90+0.85=1.75, which exceeds 11; or multiplying the reliabilities, 0.7650.765, which is the formula for a SERIES connection and makes the block less reliable than each of its components.

c)

The four blocks LL, power supply, EE, transmission are in series and independent:

P(station)=0.98×0.985×0.99×0.99≈0.9461\displaystyle P(\text{station})=0.98\times 0.985\times 0.99\times 0.99\approx 0.9461

A chain is less reliable than its weakest link: 0.9461<0.980.9461<0.98.

d)

Recompute the reliability for each choice:

sensor duplicated: 1−0.022=0.99961-0.02^{2}=0.9996, station ≈0.9650\approx 0.9650;

data logger duplicated: 1−0.012=0.99991-0.01^{2}=0.9999, station ≈0.9556\approx 0.9556;

power supply block duplicated, that is, a second identical panel-and-battery set connected in parallel with the first: the block fails only if both sets fail, 1−0.0152=0.9997751-0.015^{2}=0.999775, station ≈0.9603\approx 0.9603;

transmission block duplicated in the same way: 1−0.0102=0.99991-0.010^{2}=0.9999, station ≈0.9556\approx 0.9556.

Duplicate the sensor LL: it is the least reliable link in the chain (0.980.98), and duplicating it raises the station from 0.94610.9461 to 0.96500.9650.

e)

The station fails as soon as one block fails: P(failure)=1−0.94609≈0.05391P(\text{failure})=1-0.94609\approx 0.05391.

A sensor failure causes a station failure, so L‾∩failure=L‾\overline{L}\cap\text{failure}=\overline{L}:

P(L‾∣failure)=P(L‾)P(failure)=0.020.05391≈0.371\displaystyle P(\overline{L}\mid\text{failure})=\dfrac{P(\overline{L})}{P(\text{failure})}=\dfrac{0.02}{0.05391}\approx 0.371

Before the failure, the sensor had a 2%2\% chance of being faulty; once the failure is observed, it is the prime suspect, at 37%37\%. The condition changed the sample space, and the technician who heads out by snowmobile knows where to start.

f)

With the common failure, the power supply block has reliability 1−0.06=0.941-0.06=0.94 instead of 0.9850.985:

P(station)=0.98×0.94×0.99×0.99≈0.9029\displaystyle P(\text{station})=0.98\times 0.94\times 0.99\times 0.99\approx 0.9029

The redundancy loses most of its effect: the duplicated block is now worth only 0.940.94, barely better than the panel alone (0.900.90) and far from the 0.9850.985 of the independent model. The station drops from 0.94610.9461 to 0.90290.9029: the probability of failure nearly doubles, from 5.4%5.4\% to 9.7%9.7\%.

The parallel calculation is valid only if the failures are independent. Common-cause failures (cold, ice, lightning) are positively related, and the true reliability is then lower than the model's. Hence the practice of backing up a component with one of a DIFFERENT technology, exposed to other causes of failure.

Exercise 7: The Monty Hall problem in the field: everything depends on what the person opening knows

10 answers to check

On an introductory outing, a naturalist guide shows an old trunk with three cavities numbered 11, 22 and 33. Only one holds a Pileated Woodpecker nest, and the guide knows which; for a participant, each holds it with probability 13\frac{1}{3}. A participant points to cavity 11. The guide then inspects, with her endoscope camera, ANOTHER cavity that she knows is empty, and shows it empty; if both other cavities are empty, she chooses between them at random. She shows cavity 33 empty, then offers the participant the chance to switch to cavity 22.

Let NiN_{i} be “the nest is in cavity ii” and O3O_{3} “the guide shows cavity 33”.

  • a) Give P(O3∣N1)P(O_{3}\mid N_{1}), P(O3∣N2)P(O_{3}\mid N_{2}) and P(O3∣N3)P(O_{3}\mid N_{3}), justifying each one with the guide's protocol.
  • b) Compute P(O3)P(O_{3}).
  • c) Compute P(N1∣O3)P(N_{1}\mid O_{3}) and P(N2∣O3)P(N_{2}\mid O_{3}). Should the participant switch?
  • d) A participant states: “There are two closed cavities left, so the nest is in one or the other with probability 12\frac{1}{2}.” Explain the mistake.
  • e) On another day, a second guide does NOT know where the nest is. He inspects cavity 22 or cavity 33 at random, and cavity 33 happens to be empty. Compute the probability that the nest is in cavity 22 given this.
  • f) Back to the guide who knows. When she has a choice, she prefers cavity 33, which is easier to reach: she shows it with probability qq, where 0≤q≤10\le q\le 1. Show that P(N2∣O3)=11+qP(N_{2}\mid O_{3})=\dfrac{1}{1+q}, then compute this probability for q=0.8q=0.8. Can switching be a disadvantage?

Type your answers, the page tells you right or wrong 0/10

a)
b)
c)
e)
f)
Show the solution

Answers

  • a) P(O3∣N1)=12P(O_{3}\mid N_{1})=\frac{1}{2}, P(O3∣N2)=1P(O_{3}\mid N_{2})=1, P(O3∣N3)=0P(O_{3}\mid N_{3})=0
  • b) P(O3)=12P(O_{3})=\frac{1}{2}
  • c) P(N1∣O3)=13P(N_{1}\mid O_{3})=\frac{1}{3}, P(N2∣O3)=23P(N_{2}\mid O_{3})=\frac{2}{3}: switch
  • d) Two remaining outcomes are not equally likely: the guide's move depends on where the nest is
  • e) 12\frac{1}{2}: switching no longer helps
  • f) 11+q≥12\dfrac{1}{1+q}\ge\dfrac{1}{2}; for q=0.8q=0.8, ≈0.556\approx 0.556; switching is never a disadvantage
a)

If the nest is in 11, cavities 22 and 33 are empty and the guide picks one at random: P(O3∣N1)=12P(O_{3}\mid N_{1})=\frac{1}{2}.

If the nest is in 22, she can show neither 11 (chosen) nor 22 (the nest): P(O3∣N2)=1P(O_{3}\mid N_{2})=1.

If the nest is in 33, she never shows 33: P(O3∣N3)=0P(O_{3}\mid N_{3})=0.

b)

The NiN_{i} form a partition; law of total probability:

P(O3)=13×12+13×1+13×0=12\displaystyle P(O_{3})=\dfrac{1}{3}\times\dfrac{1}{2}+\dfrac{1}{3}\times 1+\dfrac{1}{3}\times 0=\dfrac{1}{2}
c)

Bayes' theorem:

P(N1∣O3)=13×1212=13P(N_{1}\mid O_{3})=\dfrac{\frac{1}{3}\times\frac{1}{2}}{\frac{1}{2}}=\dfrac{1}{3} and P(N2∣O3)=13×112=23P(N_{2}\mid O_{3})=\dfrac{\frac{1}{3}\times 1}{\frac{1}{2}}=\dfrac{2}{3}

And P(N3∣O3)=0P(N_{3}\mid O_{3})=0: the sum is indeed 11. Switching doubles the chances of finding the nest.

The initial choice keeps its probability 13\frac{1}{3}: the guide could always show an empty cavity other than 11, so her move teaches nothing about 11. It does, however, teach a lot about 22, which she avoided.

d)

“Two outcomes, so 12\frac{1}{2} each” assumes the outcomes are equally likely, which is neither given nor true. The guide's move is not independent of where the nest is: P(O3∣N2)=1P(O_{3}\mid N_{2})=1 is twice as large as P(O3∣N1)=12P(O_{3}\mid N_{1})=\frac{1}{2}.

Pitfall: counting the remaining outcomes instead of conditioning on the information received. A conditional probability is computed with the likelihood of the observation in each case, not by erasing the excluded cases.

e)

The guide who does not know inspects 22 or 33 with probability 12\frac{1}{2} each; we observe “he inspects 33 AND it is empty”. Likelihoods:

if N1N_{1}: 12×1\frac{1}{2}\times 1; if N2N_{2}: 12×1\frac{1}{2}\times 1; if N3N_{3}: 12×0=0\frac{1}{2}\times 0=0.

P(N2∣3 inspected and empty)=13×1213×12+13×12+0=12\displaystyle P(N_{2}\mid\text{3 inspected and empty})=\dfrac{\frac{1}{3}\times\frac{1}{2}}{\frac{1}{3}\times\frac{1}{2}+\frac{1}{3}\times\frac{1}{2}+0}=\dfrac{1}{2}

Same observation, different protocol, different answer: what matters is not what you see, but the probability of seeing it in each case. Here, chance could have revealed the nest, and the fact that it did not favours neither 22 nor 11.

f)

Only the likelihood P(O3∣N1)P(O_{3}\mid N_{1}) changes, and it equals qq. By Bayes:

P(N2∣O3)=13×113q+13×1+0=11+q\displaystyle P(N_{2}\mid O_{3})=\dfrac{\frac{1}{3}\times 1}{\frac{1}{3}q+\frac{1}{3}\times 1+0}=\dfrac{1}{1+q}

For q=0.8q=0.8: P(N2∣O3)=11.8≈0.556P(N_{2}\mid O_{3})=\dfrac{1}{1.8}\approx 0.556.

Since 0≤q≤10\le q\le 1, we have 1≤1+q≤21\le 1+q\le 2, so 11+q≥12\dfrac{1}{1+q}\ge\dfrac{1}{2}: switching is never a disadvantage. The case q=1q=1 gives 12\frac{1}{2} (no difference), the case q=0q=0 gives 11: if the guide shows 33 when she always avoids 33 whenever she can, the nest must be in 22.

N₁O₂1/6O₃1/6N₂O₃1/3N₃O₂1/31/31/21/21/311/31

Exercise 8: Five statements to correct

5 answers to check

A weather station compares, over several years, its forecast from the day before with the observed weather. A day is chosen at random; let AA be “rain was forecast the day before” and RR “it rained”. The record gives, in the model adopted: P(R)=0.30P(R)=0.30, P(A)=0.32P(A)=0.32 and P(A∩R)=0.24P(A\cap R)=0.24.

Each of the following five statements is FALSE. For each one, compute the value asked for, then write the correct statement.

  • a) “When rain is forecast, it rains 75%75\% of the time; so when it rains, rain had been forecast 75%75\% of the time.” Compute P(A∣R)P(A\mid R).
  • b) “The forecast does not make the rain fall, so AA and RR are independent.” Compute P(R∣A)P(R\mid A) and compare it with P(R)P(R).
  • c) “P(R∣A)+P(R∣A‾)=1P(R\mid A)+P(R\mid\overline{A})=1, since AA and A‾\overline{A} are complementary.” Compute P(R∣A‾)P(R\mid\overline{A}), to three decimal places.
  • d) “In this model, the days are independent. It has rained six days in a row; a run of seven is so rare that the seventh day will probably be dry, more than usual.” Compute the probability that it rains on the seventh day given that it rained on the previous six.
  • e) “The probability that it rains on Saturday or Sunday is 0.30+0.30=0.600.30+0.30=0.60.” Keeping the assumption that the days are independent, compute this probability.

Type your answers, the page tells you right or wrong 0/5

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) P(A∣R)=0.8P(A\mid R)=0.8, not 0.750.75
  • b) P(R∣A)=0.75≠P(R)=0.30P(R\mid A)=0.75\neq P(R)=0.30: AA and RR are dependent
  • c) P(R∣A‾)≈0.088P(R\mid\overline{A})\approx 0.088; it is P(R∣A)+P(R‾∣A)P(R\mid A)+P(\overline{R}\mid A) that equals 11
  • d) 0.300.30 under the independence assumption
  • e) 1−0.72=0.511-0.7^{2}=0.51
a)

The two percentages do not have the same denominator. First P(R∣A)=0.240.32=0.75P(R\mid A)=\dfrac{0.24}{0.32}=0.75, then:

P(A∣R)=P(A∩R)P(R)=0.240.30=0.8\displaystyle P(A\mid R)=\dfrac{P(A\cap R)}{P(R)}=\dfrac{0.24}{0.30}=0.8

Correct statement: “When rain is forecast, it rains 75%75\% of the time; when it rains, rain had been forecast 80%80\% of the time.”

Pitfall: turning the bar around without changing the denominator. The two numbers are equal only if P(A)=P(R)P(A)=P(R).

b)

P(R∣A)=0.75P(R\mid A)=0.75 whereas P(R)=0.30P(R)=0.30: knowing that rain is forecast multiplies the probability of rain by 2.52.5. The events are dependent.

Check with the product: P(A)P(R)=0.096≠0.24P(A)P(R)=0.096\neq 0.24.

Correct statement: “The forecast does not cause the rain, but AA and RR are dependent, and that is a good thing: a forecast independent of the coming weather would be useless.”

Pitfall: confusing independence with the absence of a causal link. Independence is an equality between numbers, P(A∩R)=P(A)P(R)P(A\cap R)=P(A)P(R); two effects of the same cause, here the state of the atmosphere the day before, are dependent without one causing the other.

c)

R∩A‾R\cap\overline{A}: it rains without a forecast, P(R∩A‾)=P(R)−P(R∩A)=0.30−0.24=0.06P(R\cap\overline{A})=P(R)-P(R\cap A)=0.30-0.24=0.06. And P(A‾)=1−0.32=0.68P(\overline{A})=1-0.32=0.68.

P(R∣A‾)=0.060.68≈0.088\displaystyle P(R\mid\overline{A})=\dfrac{0.06}{0.68}\approx 0.088

The sum 0.75+0.088≈0.8380.75+0.088\approx 0.838 is not 11. The two probabilities are computed in two different sample spaces, AA and A‾\overline{A}: nothing forces them to be complementary.

Correct statement: “In one and the same sample space AA, P(R∣A)+P(R‾∣A)=1P(R\mid A)+P(\overline{R}\mid A)=1”; here P(R‾∣A)=0.25P(\overline{R}\mid A)=0.25.

d)

If the days are independent, the rain of the previous six days changes nothing: the probability sought is P(R)=0.30P(R)=0.30.

The rarity of the full run, 0.37≈0.00020.3^{7}\approx 0.0002, is computed BEFORE the first six days. Once these six days have been observed, only one day is left to play out.

Correct statement: “Under the independence assumption, the seventh day is rainy with probability 0.300.30, like any other day.”

A nuance: real weather is not independent from one day to the next, since low-pressure systems last several days. Persistence, if it plays a role, makes rain MORE likely after a rainy run, never less: the statement is false in both models.

e)

The plain sum is allowed only for mutually exclusive events; but it can rain on both days. With the complement, and the independence of the two days:

P(Saturday or Sunday)=1−P(dry Saturday)P(dry Sunday)=1−0.7×0.7=0.51\displaystyle P(\text{Saturday or Sunday})=1-P(\text{dry Saturday})P(\text{dry Sunday})=1-0.7\times 0.7=0.51

Check with the union: 0.30+0.30−0.30×0.30=0.510.30+0.30-0.30\times 0.30=0.51.

Correct statement: “The probability that it rains on at least one of the two days is 0.510.51.” Without the independence assumption, we would need to know P(rain Saturday and Sunday)P(\text{rain Saturday and Sunday}).

Exercise 9: Problem: environmental DNA, how many replicates to conclude that an invasive fish is absent?

5 answers to check

A team monitors the arrival of the tench, an invasive fish, in the lakes of a watershed. For a lake chosen at random in the area, regional data give, before any sampling, a probability ψ=0.40\psi=0.40 that the species is present. In a lake, kk water replicates are collected and analyzed separately.

Model adopted: if the species is present, each replicate detects its DNA with probability p=0.55p=0.55; if it is absent, a replicate is falsely positive (laboratory contamination) with probability 0.020.02. Given presence or absence, the replicates are independent. Let LL be “the species is present in the lake”.

  • a) The species is present. Compute the probability that at least one replicate out of k=3k=3 is positive, to three decimal places.
  • b) In this question and the next, false positives are neglected. The three replicates from a lake are negative. Compute the probability that the species is present nonetheless, to three decimal places.
  • c) The protocol requires that a lake with no positive replicate be declared free of the species with a risk of error of at most 5%5\%. Find the smallest number kk of replicates that guarantees it.
  • d) False positives are now taken into account, with k=4k=4. A lake gives exactly one positive replicate out of four. Compute P(L∣one positive out of four)P(L\mid\text{one positive out of four}), to three decimal places. Do the same for exactly two positives out of four.
  • e) Write, in three or four sentences, the decision rule you would propose to the team, and name one assumption of the model that could make it too optimistic.

Type your answers, the page tells you right or wrong 0/5

a)
b)
c)
d)
Show the solution

Answers

  • a) 1−0.453≈0.9091-0.45^{3}\approx 0.909
  • b) P(L∣three negatives)≈0.057P(L\mid\text{three negatives})\approx 0.057
  • c) k=4k=4: 0.027≤0.050.027\le 0.05, whereas k=3k=3 gives 0.0570.057
  • d) One positive: ≈0.640\approx 0.640; two positives: ≈0.991\approx 0.991
  • e) Four replicates; no positive: free; two or more: present; only one: repeat. Risk: correlated replicates
a)

“At least one positive” has complement “three negatives”. Given presence, the replicates are independent:

P(at least one∣L)=1−(1−0.55)3=1−0.091125≈0.909\displaystyle P(\text{at least one}\mid L)=1-(1-0.55)^{3}=1-0.091125\approx 0.909

Pitfall: 3×0.55=1.653\times 0.55=1.65, which is not a probability, or 0.553≈0.1660.55^{3}\approx 0.166, which is the probability that all three are positive.

b)

Turn the condition around with Bayes, on the partition {L,L‾}\{L,\overline{L}\}. Without false positives, a lake without the species gives three negatives with probability 11:

P(L∣3 neg.)=0.40×0.4530.40×0.453+0.60×1=0.036450.63645≈0.057\displaystyle P(L\mid 3\ \text{neg.})=\dfrac{0.40\times 0.45^{3}}{0.40\times 0.45^{3}+0.60\times 1}=\dfrac{0.03645}{0.63645}\approx 0.057

Three negative results bring the probability of presence down from 0.400.40 to 0.0570.057: a sharp drop, but not a proof of absence. A negative does not say “absent”, it says “less likely to be present”.

c)

With kk negative replicates, the same formula gives P(L∣k neg.)=0.4×0.45k0.4×0.45k+0.6P(L\mid k\ \text{neg.})=\dfrac{0.4\times 0.45^{k}}{0.4\times 0.45^{k}+0.6}. We want it to be at most 0.050.05:

0.4×0.45k≤0.05(0.4×0.45k+0.6)  ⟺  0.38×0.45k≤0.03  ⟺  0.45k≤0.030.38\displaystyle 0.4\times 0.45^{k}\le 0.05\left(0.4\times 0.45^{k}+0.6\right)\iff 0.38\times 0.45^{k}\le 0.03\iff 0.45^{k}\le\dfrac{0.03}{0.38}

Taking the logarithm, which is negative for 0.450.45 and therefore reverses the inequality: k≥ln⁡(0.03/0.38)ln⁡0.45≈3.18k\ge\dfrac{\ln(0.03/0.38)}{\ln 0.45}\approx 3.18.

The smallest integer is k=4k=4. Check: k=3k=3 gives 0.057>0.050.057>0.05 and k=4k=4 gives ≈0.027≤0.05\approx 0.027\le 0.05. The figure in the solution shows this decrease.

d)

There are 44 possible positions for the positive replicate, each with the same probability. Likelihoods:

if present: 4×0.55×0.453≈0.20054\times 0.55\times 0.45^{3}\approx 0.2005; if absent: 4×0.02×0.983≈0.07534\times 0.02\times 0.98^{3}\approx 0.0753.

P(L∣1 pos.)=0.4×0.20050.4×0.2005+0.6×0.0753≈0.640\displaystyle P(L\mid 1\ \text{pos.})=\dfrac{0.4\times 0.2005}{0.4\times 0.2005+0.6\times 0.0753}\approx 0.640

For two positives out of four (66 positions): present, 6×0.552×0.452≈0.36756\times 0.55^{2}\times 0.45^{2}\approx 0.3675; absent, 6×0.022×0.982≈0.00236\times 0.02^{2}\times 0.98^{2}\approx 0.0023.

P(L∣2 pos.)=0.4×0.36750.4×0.3675+0.6×0.0023≈0.991\displaystyle P(L\mid 2\ \text{pos.})=\dfrac{0.4\times 0.3675}{0.4\times 0.3675+0.6\times 0.0023}\approx 0.991

A single positive leaves more than one chance in three that it is contamination: an isolated positive is not a proof of presence, whereas two almost are.

e)

Proposed rule: collect four replicates per lake. No positive: declare the lake free of the species, with a risk of about 3%3\% (0.0290.029 when false positives are taken into account). Two or more positives: declare the species present, at more than 99%99\%. Only one positive: do not conclude, and run a new sampling campaign.

These numbers depend on the model. The most fragile assumption is the independence of the replicates: collected on the same day at the same spot, they share the same conditions (cold water, current, dispersed DNA), so their failures are linked, and the true probability of presence after four negatives is larger than 0.0290.029. The values of ψ\psi and pp are also estimates, to be updated with later campaigns.

123456780.050.10.150.20.25threshold 0.05k negative replicates

Exercise 10: Problem: a field test of drinking water, from the rate of positive results to the decision

6 answers to check

A rapid test kit detects the bacterium E. coli in the water of a well. The manufacturer states a sensitivity of 0.920.92 (the test is positive for 92%92\% of contaminated wells) and a specificity of 0.960.96 (it is negative for 96%96\% of uncontaminated wells). During a campaign in one region, 500500 private wells are tested once: 6464 results are positive.

Let CC be “the well is contaminated”, TT “the test is positive”, and π=P(C)\pi=P(C) the prevalence, that is, the proportion of contaminated wells in the region. The wells tested are considered to be chosen at random.

  • a) Compute the proportion of positive tests. Explain why it is not the proportion of contaminated wells.
  • b) Show that P(T)=0.04+0.88 πP(T)=0.04+0.88\,\pi, then estimate the prevalence π\pi from the campaign.
  • c) With this prevalence, compute P(C∣T)P(C\mid T) and P(C‾∣T‾)P(\overline{C}\mid\overline{T}), to three decimal places.
  • d) Wells that test positive are tested a second time with another, identical kit; given the state of the well, the two results are assumed independent. Compute the probability that a well positive on both tests is contaminated, to three decimal places.
  • e) In another region, the prevalence is 2%2\%. Compute P(C∣T)P(C\mid T) for the same kit, to three decimal places.
  • f) Write the recommendation to send to the well owners of the first region, in three or four sentences: what to do after a positive test, after a negative test, and what reservation to keep in mind.

Type your answers, the page tells you right or wrong 0/6

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) 64500=0.128\frac{64}{500}=0.128: it includes false positives and misses false negatives
  • b) P(T)=0.92π+0.04(1−π)P(T)=0.92\pi+0.04(1-\pi); π=0.10\pi=0.10
  • c) P(C∣T)≈0.719P(C\mid T)\approx 0.719; P(C‾∣T‾)≈0.991P(\overline{C}\mid\overline{T})\approx 0.991
  • d) ≈0.983\approx 0.983
  • e) P(C∣T)≈0.319P(C\mid T)\approx 0.319
  • f) Positive: do not drink the water without boiling it, confirm in a laboratory; negative: water very probably free of E. coli; reservation about the assumptions
a)

64500=0.128\dfrac{64}{500}=0.128.

This is not the proportion of contaminated wells: the positives include uncontaminated wells wrongly declared positive, and some contaminated wells were declared negative. The rate of positives mixes the prevalence with the errors of the test.

b)

CC and C‾\overline{C} form a partition; law of total probability:

P(T)=P(C)P(T∣C)+P(C‾)P(T∣C‾)=0.92 π+0.04 (1−π)=0.04+0.88 π\displaystyle P(T)=P(C)P(T\mid C)+P(\overline{C})P(T\mid\overline{C})=0.92\,\pi+0.04\,(1-\pi)=0.04+0.88\,\pi

Set it equal to the observed proportion and isolate π\pi:

π=0.128−0.040.88=0.10\displaystyle \pi=\dfrac{0.128-0.04}{0.88}=0.10

About 10%10\% of the wells in the region are contaminated, not 12.8%12.8\%. The estimate assumes that the stated sensitivity and specificity hold in the field.

c)

With π=0.10\pi=0.10, P(T)=0.128P(T)=0.128 and P(T‾)=0.872P(\overline{T})=0.872. Bayes' theorem:

P(C∣T)=0.10×0.920.128=0.0920.128≈0.719\displaystyle P(C\mid T)=\dfrac{0.10\times 0.92}{0.128}=\dfrac{0.092}{0.128}\approx 0.719
P(C‾∣T‾)=0.90×0.960.872=0.8640.872≈0.991\displaystyle P(\overline{C}\mid\overline{T})=\dfrac{0.90\times 0.96}{0.872}=\dfrac{0.864}{0.872}\approx 0.991

About one positive in four is a false positive, whereas a negative is 99%99\% reliable.

Pitfall: believing that “92%92\% sensitive” means P(C∣T)=0.92P(C\mid T)=0.92. The sensitivity is P(T∣C)P(T\mid C): the condition is on the other side of the bar.

d)

Given the state of the well, the two tests are independent: multiply the likelihoods.

P(C∣T1∩T2)=0.10×0.9220.10×0.922+0.90×0.042=0.084640.08608≈0.983\displaystyle P(C\mid T_{1}\cap T_{2})=\dfrac{0.10\times 0.92^{2}}{0.10\times 0.92^{2}+0.90\times 0.04^{2}}=\dfrac{0.08464}{0.08608}\approx 0.983

Check: the same result comes from applying Bayes a second time, with 0.7190.719 as the new starting probability. The second test takes it from 72%72\% to 98%98\%.

e)

Same kit, prevalence 0.020.02:

P(C∣T)=0.02×0.920.02×0.92+0.98×0.04=0.01840.0576≈0.319\displaystyle P(C\mid T)=\dfrac{0.02\times 0.92}{0.02\times 0.92+0.98\times 0.04}=\dfrac{0.0184}{0.0576}\approx 0.319

Two positives out of three are then false positives. The value of a positive result depends on the prevalence, as the curve in the solution shows: when uncontaminated wells are the vast majority, even a small error rate on them produces more positives than the truly contaminated wells do.

f)

Recommendation for the first region. After a positive test, contamination is likely (about 72%72\%): do not drink the water without boiling it first, and have it confirmed by a second test or, better, by an analysis in an accredited laboratory before disinfecting the well. After a negative test, the water is very probably free of E. coli (about 99%99\%), which does not replace the regular testing recommended by the authorities.

Reservation: these numbers rest on the performance stated by the manufacturer and on the independence of the two tests. A substance in the water that skews both kits would make their errors linked, and the 98%98\% of question d) would be too optimistic: that is why confirmation is preferably done with a different method.

0.10.20.30.40.50.20.40.60.810.320.72prevalence πP(C | positive)
Something missing from this set? A type of exercise your teacher gives, a problem you are stuck on, a mistake you spotted: tell me, I read every request.

Sending goes through your free space: that is how I can answer you and tell you when the exercise is added. An email is enough, no password. Create your space. Rather not create an account? Write to me directly.

What is it about?
I read every request myself, nobody else sees it. No need to write your name or your school.
When your request is dealt with, you hear about it by email and in your space.

By sending, you agree that I read your request to answer it. It is kept with your account, erased with it, and never published: privacy policy.

This chapter comes back in

The chapters that build on it, later in the year or in the years that follow.

© Ahmed Squalli Houssaini. Exercise set published at www.letuteurscientifique.ca/en/exercices/cegep-sn1-conditional-probability. Free for personal and classroom use; republishing it elsewhere requires written permission (legal notice).

Looking for a probability and statistics tutor in Montreal?

Get in touch for a first session. Conditional probability comes down to a single question, “what am I counting among?”, and it is by asking it out loud, exercise after exercise, that it becomes a reflex on exam day.

Site by Studio Squalli