wanna mathMath ain't scary (not anymore)
4-Tier Textbook Index • Vol → Mod → Ch → Lab

Engineering Mathematics Volumes I–VI

6 Volumes • 20 Modules • 85 ChaptersFull Matrix →
4-Tier Statistics Index • Vol S → Mod → Ch → Lab

Interactive Statistics (S.1–S.6)

6 Modules • 18 ChaptersStatistics Index →
CHAPTER S.2.2 • 2DPublished Interactive Labs~30 min study

Conditional Probability, Tree Diagrams & Bayes' Theorem Intuition

Watch conditioning shrink the entire universe to what actually happened—and see why rare conditions make positive tests surprising.

Engineering & Physical Application Context

Medical diagnostics, email spam classification, sensor anomaly filtering, and forensic evidence evaluation.

Governing Mathematical Formulation
P(A∣B)=P(A∩B)P(B),P(H∣E)=P(E∣H)P(H)P(E)P(A \mid B) = \frac{P(A \cap B)}{P(B)}, \qquad P(H \mid E) = \frac{P(E \mid H)P(H)}{P(E)}
Volume S • Module S.21 Interactive Lab(s)

The Question You Should Ask

How does observing evidence EE shrink the sample universe to P(E)P(E)—and why does base-rate neglect deceive intuition on rare events?

In Simple Words & Math

Conditioning P(H∣E)=P(H∩E)/P(E)P(H\mid E) = P(H\cap E)/P(E) discards every world where EE failed and re-normalizes remaining outcomes so true-positive probability divides by all positives (true plus false).

When prior prevalence P(H)P(H) is small, even a tiny false-positive rate P(E∣Hc)P(E\mid H^c) multiplied across the large healthy majority P(Hc)P(H^c) can swamp true positives inside Bayes' denominator.

4-Step Pedagogical Chapter Rhythm • Geometric Intuition First
Ch. S.2.2
STEP 1 • GEOMETRIC QUESTION

If a medical test is 95% accurate and you test positive for a 1%-prevalence condition, why is your real chance of having it nowhere near 95%?

STEP 2 • INTERACTIVE LAB EXPLORATION

Adjust disease prevalence P(H), sensitivity P(E|H), and false-positive rate P(E|Hᶜ) across a 1,000-person frequency mosaic and synchronized probability tree.

STEP 3 • SYMBOLIC FORMALIZATION
P(H∣E)=P(E∣H)P(H)P(E∣H)P(H)+P(E∣Hc)P(Hc)P(H \mid E) = \frac{P(E \mid H)P(H)}{P(E \mid H)P(H) + P(E \mid H^c)P(H^c)}
STEP 4 • EDGE CASES & NEXT BRIDGE

Base-rate neglect confuses P(E|H) with P(H|E). Next, Chapter S.2.3 tracks discrete counts and waiting times generated by repeated random trials.

Interactive Laboratories in Chapter S.2.2
FIRST-TIMER GUIDE • CONDITIONING SHRINKS THE UNIVERSE

Why 95% Test Accuracy Still Gives Only a 16% Chance: Bayes' Theorem From First Principles

Suppose a rare condition affects only 1% of people, and a screening test correctly spots 95% of sick people (with a 5% false-positive rate on healthy people). You test positive! How worried should you be? Most people guess 95%—yet the true answer is only 16.1%! Why? Because there are so many more healthy people than sick people that even a tiny 5% false alarm produces roughly 50 healthy positives alongside only 10 true positives. Click Zoom Into Evidence E⁺ in the 1,000-person grid below to see conditioning literally erase everyone who tested negative!

Initializing Interactive Laboratory
LOADING MODULE

Preparing interactive canvas & numerical solver…

wanna math drafting viewport

Where Bayes' Formula Comes From (One Line of Logic)

1. CONDITIONING = NEW DENOMINATOR
P(H∣E)=P(H∩E)P(E)P(H \mid E) = \frac{P(H \cap E)}{P(E)}

Read H∣EH \mid E as “Hypothesis HH, given we already know Evidence EE happened.” We throw out all non-EE outcomes and divide the remaining H∩EH \cap E slice by the new shrunk universe P(E)P(E).

2. FLIPPING BOTH WAYS
P(H∣E)=P(E∣H)P(H)P(E∣H)P(H)+P(E∣Hc)P(Hc)P(H \mid E) = \frac{P(E \mid H)P(H)}{P(E \mid H)P(H) + P(E \mid H^c)P(H^c)}

Since P(H∩E)=P(E∣H)P(H)P(H \cap E) = P(E \mid H)P(H), Bayes simply splits all ways evidence EE can happen into two tree branches: True Positives plus False Positives (the Law of Total Probability).

3. TINY 1,000-PERSON CALCULATION

Out of 1,000 people at 1% prevalence:

  • 10 sick → 9.5 test E⁺ (TP)
  • 990 healthy → 49.5 test E⁺ (FP)
  • Total E⁺ = 9.5 + 49.5 = 59.0
P(Sick∣+)=9.559.0≈16.1%P(\text{Sick} \mid +) = \frac{9.5}{59.0} \approx 16.1\%
TRAP • CONFUSING P(E | H) WITH P(H | E)

This mistake is so dangerous in courtrooms it is called the Prosecutor's Fallacy: “Probability of a random DNA match if innocent = 0.5%” is P(E∣Hc)P(E \mid H^c), NOT “chance the defendant is innocent given a DNA match” P(Hc∣E)P(H^c \mid E)! Always pause and draw the 1,000-person tree first.

SEQUENTIAL LEARNING • POSTERIOR BECOMES NEXT PRIOR

Click + Apply 2nd Independent Positive Test above: your updated 16.1% becomes the brand-new Prior, and a second positive leaps to ~78.4%! Updating beliefs continuously as data arrives is the heartbeat of modern Bayesian AI.

Evidence Updating • Ch. S.2.2

Conditioning Geometry, Worked 1% Base-Rate Calculation & Posterior Odds

Open Bayes Formulas →
1. RENORMALIZING TO THE EVIDENCE WORLD
P(E)=P(E∣H)P(H)+P(E∣Hc)P(Hc)P(E) = P(E\mid H)P(H) + P(E\mid H^c)P(H^c)

Partitioning E=(E∩H)⊔(E∩Hc)E = (E\cap H)\sqcup (E\cap H^c) expresses the marginal evidence denominator as a weighted average over hypotheses—forming a genuine conditional probability measure on the reduced space EE.

2. WORKED 1%-PREVALENCE TEST CALCULATION
P(H∣+)=0.95×0.010.95×0.01+0.05×0.99=0.00950.0590≈16.1%P(H \mid +) = \frac{0.95 \times 0.01}{0.95 \times 0.01 + 0.05 \times 0.99} = \frac{0.0095}{0.0590} \approx 16.1\%

Out of 1,0001,000 people, roughly 9.59.5 are true positives while 49.549.5 are false positives from the healthy 99%99\% majority! Natural frequency counts cure base-rate neglect instantly.

3. BAYES FACTOR & SEQUENTIAL TESTING
P(H∣E1,E2)P(Hc∣E1,E2)=P(E2∣H)P(E2∣Hc)⏟BF2⋅P(E1∣H)P(E1∣Hc)⏟BF1⋅P(H)P(Hc)\frac{P(H\mid E_1, E_2)}{P(H^c\mid E_1, E_2)} = \underbrace{\frac{P(E_2\mid H)}{P(E_2\mid H^c)}}_{\text{BF}_2}\cdot \underbrace{\frac{P(E_1\mid H)}{P(E_1\mid H^c)}}_{\text{BF}_1}\cdot \frac{P(H)}{P(H^c)}

Assuming conditional independence of two confirmatory tests multiplies odds by 19×19=36119 \times 19 = 361—raising a 16.1%16.1\% suspect result after one positive test cleanly to 78.5%78.5\% after a second!

Chapter S.2.2 Laboratory Specifications

1 Interactive Lab(s)
LAB S.2.2.1Component: BayesMosaicTreeLab

1,000-Person Frequency Grid & Bayes' Tree Explorer

Visualize prior prevalence, true positives, and false positives as concrete counts in a unit square and probability tree.

P(H∣E)=True PositivesAll PositivesP(H \mid E) = \frac{\text{True Positives}}{\text{All Positives}}