Free Conditional Probability Calculator

Enter probabilities between 0 and 1 to compute P(A|B).

What Is a Conditional Probability Calculator?

This tool is designed to compute the probability of an event occurring under the condition that another event has already taken place. It implements the core principles of Bayes’ theorem, allowing users to derive posterior probabilities from known prior information and likelihoods. Whether you need a P(A|B) calculator for academic study, medical decision‑making, or data science, the conditional probability formula embedded in this calculator delivers reliable numerical results in seconds.

Conditional Probability – The Core Concept

In probability theory, conditional probability measures the likelihood of event AA given that event BB has occurred. It is expressed as:

P(A∣B)=P(A∩B)P(B)P(A|B) = \frac{P(A \cap B)}{P(B)}

where P(A∩B)P(A \cap B) is the joint probability of both events happening, and P(B)P(B) is the total probability of event BB. This relation lies at the heart of Bayesian probability – a framework that updates beliefs as new evidence appears.

How to Compute Conditional Probability Step by Step

To obtain P(A∣B)P(A|B) manually, follow these three steps:

  1. Find the total probability of the conditioning event BB
    Use the law of total probability:

    P(B)=P(A∩B)+P(Aˉ∩B)=P(A)⋅P(B∣A)+P(Aˉ)⋅P(B∣Aˉ)P(B) = P(A \cap B) + P(\bar{A} \cap B) = P(A) \cdot P(B|A) + P(\bar{A}) \cdot P(B|\bar{A})
  2. Calculate the joint probability P(A∩B)P(A \cap B)

    P(A∩B)=P(A)⋅P(B∣A)P(A \cap B) = P(A) \cdot P(B|A)
  3. Divide the joint probability by the total probability of BB

    P(A∣B)=P(A∩B)P(B)P(A|B) = \frac{P(A \cap B)}{P(B)}

These steps are exactly what the conditional probability formula behind the calculator automates.

Real‑Life Example: Disease Testing

Consider a population where 5% of people have a certain disease (event DD). A diagnostic test exists with the following performance:

  • Sensitivity (true positive rate) = 91%91\% – if the person is diseased, the test is positive with probability 0.910.91.
  • Specificity (true negative rate) = 95%95\% – if the person is healthy, the test is negative with probability 0.950.95 (so the false positive rate is 0.050.05).

Now, a randomly selected person takes the test and receives a positive result (event ++). What is the probability that this person actually has the disease – the conditional probability P(D∣+)P(D|+)?

We apply the three‑step procedure:

  1. Total probability of a positive result

    P(+)=P(D∩+)+P(Healthy∩+)P(+) = P(D \cap +) + P(\text{Healthy} \cap +) P(+)=(0.05×0.91)+(0.95×0.05)=0.0455+0.0475=0.093P(+) = (0.05 \times 0.91) + (0.95 \times 0.05) = 0.0455 + 0.0475 = 0.093
  2. Joint probability of being diseased and testing positive

    P(D∩+)=0.05×0.91=0.0455P(D \cap +) = 0.05 \times 0.91 = 0.0455
  3. Conditional probability

    P(D∣+)=0.04550.093≈0.4892P(D|+) = \frac{0.0455}{0.093} \approx 0.4892

Thus, despite a positive test result, the posterior probability that the person is actually infected is only about 49% – not much better than a coin toss. This surprising result highlights the importance of the prior probability (disease prevalence) when interpreting diagnostic tests, a concept at the core of Bayesian probability.

Connection to Bayes’ Theorem

The calculation above is a direct application of Bayes’ theorem:

P(D∣+)=P(+∣D)⋅P(D)P(+)P(D|+) = \frac{P(+|D) \cdot P(D)}{P(+)}

Here, P(D)P(D) is the prior probability (5%), P(+∣D)P(+|D) is the likelihood (sensitivity), and P(+)P(+) serves as the evidence. The posterior probability P(D∣+)P(D|+) represents the updated belief after observing the positive test. This calculators can handle any such scenario where you need the probability of AA given BB.

Why Use a Conditional Probability Calculator?

Manually applying the conditional probability formula can become tedious – especially when multiple events or more complex tree diagrams are involved. This tool eliminates manual steps, reduces human error, and provides immediate results. It is ideal for students, researchers, healthcare professionals, and anyone who regularly works with Bayesian probability and needs a reliable P(A|B) calculator.

FAQ

1. What is conditional probability and how do I calculate it?

Conditional probability is the likelihood of event A occurring given that event B has already occurred, written as P(A|B). It is calculated using the formula P(A|B) = P(A∩B) / P(B). You can either compute it manually by finding the joint probability and dividing by the total probability of B, or use this calculator for instant results.

2. How does the conditional probability calculator relate to Bayes' theorem?

The calculator directly implements Bayes' theorem, which updates the prior probability of an event based on new evidence. For example, P(A|B) = P(B|A) * P(A) / P(B). This tool automates all parts of the formula, giving you the posterior probability without manual computation.

3. In the disease testing example, why is the probability of having the disease only about 49% despite a positive test?

Because the disease prevalence (prior probability) is very low (5%), even a highly sensitive and specific test produces a significant number of false positives. The posterior probability P(D|+) combines the prior with the test's accuracy; the result shows that a positive test does not guarantee infection when the disease is rare.

4. What is the difference between conditional probability and joint probability?

Joint probability P(A∩B) is the probability that both events A and B occur simultaneously, without any condition. Conditional probability P(A|B) is the probability of A occurring given that B has already occurred. They are related by P(A|B) = P(A∩B) / P(B). The calculator works with both concepts to compute the conditional probability.

How to Use

  1. Enter the prior probability P(A) - the base rate or initial probability of event A, as a decimal between 0 and 1.
  2. Enter the likelihood P(B|A) - the probability of event B occurring given that A is true (also called the true positive rate).
  3. Enter the false positive rate P(B|¬A) - the probability of event B occurring when A is not true. The posterior probability P(A|B) updates instantly.