Week 8: Conditional Probability & Bayes’ Theorem
3594 words
18 min read
2026-09-12T00:00:00.000Z
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
Conditional probability, multiplication rule, independent events, law of total probability, and Bayes’ Theorem. # Statistics for Data Science I — Week 8: Conditional Probability & Bayes’ Theorem IITM’s Week 8 covers **conditional probability, the multiplication rule, independence, the law of total probability, and B...

Statistics for Data Science I — Week 8: Conditional Probability & Bayes’ Theorem
IITM’s Week 8 covers conditional probability, the multiplication rule, independence, the law of total probability, and Bayes’ theorem.
TL;DR
Week 7 asked:
Week 8 asks:
meaning:
What is the probability of A, given that B is already known to have happened?
The most important formulas are:
For independent events:
Law of total probability:
Bayes:
1. Conditional probability
Conditional probability asks:
What is the probability of event A once we know that event B occurred?
Notation:
Read:
probability of A given B.
2. Conditional probability formula
If:
then:
The denominator changes from the whole sample space to event B.
3. Core intuition
Originally:
is the universe.
Once we know B happened, we restrict attention to:
Then we ask:
Inside B, what fraction also belongs to A?
So:
4. Example from a table
Suppose:
| Pass | Fail | Total | |
|---|---|---|---|
| Group A | 40 | 10 | 50 |
| Group B | 30 | 20 | 50 |
| Total | 70 | 30 | 100 |
Find:
Among Group A students:
total.
Of those:
passed.
Therefore:
5. Reverse conditional
Now find:
Among students who passed:
total.
Of those:
are in Group A.
Therefore:
These are not equal.
6. Critical distinction
In general:
This is one of the most important probability distinctions.
The conditioning event determines the denominator.
7. Denominator rule
For:
ask:
Given what?
The answer is:
So the denominator is:
For:
the denominator becomes:
8. Deriving the multiplication rule
From:
multiply by:
Then:
9. Equivalent version
Similarly:
Therefore:
Hence:
This identity leads directly to Bayes’ theorem.
10. Multiplication rule intuition
To obtain:
think sequentially:
- event B happens
- given B, event A happens
So:
This is the probability analogue of the multiplication principle in counting.
11. Example
Suppose:
and:
Then:
12. Three-event multiplication rule
For three events:
This extends naturally to longer sequences.
13. Tree-diagram intuition
Suppose:
- first event has branches A,Ac
- after each branch, another event B,Bc
Then a complete path probability is obtained by multiplication.
Conceptually:
textA / \ B Bᶜ Start \ Aᶜ / \ B Bᶜ
For example:
14. Independence
Two events are independent if knowing one occurred gives no information about whether the other occurs.
Formally:
provided:
Likewise:
15. Independence multiplication criterion
For independent events:
This is often the easiest condition to test.
16. Example: independent events
Toss a fair coin and roll a fair die.
Let:
and:
Then:
The coin result does not affect the die result.
Therefore:
17. Testing independence numerically
Suppose:
and:
Check:
Therefore:
18. Example of dependence
Suppose:
but:
If independent, intersection would have been:
Since:
the events are dependent.
19. Independent vs mutually exclusive
These are very different concepts.
Mutually exclusive
A∩B=∅They cannot occur together.
Independent
Occurrence of one does not affect probability of the other.
If both events have positive probability, mutually exclusive events are not independent.
20. Why mutually exclusive events are dependent
Suppose:
and:
Then:
But:
Therefore:
So they are dependent.
21. Example
One die roll.
Let:
and:
They are mutually exclusive.
If you know B happened, probability of A is:
So occurrence of B absolutely affects A.
22. Independence of complements
If A and B are independent, then so are:
For example:
23. Repeated independent trials
Suppose each trial succeeds with probability:
If trials are independent, probability all n succeed:
Probability all fail:
24. At least one success
Using complement:
For independent trials:
25. Example
A machine succeeds with probability:
on each independent attempt.
For 3 attempts:
Probability at least one succeeds:
26. Conditional probability with cards
Suppose one card is drawn from a standard deck.
Let:
There are:
face cards.
There are:
kings.
All kings are face cards.
Therefore:
27. Conditioning can increase probability
Unconditional:
Given face card:
Knowing extra information changed the probability dramatically.
That's the entire point of conditional probability.
28. Conditioning can decrease probability
Suppose:
and:
Then:
and:
Here it stays unchanged because suit and rank are independent in a standard deck.
But other conditions can reduce the probability.
29. Partitions
A collection:
forms a partition of the sample space if:
- they are mutually exclusive
- their union is the entire sample space
Formally:
for:
and:
30. Partition intuition
Imagine dividing the sample space into non-overlapping exhaustive cases:
textS +-------------------------+ | B₁ | B₂ | B₃ | B₄ | +-------------------------+
Every outcome belongs to exactly one partition component.
Partitions are the foundation of total probability.
31. Law of total probability
Suppose:
form a partition.
Then for any event A:
32. Why total probability works
Because:
These pieces are mutually exclusive.
Therefore:
Using the multiplication rule:
Hence the formula.
33. Two-case total probability
A particularly common partition is:
Then:
This form appears constantly.
34. Example: defective products
Suppose a factory uses two machines.
Machine 1 makes:
of products.
Machine 2 makes:
Defect rates:
Find overall defect probability.
35. Apply total probability
P(D)=P(D∣M1)P(M1)+P(D∣M2)P(M2).So:
Thus:
Overall defect rate:
36. Weighted-average interpretation
Notice:
is a weighted average of the machine-specific defect rates:
and:
Weights are machine production shares:
This is a useful intuition for total probability.
37. Bayes’ theorem
Bayes' theorem reverses conditioning.
Suppose we know:
Bayes helps obtain:
Start from:
and also:
Equate them.
38. Basic Bayes formula
P(A∣B)P(B)=P(B∣A)P(A).Therefore:
provided:
39. General Bayes formula
If:
form a partition, then:
The denominator is simply the law of total probability.
40. Bayes interpretation
Bayes updates:
Where:
- prior = P(B)
- likelihood = P(A∣B)
- posterior = P(B∣A)
41. Medical-test example
Suppose:
for having a disease.
Test sensitivity:
False-positive rate:
Question:
If the test is positive, what is the probability the person actually has the disease?
We want:
42. First compute total positive probability
P(+)=P(+∣D)P(D)+P(+∣Dc)P(Dc).Since:
43. Apply Bayes
P(D∣+)=P(+)P(+∣D)P(D).Thus:
So only about:
44. Why this feels surprising
The test has:
sensitivity.
But the disease is rare:
There are many more healthy people than diseased people.
Even a modest false-positive rate creates many false positives.
This is the base-rate effect.
45. Natural-frequency version
Imagine:
people.
Diseased:
Positive among diseased:
Healthy:
False positives:
Total positives:
Actually diseased among positives:
Same Bayes result, often easier to understand.
46. Base-rate neglect
A common mistake is to focus on:
while ignoring:
That confuses:
probability of positive given disease
with:
probability of disease given positive.
They are fundamentally different.
47. Bayes with the machine example
Recall:
We found:
Suppose a defective product is selected.
What is the probability it came from Machine 2?
48. Bayes calculation
P(M2∣D)=P(D)P(D∣M2)P(M2).So:
So:
of defective products come from Machine 2 even though it makes only 40% of all products.
49. Prior vs posterior in that example
Before observing defect:
After learning product is defective:
The evidence "defective" raises belief that Machine 2 produced it because Machine 2 has the higher defect rate.
50. Bayes as reweighting
Bayes effectively reweights prior possibilities according to how compatible each is with the observed evidence.
Conceptually:
Then normalize so probabilities sum to:
51. Bayes workflow
For a Bayes question:
- Identify hypotheses: B1,B2,…
- Identify priors: P(Bi)
- Identify likelihoods: P(A∣Bi)
- Compute: P(A) using total probability.
- Apply: P(Bj∣A).
52. Tree diagrams for Bayes
Using the machine example:
textDefect / M1 / \ No defect Start \ M2 \ Defect \ No defect
Branch probabilities:
then:
Multiply along paths:
Add relevant terminal paths for total probability.
53. Table method for Bayes
Sometimes a contingency-table interpretation is easier.
Suppose 1000 products:
Machine 1 makes:
At 2% defective:
defective.
Machine 2 makes:
At 5% defective:
defective.
Total defective:
Among defective products, Machine 2 share:
Same answer.
54. Conditional probability from intersection
Suppose:
and:
Then:
55. Recover intersection from conditional probability
Suppose:
and:
Then:
These two operations should become automatic.
56. Recover conditional from independence
If:
are independent:
So if:
then:
regardless of B, assuming P(B)>0.
57. Pairwise vs mutual independence
For several events, pairwise independence is weaker than full mutual independence.
For three events, mutual independence requires appropriate factorization not just pairwise checks.
At introductory level, the key warning is:
Don't assume that pairwise independence automatically means all events behave jointly independently.
58. Independence of repeated draws: with replacement
Suppose a card is drawn, returned to the deck, shuffled, then another card is drawn.
Because the first card is replaced, the distribution for the second draw remains unchanged.
This often gives independence between draws.
59. Without replacement
If the card is not replaced, the composition changes.
Suppose drawing an ace first.
Then the probability of ace on second draw becomes:
instead of:
So draws are dependent.
60. Example: two aces without replacement
Probability first card is ace:
Given first was ace:
Thus:
61. With replacement version
If the first card is replaced:
and:
Thus:
62. Conditional probability is not necessarily smaller
A common intuition error:
conditioning always reduces probability.
No.
Conditioning can:
- increase probability
- decrease probability
- leave it unchanged
depending on the relationship.
63. Example of increase
P(King)=131.Given face card:
Increase.
64. Example of no change
For a standard card:
Given heart:
No change.
This indicates independence between rank and suit.
Common mistake: reversing Bayes
Wrong:
Correct relationship:
Common mistake: multiplying without conditioning
For dependent events:
Wrong:
Correct:
Only for independence may you replace:
with:
Common mistake: confusing mutually exclusive and independent
Again:
A useful memory device:
- mutually exclusive → can't happen together
- independent → can happen together, but don't influence each other's probability
Common mistake: wrong conditional denominator
For:
denominator is:
not:
The event after the vertical bar defines the restricted universe.
Common mistake: forgetting priors in Bayes
If one cause is extremely rare, even a strong likelihood may not make it highly probable after evidence.
Always include:
Bayes is not likelihood alone.
Common mistake: total probability without exhaustive cases
The Bi events must cover the full relevant sample space:
Otherwise the sum misses possible routes to A.
Common mistake: overlapping partition cases
For total probability, the partition pieces must also be mutually exclusive.
If:
simply adding path probabilities can double-count.
72. Probability language map
| Wording | Expression |
|---|---|
| A given B | P(A∣B) |
| A and B | P(A∩B) |
| A then B | P(A)P(B∣A) |
| A independent of B | P(A∣B)=P(A) |
| either source produced evidence | total probability |
| source given evidence | Bayes |
73. Full worked example
Suppose:
Find:
- P(B)
- P(A∩B)
- P(A∣B)
74. Step 1: complement
P(Ac)=1−0.3=0.7.75. Step 2: total probability
P(B)=P(B∣A)P(A)+P(B∣Ac)P(Ac).Thus:
76. Step 3: intersection
P(A∩B)=P(B∣A)P(A) =0.8(0.3) =0.24.77. Step 4: Bayes
P(A∣B)=P(B)P(B∣A)P(A).Therefore:
78. Interpretation
Before seeing B:
After seeing B:
So B is evidence strongly favoring A.
That is Bayesian updating in its simplest form.
79. Core formula sheet
Conditional probability
P(A∣B)=P(B)P(A∩B)Multiplication rule
P(A∩B)=P(A∣B)P(B)or:
Independence
P(A∩B)=P(A)P(B)equivalently:
Total probability
P(A)=i∑P(A∣Bi)P(Bi)Bayes
P(Bj∣A)=∑iP(A∣Bi)P(Bi)P(A∣Bj)P(Bj)80. Week 8 mental map
textConditional probability | v P(A|B) = P(A∩B)/P(B) | v Multiplication rule | +----> Independence | v Partition sample space | v Law of total probability | v Bayes' theorem
Everything in Week 8 is tightly connected rather than five separate topics.
81. Weeks 7 → 8 connection
Week 7:
asks for an unconditional probability.
Week 8:
asks what happens after gaining information.
Then Bayes goes one step further:
82. What you should actually master
By the end of Stats 1 Week 8, you should be able to:
- Interpret: P(A∣B).
- Calculate conditional probability.
- Choose the correct conditioning denominator.
- Apply: P(A∩B)=P(A)P(B∣A).
- Define independence.
- Test independence using: P(A∩B)=P(A)P(B).
- Distinguish independence from mutual exclusivity.
- Handle repeated independent trials.
- Handle dependent sampling without replacement.
- Use complements for "at least one."
- Recognize a partition of the sample space.
- Apply the law of total probability.
- Apply Bayes’ theorem.
- Distinguish:
from:
- Understand prior, likelihood, and posterior intuitively.
- Avoid base-rate neglect.
If those are comfortable, Stats 1 Week 8 is under control.
Quick Recall & Flashcards
Test your active recall before proceeding to practice problems. Format:
Question :: Answer.- Week 8 Diagnostic: If P(A) = 0.4, P(B) = 0.5, and P(A and B) = 0.2, are A and B independent? :: Answer: A — P(A) * P(B) = 0.4 * 0.5 = 0.2. Since P(A and B) = P(A)*P(B), events A and B are independent.
- Week 8 Diagnostic: What is P(A|B) if P(A and B) = 0.15 and P(B) = 0.30? :: Answer: 0.5 — P(A|B) = P(A and B) / P(B) = 0.15 / 0.30 = 0.5.
Practice & Self-Check
Attempt these diagnostic questions to verify your operational understanding.
1
Question 1
If P(A) = 0.4, P(B) = 0.5, and P(A and B) = 0.2, are A and B independent?
MCQ
3 Unit Assessment
A. Yes, because P(A and B) = P(A) * P(B)
B. No, because P(A and B) != P(A) + P(B)
C. Only if A and B are mutually exclusive
D. Insufficient information
2
Question 2
What is P(A|B) if P(A and B) = 0.15 and P(B) = 0.30?
NAT
3 Unit Assessment