Hassan Ijaz

Ai, Web & Design
← Back to all topics
Probability FundamentalsTopic 2 of 58

Conditional probability and independence

Two-box simulator where users can drag colored balls between boxes and see how P(A|B) changes dynamically with visual tree diagrams

Concept Overview

Conditional probability is the probability of an event occurring given that another event has already occurred. It's a fundamental concept for understanding how events relate to each other.

Key Concepts

  • P(A|B): Probability of A given B has occurred = P(A ∩ B) / P(B)
  • Forward Probability: P(Effect|Cause) - "If we know the cause, what's the probability of the effect?"
  • Reverse Probability: P(Cause|Effect) - "If we observe the effect, what's the probability of the cause?"

Bayes' Theorem

P(A|B) = (P(B|A) × P(A))/ P(B)

This formula lets us "flip" conditional probabilities. If we know P(B|A), we can calculate P(A|B).

Real-World Example

Imagine two boxes of colored balls:

  • Box 1: Mostly red balls
  • Box 2: Mostly blue balls

Questions we can answer:

  • If I pick from Box 1, what color will I likely get? (Forward)
  • If I have a red ball, which box did it likely come from? (Reverse)

Use the interactive visualization below to drag balls between boxes and see how conditional probabilities change in real-time.

Interactive Visualization

Loading interactive visualization...

Two-box simulator where users can drag colored balls between boxes and see how P(A|B) changes dynamically with visual tree diagrams