Independent study guide

Conditional Probability and Bayes: Choose the Right Denominator

Start with counts, distinguish “given” from “and,” derive Bayes’ formula and test independence with a frequency tree and four explained exercises.

Nablio · 18 minPublished

Stuck on a step? Text us Email us Request a lesson

Before you start: be comfortable with fractions and percentages. This original Nablio lesson shows how to choose the right reference group, build Bayes’ formula from counts and check independence. Work through the example, then try the four questions with optional hints.

1. Start with the group you are choosing from

A hypothetical lot contains 1,000 components: 40 are defective and 960 are sound. An inspection flags 36 of the defective components and 48 of the sound components. The other 4 defective and 912 sound components are not flagged.

Choose one component uniformly at random: each of the 1,000 components has the same chance of selection. You learn that it was flagged. What is the probability that it is defective?

Count before using a formula

There are 36+48=8436+48=84 flagged components. Of those, 36 are defective. Once you know the component was flagged, the relevant group is these 84 components. The answer is 36 out of 84, or 3/73/7, approximately 42.9%.

The denominator tells you which group you are considering. Using 1,000 would answer a different question: how often a uniformly selected component is both defective and flagged.

2. Define the events and read the notation

An outcome is the component selected. An event is a set of outcomes with a stated property. Let DD be the event “the selected component is defective” and FF the event “the selected component is flagged.” The complement DcD^c means “not defective,” which is “sound” in this model; FcF^c means “not flagged.” These classifications are exhaustive: every component is in exactly one defect category and exactly one flag category.

The symbol PP denotes probability. For this uniform selection from a finite lot, an event’s probability is its count divided by the lot’s size. Thus P(D)=40/1000=0.04P(D)=40/1000=0.04.

The intersection D∩FD\cap F, read “DD and FF,” requires both properties. The conditional probability P(D∣F)P(D\mid F), read “probability of DD given FF,” restricts attention to outcomes in FF. The event after the vertical bar sets the denominator. This definition requires that the conditioning event have positive probability.

Same numerator, different reference groups

P(D∣F)=3684=37≈42.9%.P(D\mid F)=\frac{36}{84}=\frac37\approx42.9\%. P(F∣D)=3640=910=90%.P(F\mid D)=\frac{36}{40}=\frac9{10}=90\%. P(D∩F)=361000=9250=3.6%.\begin{aligned}P(D\cap F)&=\frac{36}{1000}\\&=\frac9{250}=3.6\%.\end{aligned}

The inspection flags 90% of the defective components. It does not follow that 90% of flagged components are defective. The two conditional probabilities start from different groups: 40 defective components versus 84 flagged components.

3. Read the frequency tree, then regroup

The tree first splits the lot by defect status, then by inspection result. Read a path as a sequence of classifications of the same selected component. The four terminal counts add to 1,000. Branch lengths carry no numerical meaning.

Frequency tree of the 1,000 components and a proportional bar of the 84 flagged components. All counts are listed immediately below.
Figure 1. First classify all 1,000 components, then collect the two flagged groups. Only the lower bar is proportional to counts.

Text equivalent: Of 1,000 components, 40 are defective: 36 flagged and 4 not flagged. The other 960 are sound: 48 flagged and 912 not flagged. Regrouping the flagged components gives 84 in total: 36 defective and 48 sound. The bar allocates 3/73/7 of its width to defective components and 4/74/7 to sound components. Diagonal stripes mark defective components; dots mark sound components.

The flagged group contains more sound components than defective ones. A small flag rate among the much larger sound group can still contribute many flagged components. The original proportion of defective components is the base rate, here 4%. Ignoring it would miss why the much larger sound group contributes 48 of the 84 flags, despite its lower flag rate.

4. Build the multiplication and total-probability rules

Introduce general events AA and BB in the same sample space, the set of all possible outcomes. Conditional probability divides the probability of their intersection by the probability of the conditioning event:

P(A∣B)=P(A∩B)P(B),P(B)>0.\begin{gathered}P(A\mid B)=\frac{P(A\cap B)}{P(B)},\\P(B)>0.\end{gathered}

Multiply both sides by P(B)P(B). This gives a multiplication rule. It does not require independence.

P(A∩B)=P(A∣B)P(B).P(A\cap B)=P(A\mid B)P(B).

Apply the rule to the defective branch. The probability of entering that branch is 40/100040/1000. Within that branch, the fraction flagged is 36/4036/40. Multiplying cancels the intermediate group size:

P(F∩D)=P(F∣D)P(D)P(F\cap D)=P(F\mid D)P(D) =3640⋅401000=361000.=\frac{36}{40}\cdot\frac{40}{1000}=\frac{36}{1000}.

To find the probability of being flagged, add the flagged defective and flagged sound branches. These groups are disjoint, meaning no component is in both; together they contain every flagged component. The events DD and DcD^c form a partition: non-overlapping groups covering the whole sample space.

P(F)=P(F∩D)+P(F∩Dc)P(F)=P(F\cap D)+P(F\cap D^c) =P(F∣D)P(D)+P(F∣Dc)P(Dc).\begin{aligned}&=P(F\mid D)P(D)\\&\quad+P(F\mid D^c)P(D^c).\end{aligned}

Here the conditional flag rate among sound components is P(F∣Dc)=48/960=0.05P(F\mid D^c)=48/960=0.05. Weight each conditional rate by the proportion of the lot in its group:

P(F)=(0.90)(0.04)+(0.05)(0.96)\begin{aligned} P(F)&=(0.90)(0.04)\\ &\quad+(0.05)(0.96) \end{aligned} =0.036+0.048=0.084.=0.036+0.048=0.084.

Simply adding 90% and 5%, or averaging them equally, would ignore the very different group sizes.

5. Derive Bayes’ formula and interpret the result

Return to the question “defective given flagged.” The numerator is the probability of both properties. The denominator includes every way a component can be flagged. Use the multiplication rule for the numerator; keep the total flag probability calculated from the partition in Section 4 as the denominator:

P(D∣F)=P(F∣D)P(D)P(F).P(D\mid F)=\frac{P(F\mid D)P(D)}{P(F)}.

Here P(F)P(F) is the total flag probability: add the flagged-defective and flagged-sound contributions, as in Section 4.

This is Bayes’ formula for these two defect categories, with P(F)>0P(F)>0. In this version both defect categories also have positive probability, so the conditional flag rates used in Section 4 are defined. The prior probability P(D)P(D) is the probability of a defect before learning the flag result. The posterior probability P(D∣F)P(D\mid F) is the probability after learning that result. Here “before” and “after” describe available information, not a change in the component.

P(D∣F)=(0.90)(0.04)0.036+0.048P(D\mid F)=\frac{(0.90)(0.04)}{0.036+0.048} =0.0360.084=37≈42.9%.=\frac{0.036}{0.084}=\frac37\approx42.9\%.

The flag raises the probability of a defect from 4% to about 42.9%. It provides useful information without guaranteeing a defect. The fraction is the same 36/8436/84 we found by counting; Bayes’ formula organizes that reasoning when probabilities are given instead of counts.

Check the denominator. Dividing by 0.04 would condition on a defect. Dividing by 0.084 conditions on a flag. Name the known event in words before choosing either.

6. Distinguish independence from disjointness

Two events are independent when their joint probability equals the product of their individual probabilities. When the conditioning event has positive probability, this is equivalent to saying that learning it does not change the other event’s probability.

To test independence, ask whether this equality holds:

P(D∩F)=?P(D)P(F).P(D\cap F)\stackrel{?}{=}P(D)P(F).

In this lot, the left side is 0.036. The product on the right is (0.04)(0.084)=0.00336(0.04)(0.084)=0.00336. They are unequal, so defect status and flag status are dependent. Equivalently, P(D∣F)=3/7P(D\mid F)=3/7 differs from P(D)=0.04P(D)=0.04.

Disjoint events cannot occur together. Independent events do not change one another’s probabilities. Here DD and FF are not disjoint, because 36 components have both properties, and they are not independent. By contrast, DD and DcD^c are disjoint. Since both have positive probability, they are not independent either: learning one rules out the other.

7. Practise choosing the denominator

For each question, write the relevant group in words before calculating. Try it unaided, open a hint if needed, then compare your reasoning with the answer. The questions move from reading a condition to changing the information, changing the base rate and checking an assumption.

1. Given versus and

Using the original lot, find P(F∣D)P(F\mid D) and P(D∩F)P(D\cap F). Explain why their denominators differ.

Hint for question 1

For a conditional probability, name the group after the vertical bar. For an intersection, keep the full lot as the reference group. Which components count in both numerators?

Show answer and reasoning

“Given defective” restricts the group to 40 defective components, so P(F∣D)=36/40=9/10P(F\mid D)=36/40=9/10. “Defective and flagged” asks for both properties within the full lot, so P(D∩F)=36/1000=9/250P(D\cap F)=36/1000=9/250. Both numerators count the same 36 components.

2. A component was not flagged

Find P(D∣Fc)P(D\mid F^c). Does an unflagged result guarantee a sound component?

Hint for question 2

Find both terminal groups marked “not flagged” in the tree. Use their combined count as the denominator, then count the defective components within that group.

Show answer and reasoning

The unflagged group contains 4+912=9164+912=916 components. Of these, 4 are defective, so P(D∣Fc)=4/916=1/229≈0.437%P(D\mid F^c)=4/916=1/229\approx0.437\%. An unflagged result reduces the defect probability but does not make it zero. Do not use 1−P(D∣F)1-P(D\mid F): that gives the probability of being sound within the flagged group.

3. Change the original defect rate

In a different hypothetical lot of 1,000 components, 10% are defective. Keep the same conditional flag rates: 90% among defective components and 5% among sound components. Find the probability of a defect given a flag.

Hint for question 3

Begin with the new lot of 1,000. Split it using the new defect rate, then apply each conditional flag rate within its own group. Combine both flagged counts before dividing.

Show answer and reasoning

There are 100 defective components, of which 90 are flagged, and 900 sound components, of which 45 are flagged. Thus P(D∣F)=90/(90+45)=2/3≈66.7%P(D\mid F)=90/(90+45)=2/3\approx66.7\%. Equivalently, divide (0.90)(0.10)(0.90)(0.10) by (0.90)(0.10)+(0.05)(0.90)(0.90)(0.10)+(0.05)(0.90). The conditional inspection rates have stayed fixed, but the composition of the flagged group has changed. A posterior probability cannot generally be transferred to a population with a different prior defect rate.

4. Test an independence claim

A classmate multiplies P(D)P(F)P(D)P(F) to find the probability that a component is both defective and flagged in the original lot. Is that justified?

Hint for question 4

Compute the joint probability directly from the component counts. Separately multiply the two individual probabilities. Independence requires those two results to be equal.

Show answer and reasoning

No. The known joint probability is 36/1000=0.03636/1000=0.036, while P(D)P(F)=(0.04)(0.084)=0.00336P(D)P(F)=(0.04)(0.084)=0.00336. The unequal values disprove independence. The valid multiplication uses a conditional probability: P(D∩F)=P(F∣D)P(D)=(0.90)(0.04)=0.036P(D\cap F)=P(F\mid D)P(D)=(0.90)(0.04)=0.036.

Take this habit to your next problem: identify the possible outcomes, name the known event, count or calculate every route into that event, then divide the relevant joint probability by its probability. Check that your answer lies between 0 and 1 and explain which group it describes.

8. Connect the ideas to your course

For Concordia MAST 221, use this lesson to practise conditional probability: distinguish the two conditional directions and explain the denominator before using Bayes’ formula. For STAT 249, focus first on the probability foundations: events, complements, intersections and the choice of reference group.

McGill’s current Mathematics and Statistics course listing includes conditional probability, Bayes’ theorem and independence in MATH 323. Work through the derivation and the independence check, then compare the notation with your current course outline. Use that outline to decide which topics and methods to practise for your section.

For your next study session, bring one problem and mark the event you are given. Explain which outcomes remain possible and why they form your denominator.

These examples practise one group of probability skills; they do not cover the full content of any course listed here. The official descriptions below establish topic connections, while your current course outline sets the scope for your section.

Useful for

Work on the step you’re missing.

Tell us the subject and your preferred time. Nablio confirms the details by text or email.

Request a lesson