Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
Conditional probability is the formalism for 'given that I now know , what is my probability of ?' Almost every applied use of probability in the wild — medical tests, spam filters, A/B test interpretation, fraud detection, Bayesian inference — is conditional. The reason this is one of the most-flubbed topics is that natural language conditioning is sloppy: 'the probability the patient has cancer given a positive test' is not the same number as 'the probability of a positive test given cancer,' and conflating those two is the engine that drives base-rate fallacies, prosecutor's fallacies, and bad PMs misreading dashboards. Internalize the formula now and these confusions evaporate.
Given two events with , the conditional probability of given is the proportion of 's probability mass that also falls inside — that is, you renormalize the universe to .
Use these three in order. Each builds on the one before.
In one paragraph, explain conditional probability $P(A \mid B)$ in plain words, using a medical-test example. Be explicit about the difference between $P(\text{disease} \mid \text{positive test})$ and $P(\text{positive test} \mid \text{disease})$.
Walk me step by step through *why* the conditional formula $P(A \mid B) = P(A \cap B) / P(B)$ has the form it does. Start from 'restrict the sample space to $B$ and renormalize so $P(B \mid B) = 1$.'
When does $P(A \mid B) = P(A \mid B^c)$ hold? Show that this is equivalent to $A$ and $B$ being independent, and explain why this is a stronger statement than 'knowing $B$ does not change my belief about $A$.'
sum(w) == 8 to sum(w) == 7 and recompute. should still be — every value of die-2 is achievable, conditioning on die-1 just shifts which one wins.// main.go
package main
import "fmt"
func main() {
// Build the sample space: all pairs (d1, d2) with d1, d2 in 1..6
type roll [2]int
var omega []roll
for d1 := 1; d1 <= 6; d1++ {
for d2 := 1; d2 <= 6; d2++ {
omega = append(omega, roll{d1, d2})
}
}
var A, B, AB []roll
for _, w := range omega {
if w[0]+w[1] == 8 {
A = append(A, w) // event A: sum is 8
}
if w[0] == 3 {
B = append(B, w) // event B: first die is 3
}
if w[0]+w[1] == 8 && w[0] == 3 {
AB = append(AB, w)
}
}
pA := float64(len(A)) / 36
pB := float64(len(B)) / 36
pAB := float64(len(AB)) / 36
fmt.Printf("P(A) = %.4f\n", pA)
fmt.Printf("P(B) = %.4f\n", pB)
fmt.Printf("P(A|B) = %.4f\n", pAB/pB) // 1/6 — given die1=3, die2 must be 5
}
go run main.go