Probability Calculator

Compute fundamental probabilities: P(A∪B), P(A∩B), conditional probability P(A|B), and apply Bayes' Theorem. The interactive Venn diagram updates in real time, helping you grasp probability rules, independence, and Bayesian reasoning.

Enter P(A), P(B) and optionally P(A∩B). If left empty, independence is assumed: P(A∩B)=P(A)·P(B). All values must be in [0,1] and obey consistency: P(A∩B) ≤ min(P(A), P(B)).
? Medical Test (Bayes)
? Spam Filter (Bayes)
? Independent Events
? Mutually Exclusive
? Overlap
? A/B Testing
Privacy first: All calculations are performed locally. The Venn diagram is drawn in your browser – no data leaves your device.

Foundations of Probability: Kolmogorov Axioms & Bayesian Inference

Probability theory rests on three axioms formalized by Andrey Kolmogorov in 1933: (1) Non-negativity: P(E) ≥ 0 for any event E; (2) Unity: P(Ω) = 1 for the sample space; (3) Additivity: For mutually exclusive events, P(∪Eᵢ) = ΣP(Eᵢ). Our calculator strictly adheres to these axioms, ensuring every derived probability is mathematically sound. The interactive Venn diagram visually represents the inclusion‑exclusion principle and conditional relationships.

General Addition Rule: P(A ∪ B) = P(A) + P(B) − P(A ∩ B)

Conditional Probability: P(A|B) = P(A ∩ B) / P(B) , provided P(B) > 0.

Bayes' Theorem: P(A|B) = [P(B|A) · P(A)] / P(B)

Why Use an Interactive Probability Tool?

  • Intuitive Learning: Instantly observe how changing P(A∩B) affects union and conditional probabilities.
  • Bayesian Reasoning: Update beliefs with new evidence — a cornerstone of modern AI, diagnostics, and spam filtering.
  • Real-World Relevance: From medical testing to financial risk, probability drives critical decisions.
  • Error Prevention: The tool checks consistency (e.g., P(A∩B) cannot exceed P(A) or P(B)).

Theorems & Derivations

Derivation of Union (Inclusion‑Exclusion): For any two events, the probability of A or B equals the sum of individual probabilities minus the double‑counted intersection. This is visually clear in the Venn diagram: the overlapping region is added twice if we sum P(A)+P(B), so we subtract once.

Independence Criterion: Two events A and B are independent iff P(A∩B) = P(A)·P(B). If the user leaves the intersection blank, the calculator assumes independence — a common simplifying assumption in many statistical models.

Bayes' Theorem in Practice: Originally formulated by Thomas Bayes (1763), it enables updating prior probabilities after observing evidence. In medical screening, the prior disease prevalence P(D) is updated with test sensitivity P(Pos|D) and false positive rate to compute the posterior P(D|Pos).

Venn Diagram Scaling: How We Visualize Probabilities

The circles in our Venn diagram maintain fixed visual radii for clarity and readability, but the colored regions represent proportional probabilities through numeric annotations. The diagram displays "A only", "B only", and "A∩B" with exact probabilities derived from your inputs. While the geometric overlap is fixed, the annotations provide the precise area relationships — a pedagogically recommended approach that bridges abstract formulas with spatial intuition (consistent with GAISE college guidelines).

Step-by-Step Usage

  1. Enter P(A) and P(B) as decimals between 0 and 1.
  2. Optionally specify P(A∩B). If omitted, it is computed as P(A)·P(B) (independence assumption).
  3. Click "Calculate & Visualize" to get union, conditional probabilities, independence status, and a proportional Venn diagram.
  4. If P(B) > 0, the Bayes' theorem panel appears with an explanatory interpretation.
  5. Use preset examples to explore common scenarios: medical diagnosis, spam filtering, A/B testing.

Validation Table – Benchmark Scenarios

Scenario P(A) P(B) P(A∩B) P(A∪B) P(A|B) Independence?
Independent dice rolls 0.3 0.6 0.18 0.72 0.30 ✓ Yes
Mutually exclusive 0.2 0.3 0 0.5 0 ✗ No
Overlapping events 0.7 0.5 0.3 0.9 0.6 ✗ No
Spam filter (Bayes) 0.2 0.18 0.14 0.24 0.7778 ✗ No
Case Study 1: Bayesian Spam Filtering

Email providers use Bayes' theorem to classify spam. Suppose 20% of emails are spam (P(Spam)=0.2). The word "offer" appears in 70% of spam emails and in 5% of legitimate emails (P(Offer|Spam)=0.7, P(Offer|Legit)=0.05). If an email contains "offer", what's the probability it's spam?
Solution using Bayes: P(Spam|Offer) = (0.7×0.2) / (0.7×0.2 + 0.05×0.8) = 0.14 / 0.18 ≈ 0.7778. Our calculator replicates this: set P(A)=0.2 (spam), P(B)=0.18 (total probability of "offer"), and P(A∩B)=0.14 → yields P(A|B)=0.7778. This principle powers modern anti‑spam engines and content filtering systems.

Case Study 2: A/B Testing in Digital Marketing

A company tests two website variants. Historical conversion rate for variant A is 12% (P(Convert|A)=0.12) and for variant B is 15% (P(Convert|B)=0.15). Traffic split: 50% see A, 50% see B. What is the overall conversion rate P(Convert)? Given a conversion, what's the probability the user saw variant B? Using total probability: P(Convert) = 0.5×0.12 + 0.5×0.15 = 0.135. Bayes: P(B|Convert) = (0.5×0.15)/0.135 ≈ 0.556. Our tool helps demystify posterior probabilities in business analytics and optimization.

Case Study 3: Medical Diagnostics (Extended)

With a disease prevalence of 1%, a test with 99% sensitivity and 95% specificity yields P(Disease|Positive) ≈ 16.7%. This classic example demonstrates that even highly accurate tests have low positive predictive value for rare conditions — a critical insight for clinicians and patients. The "Medical Test" preset loads these values: P(A)=0.01 (disease), P(B)=0.0594 (total positive rate), P(A∩B)=0.0099, revealing the posterior probability.

Common Pitfalls & Misconceptions

  • Base Rate Fallacy: Ignoring prior probability P(A) when interpreting P(A|B). Our Bayes panel explicitly shows how prior updates to posterior.
  • Confusing P(A|B) with P(B|A): These are rarely equal. Bayes' theorem corrects the inversion — the calculator highlights this relationship.
  • Assuming independence without verification: Many real-world events are correlated. Our independence check warns when P(A∩B) ≠ P(A)P(B).
  • Misapplying addition rule: P(A∪B) = P(A)+P(B) only when events are mutually exclusive. The tool always subtracts the intersection.
  • Ignoring consistency constraints: P(A∩B) can never exceed P(A) or P(B) — our validation prevents such logical contradictions.

Applications Across Domains

  • Machine Learning: Naive Bayes classifiers, Bayesian networks, uncertainty quantification in AI models.
  • Finance: Risk modeling, credit scoring, portfolio default correlation, Value at Risk (VaR).
  • Healthcare: Diagnostic test evaluation, disease surveillance, clinical trial design, personalized medicine.
  • Manufacturing: Quality control, defect prediction using Bayesian updating, Six Sigma methodology.
  • Sports Analytics: Win probability models, player performance inference, in-game decision optimization.
  • Criminal Justice: Forensic evidence evaluation, likelihood ratios in court proceedings.

Rooted in Statistical Science — This tool is built upon the axiomatic framework of Kolmogorov and the inferential insights of Bayes, Laplace, and modern statisticians. All formulas are cross-verified against authoritative references: Probability and Statistics (DeGroot & Schervish), Introduction to Probability (Blitzstein & Hwang), and the American Statistical Association (ASA) guidelines. Reviewed by the GetZenQuery mathematics team for educational accuracy and real-world applicability. Last updated March 2026.

Frequently Asked Questions

Kolmogorov axioms are the mathematical foundations of probability theory, established in 1933. They ensure consistency: all probabilities are between 0 and 1, the sample space has probability 1, and the probability of disjoint unions adds. Our calculator strictly respects these axioms, guaranteeing logically sound results.

The diagram shows region labels with exact probabilities for "A only", "B only", and "intersection". While circles have fixed radii for visual clarity, the numeric annotations give exact area proportions. This hybrid approach maintains readability while conveying precise probability values — a method endorsed by statistics educators (GAISE).

Mutually exclusive means A and B cannot occur simultaneously: P(A∩B)=0. In such cases, the addition rule simplifies to P(A∪B)=P(A)+P(B). The Venn diagram shows no overlap.

If the user provides P(A∩B) and it equals P(A)·P(B) within tolerance (1e-8), events are independent. If omitted, the calculator assumes independence by default, which is common in introductory probability problems.

This version focuses on two events for clarity and visual interactivity. For multi-event Bayesian networks or sequential updating, we recommend exploring our dedicated Bayesian Inference Suite (coming soon).

We recommend Khan Academy, Bayesian Statistics (Coursera), and the book The Theory That Would Not Die by Sharon Bertsch McGrayne for an engaging history of Bayes' theorem.
References: Wolfram MathWorld – Probability; Kolmogorov, A.N. (1933) Foundations of the Theory of Probability; Stanford Encyclopedia of Philosophy – Bayes’ Theorem; ASA GAISE College Report (2020); DeGroot, M. & Schervish, M. Probability and Statistics (4th ed.).