Conditional Probability Calculator

Conditional Probability Calculator

Calculate P(A|B) — the probability of event A given that event B has occurred.

Last updated: March 2026

Calculate Conditional Probability

P(A|B) = P(A ∩ B) / P(B)
40.00%
= 0.12 / 0.30 = 0.4000

What is Conditional Probability?

Conditional probability is the probability of an event A occurring given that another event B has already occurred. It's written as P(A|B), read "the probability of A given B."

In real life, we constantly use conditional probability. For example, "What's the probability it rained last night given that the grass is wet?" or "What's the probability someone has a disease given that their test came back positive?" These are conditional probabilities because they account for new information.

The fundamental formula is: P(A|B) = P(A ∩ B) / P(B), where P(A ∩ B) is the probability of both A and B occurring together, and P(B) is the probability of B occurring.

How to Calculate Conditional Probability

Method 1: Direct Formula

P(A|B) = P(A ∩ B) / P(B)
Use when you know the joint probability and marginal probability.

Method 2: Bayes' Theorem

P(B) = P(A) × P(B|A) + P(¬A) × P(B|¬A)
P(A|B) = [P(A) × P(B|A)] / P(B)
Use when you know conditional probabilities and prior, need to find posterior probability. This is "inverting" the conditional.

Key Insight:

Bayes' Theorem lets us update our beliefs. If we know P(B|A) (likelihood) and P(A) (prior), we can calculate P(A|B) (posterior) — the updated probability of A given we observed B.

Example: Disease Testing

A disease affects 1% of the population. A test is 99% accurate (returns positive if disease present, negative if not). You test positive. What's the probability you actually have the disease?

Given:
P(Disease) = 0.01, P(Test+|Disease) = 0.99, P(Test+|No Disease) = 0.01
Step 1:
P(No Disease) = 1 - 0.01 = 0.99
Step 2:
P(Test+ AND Disease) = 0.01 × 0.99 = 0.0099
Step 3:
P(Test+ AND No Disease) = 0.99 × 0.01 = 0.0099
Step 4:
P(Test+) = 0.0099 + 0.0099 = 0.0198
Result:
P(Disease|Test+) = 0.0099 / 0.0198 = 50% — Only 50% chance despite "99% accurate" test! This is why false positives matter.

Frequently Asked Questions

What's the difference between P(A|B) and P(B|A)?

These are NOT the same! P(A|B) is 'A given B happened' while P(B|A) is 'B given A happened'. The disease example shows this: P(Positive|Disease) ≠ P(Disease|Positive).

When should I use Bayes' Theorem?

Use Bayes when you want to update your belief after seeing new evidence. You start with a prior P(A), observe B, then calculate the posterior P(A|B). It's fundamental to medical diagnosis, spam filtering, and machine learning.

What does P(A ∩ B) mean?

P(A ∩ B) is the probability that both events occur together. For example, 'it rains AND I stay home.' This is the numerator in conditional probability.

Can conditional probability be greater than the original probability?

Absolutely! If B increases the likelihood of A, then P(A|B) > P(A). For example, P(wet ground | rain) > P(wet ground) because rain makes wet ground more likely.

What if P(B) = 0?

Conditional probability P(A|B) is undefined when P(B) = 0, because we're conditioning on something impossible. The formula involves dividing by P(B), so division by zero is undefined.

How does this relate to independence?

Events A and B are independent if P(A|B) = P(A), meaning knowing B doesn't change the probability of A. If P(A|B) ≠ P(A), the events are dependent.

Related Tools