Conditional Probability Calculator P(A|B)
Calculate P(A|B), joint probability, and marginal probability with precision
Enter probability values to compute conditional probability P(A|B), which represents the probability of event A occurring given that event B has occurred.
Conditional Probability Calculator P(A|B)
Calculate P(A|B), joint probability, and marginal probability with precision
Calculate the conditional probability of A given B, using P(A∩B) and P(B).
About Conditional Probability Calculator
Conditional probability is one of the cornerstones of probability theory and statistics. It describes the likelihood of an event occurring given that another event has already happened, and it underpins some of the most important reasoning tools in science, medicine, and machine learning.
The formal definition is: P(A|B) = P(A ∩ B) / P(B), provided P(B) > 0. Here, P(A|B) is read as 'the probability of A given B', P(A ∩ B) is the joint probability that both A and B occur, and P(B) is the marginal probability of B. Rearranging this formula gives the multiplication rule: P(A ∩ B) = P(A|B) × P(B), which is widely used to compute joint probabilities from conditional ones.
A classic illustration is medical testing. Suppose a disease affects 1% of the population and a diagnostic test has a 5% false-positive rate. The probability that a randomly selected person tests positive is P(B). The probability that the person is both diseased and tests positive is P(A ∩ B). Dividing gives the conditional probability that a person is actually sick given a positive result — often far lower than intuition suggests, a phenomenon known as the base rate fallacy.
Conditional probability also lies at the heart of Bayes' theorem: P(A|B) = P(B|A) × P(A) / P(B). Bayes' theorem lets you update your prior belief P(A) in light of new evidence B to obtain a posterior belief P(A|B). This Bayesian updating framework is used in spam filters, medical diagnosis, forensic evidence evaluation, and modern machine learning classifiers.
This calculator supports three modes. 'Find P(A|B)' takes the joint probability P(A ∩ B) and the marginal P(B) as inputs and returns the conditional probability. 'Find P(A ∩ B)' takes P(A|B) and P(B) and applies the multiplication rule. 'Find P(B)' solves for the marginal probability given the conditional and joint values. All probability inputs must be between 0 and 1, and P(B) must be non-zero when it appears in the denominator.
Examples
The table below shows conditional probability calculations from common real-world scenarios.
| Inputs | Result | Scenario |
|---|---|---|
| P(A∩B)=0.005, P(B)=0.05 | P(A|B) = 0.1 | Medical: P(sick | positive test) |
| P(A∩B)=0.18, P(B)=0.6 | P(A|B) = 0.3 | Weather: P(rain | cloudy) |
| P(A|B)=0.02, P(B)=0.15 | P(A∩B) = 0.003 | Quality: joint defect probability |
| P(A|B)=0.4, P(A∩B)=0.12 | P(B) = 0.3 | Solve for marginal probability |
How to Use the Conditional Probability Calculator
- Select the calculation type: 'Find P(A|B)' if you want the conditional probability, 'Find P(A∩B)' for the joint probability, or 'Find P(B)' for the marginal probability.
- Enter the known probability values in the input fields that appear. All values must be between 0 and 1 inclusive.
- When finding P(A|B), ensure P(B) is greater than 0 — conditional probability is undefined when the conditioning event has zero probability.
- Click 'Calculate Probability' to compute the result. The answer is displayed along with a warning if the result exceeds 1.
- Use the quick-load example buttons to populate the inputs with real-world scenarios and verify your understanding.
Frequently Asked Questions
What does P(A|B) mean in plain language?
P(A|B) is the probability that event A occurs, knowing that event B has already occurred or is guaranteed to occur. It narrows the sample space from all possible outcomes to only those where B is true, then asks how many of those also include A. For example, P(rain | cloudy) is the probability of rain given that it is already cloudy.
What is the difference between P(A|B) and P(A∩B)?
P(A∩B) is the probability that both A and B occur in the full sample space, whereas P(A|B) is the probability that A occurs within the restricted sample space where B is already known to have occurred. Numerically, P(A|B) = P(A∩B) / P(B), so P(A|B) ≥ P(A∩B) whenever P(B) < 1.
When are two events considered independent?
Events A and B are independent if P(A|B) = P(A), meaning that knowing B occurred gives no information about whether A occurs. Equivalently, P(A∩B) = P(A) × P(B). Independence is a strong assumption; in most real-world problems events are dependent and conditional probability provides the correct framework.
What is Bayes' theorem and how does it relate to this calculator?
Bayes' theorem states P(A|B) = P(B|A) × P(A) / P(B). It allows you to reverse conditional probabilities: if you know how likely B is given A, and you know the base rates P(A) and P(B), you can compute how likely A is given B. This calculator directly implements the foundational formula P(A|B) = P(A∩B)/P(B), which is the same relationship Bayes' theorem exploits.
Why can a conditional probability be higher than either P(A) or P(B)?
Because conditioning reduces the sample space. When B is a small probability event that is strongly associated with A, dividing P(A∩B) by the small value P(B) can produce a result much larger than P(A). This is not a contradiction — it simply reflects that within the subset of outcomes where B occurred, A is very common.
What happens if P(B) equals zero?
P(A|B) is mathematically undefined when P(B) = 0 because you are conditioning on an impossible event. In standard probability theory, conditioning on a zero-probability event requires advanced measure-theoretic tools. For practical purposes, if P(B) = 0, the conditional probability formula cannot be applied directly, and the calculator will display an error prompting you to enter a positive value for P(B).