Pick a depth. Each prompt opens in your AI pre-loaded with the lesson. Click a row to preview the prompt.
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 .
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