What Is Conditional Probability?

Conditional probability quantifies how the chance of one event changes given that a second event has occurred. Denoted P(A|B), it answers: "What is the probability of A, assuming B is true?" This differs fundamentally from joint probability, which measures both events occurring together.

The relationship between events matters. When event B provides information about event A—such as a positive medical test raising the likelihood of disease—the events are dependent, and conditional probability applies. Without this dependence, the conditional probability equals the unconditional probability.

  • Notation: P(A|B) reads as "the probability of A given B"
  • Real-world relevance: Assessing risk after new information arrives
  • Key requirement: The conditioning event must have non-zero probability

Computing Conditional Probability

To find P(A|B), you need the joint probability of both events and the total probability of the conditioning event. The formula divides the intersection probability by the marginal probability:

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

P(B) = P(A ∩ B) + P(Ā ∩ B)

P(B) = P(A) × P(B|A) + P(Ā) × P(B|Ā)

  • P(A|B) — Conditional probability of A given B has occurred
  • P(A ∩ B) — Joint probability that both A and B occur
  • P(B) — Marginal or total probability of event B
  • P(A) — Marginal probability of event A
  • P(Ā) — Probability that event A does not occur (1 − P(A))

The Law of Total Probability

When computing conditional probabilities, you often must first calculate the total probability of your conditioning event. The law of total probability partitions the sample space into mutually exclusive, exhaustive categories and sums across them.

If event B can arise through either A or not-A occurring first, then:

  • P(B) splits into two paths: one through A, one through its complement
  • Each path's contribution is a product: the probability of the first event multiplied by the conditional probability of B given that first event
  • This decomposition enables you to calculate P(A|B) even when you only know P(B|A) and prior probabilities

This principle underlies Bayesian inference, where prior beliefs and new evidence combine to form updated (posterior) probabilities.

A Medical Testing Example

Suppose a disease affects 2% of a population, and a diagnostic test has 95% sensitivity (true positive rate) and 90% specificity (true negative rate). Someone tests positive. What is the actual probability they carry the disease?

Using conditional probability:

  • P(Disease): 0.02
  • P(Positive | Disease): 0.95
  • P(Positive | No Disease): 1 − 0.90 = 0.10
  • P(Positive): (0.02 × 0.95) + (0.98 × 0.10) = 0.0190 + 0.0980 = 0.1170
  • P(Disease | Positive): 0.0190 / 0.1170 ≈ 16.2%

Despite a positive test, the actual disease risk remains modest due to the disease's rarity in the population. This illustrates why conditional probability is essential in medicine: test accuracy alone misleads without considering baseline prevalence.

Common Pitfalls in Conditional Probability

Avoid these frequent errors when working with dependent events and Bayesian reasoning.

  1. Confusing P(A|B) with P(B|A) — The order matters. P(Disease | Positive test) is not the same as P(Positive test | Disease). The first asks how likely disease is given a positive result; the second asks how likely a positive is given disease. Always check which direction your question flows.
  2. Ignoring base rates — Focusing only on test accuracy while overlooking how rare or common an event is in the population leads to overestimating conditional probabilities. A 99% accurate test for a 0.1% event still produces many false positives. Always incorporate the prior probability.
  3. Assuming events are independent when they are not — Conditional probability applies only when events are dependent. If you assume independence wrongly, you'll multiply unconditional probabilities instead of using the correct formula, yielding incorrect results.
  4. Requiring non-zero conditioning probability — You cannot compute P(A | B) if P(B) = 0. The formula involves division by P(B), making it undefined when the conditioning event has zero probability. Ensure your conditioning event is possible.

Frequently Asked Questions

When should I use the law of total probability?

Use it whenever you need to find the marginal probability of an event that can occur through multiple distinct pathways. For example, if customers can reach your website through social media, search engines, or direct links, and you want the total conversion rate, you partition conversions by source and sum them. This becomes essential in conditional probability calculations because P(B), the denominator in P(A|B) = P(A ∩ B) / P(B), often requires summing across all ways B can occur.

How do Bayes' theorem and conditional probability relate?

Bayes' theorem is a direct application of conditional probability that reverses the conditioning direction. It uses the formula: P(A|B) = P(B|A) × P(A) / P(B). This rearrangement lets you flip from "probability of evidence given hypothesis" to "probability of hypothesis given evidence." In medical diagnostics, you often know the test accuracy P(Positive | Disease) but need the clinical relevance P(Disease | Positive). Bayes' theorem bridges this gap by incorporating prior disease probability and total test positivity rates.

Why does a high-accuracy test still produce many false alarms for rare events?

When an event is rare, most positive results are false positives. If a disease occurs in 1 per 10,000 people and a test is 99% accurate, then in 10,000 people there is 1 true case but approximately 100 false positives (from the 9,999 disease-free people). The conditional probability P(Disease | Positive) ≈ 1/101, or under 1%, despite the test's high accuracy. This counterintuitive result stems from base rates dominating the calculation when prevalence is very low.

Can conditional probability exceed the unconditional probability of an event?

Yes. If event B is more common among instances where A occurs than in the overall population, then P(A|B) can exceed P(A). For example, suppose P(Rain) = 30% overall. But P(Rain | Cloudy) might be 60% because rain is more likely when clouds are present. The conditioning event B (clouds) enriches the subset where A (rain) is more probable, raising the conditional probability above the marginal one.

What does it mean if a conditional probability equals zero?

It means the intersection event cannot occur. If P(A ∩ B) = 0, then P(A|B) = 0 / P(B) = 0 (provided P(B) > 0). Practically, this indicates that when B happens, A never happens. For instance, P(Heads | Coin is Tails) = 0 because heads and tails are mutually exclusive. Zero conditional probability signals that knowledge of B completely rules out A.

How do I verify my conditional probability calculation?

Check that all probabilities lie between 0 and 1. Verify that mutually exclusive events partition correctly: if events A and Ā partition the sample space, then P(B|A) + P(B|Ā) weighted by P(A) and P(Ā) should reconstruct P(B). For a two-by-two table, cross-multiply to confirm consistency: P(A|B) × P(B) should equal P(A ∩ B), and all rows and columns should sum logically. Use these checks before trusting your result.

More statistics calculators (see all)