Probability of A Given B Calculator

This probability of A given B calculator finds the conditional probability P(A | B) and P(B | A) from two event probabilities and one more value. It also gives the joint and union probabilities and tests independence.

Checks on your data

  • P(A | B) and P(B | A) are different quantities and are often confused. Use the Bayes working in the steps to convert between them.

Results

P(A | B)
0.3
30 %
P(B | A)
0.4
40 %
P(A and B)
0.12
P(A or B)
0.58
P(neither)
0.42
P(A only)
0.18
P(B only)
0.28
Independent?
Yes: P(A and B) = P(A)·P(B)
P(A)·P(B) = 0.12
Lift P(A and B) / (P(A)P(B))
1
no association
The four outcomes (probabilities add to 1)
00.20.4A and B: 0.12A and B0.12A only: 0.18A only0.18B only: 0.28B only0.28Neither: 0.42Neither0.42
Conditional versus unconditional
00.10.20.30.4P(A): 0.3P(A)0.3P(A | B): 0.3P(A | B)0.3P(B): 0.4P(B)0.4P(B | A): 0.4P(B | A)0.4
Two-way probability table
BNot BTotal
A0.120.180.3
Not A0.280.420.7
Total0.40.61
Show step-by-step solution
  1. P(A and B) = 0.12 (given).
  2. P(A | B) = P(A and B) ÷ P(B) = 0.12 ÷ 0.4 = 0.3.
  3. P(B | A) = P(A and B) ÷ P(A) = 0.12 ÷ 0.3 = 0.4.
  4. P(A or B) = P(A) + P(B) − P(A and B) = 0.58.
  5. Bayes: P(A | B) = P(B | A) P(A) ÷ P(B) = 0.4 × 0.3 ÷ 0.4 = 0.3.
DefinitionP(A|B) = P(A∩B)/P(B)
IndependentP(A∩B) = P(A)P(B)
UnionP(A)+P(B)−P(A∩B)
BayesP(B|A)P(A)/P(B)

What Is Probability of A Given B?

Conditional probability is the probability of an event A given that another event B has occurred: P(A | B) = P(A and B) ÷ P(B). It is the foundation of Bayes theorem and of how new information updates a probability.

Enter P(A), P(B) and either the joint probability P(A and B) or one of the conditionals. The calculator returns both conditional probabilities, P(A and B), P(A or B), P(neither), the lift and whether the events are independent, along with a two-way probability table.

The sections below explain the formulas, variables, a worked example and common questions about the difference between P(A | B) and P(B | A).

How to Use the Probability of A Given B Calculator

  1. Enter P(A) and P(B).
  2. Choose which third value you know: the joint probability or either conditional.
  3. Enter it.
  4. Read both conditionals, the union and the independence test.

Probability of A Given B Formula

Conditional probability

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

Multiplication rule

P(A∩B)=P(A∣B) P(B)P(A\cap B)=P(A\mid B)\,P(B)

Bayes theorem

P(A∣B)=P(B∣A) P(A)P(B)P(A\mid B)=\frac{P(B\mid A)\,P(A)}{P(B)}

Union

P(A∪B)=P(A)+P(B)−P(A∩B)P(A\cup B)=P(A)+P(B)-P(A\cap B)

Probability of A Given B Variables Explained

SymbolMeaningNotes
P(A), P(B)Probability of each event
P(A and B)Joint probabilityboth occur
P(A | B)Probability of A given B
P(A or B)Union probabilityP(A) + P(B) − P(A and B)

Probability of A Given B Worked Example

Suppose P(A) = 0.30, P(B) = 0.40 and P(A and B) = 0.12. Then P(A | B) = 0.12 ÷ 0.40 = 0.30 and P(B | A) = 0.12 ÷ 0.30 = 0.40. Because P(A)P(B) = 0.12 equals P(A and B), the events are independent.

With the example values loaded in the calculator above, the steps are:

  1. P(A and B) = 0.12 (given).
  2. P(A | B) = P(A and B) ÷ P(B) = 0.12 ÷ 0.4 = 0.3.
  3. P(B | A) = P(A and B) ÷ P(A) = 0.12 ÷ 0.3 = 0.4.
  4. P(A or B) = P(A) + P(B) − P(A and B) = 0.58.
  5. Bayes: P(A | B) = P(B | A) P(A) ÷ P(B) = 0.4 × 0.3 ÷ 0.4 = 0.3.

Result: P(A | B) = 0.3; P(B | A) = 0.4.

Where Probability of A Given B Is Used

Bayes problems

Converting between P(A | B) and P(B | A).

Medical testing

Relating test accuracy to the chance of a condition given a result.

Independence checks

Testing whether two events are independent.

Probability coursework

Checking joint, union and conditional answers.

Common Probability of A Given B Mistakes to Avoid

  • P(A and B) can never exceed P(A) or P(B).
  • Independence means P(A | B) = P(A).
  • Mutually exclusive events with positive probability are never independent.

Probability of A Given B Terms and Definitions

Joint probability
The probability that both events occur.
Independent events
Events where knowing one occurred does not change the probability of the other.

Probability of A Given B FAQs

How do you calculate conditional probability?

Divide the probability that both occur by the probability of the condition: P(A | B) = P(A and B) ÷ P(B).

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

They condition on different events and usually differ. Bayes theorem converts one into the other.

How do I test whether two events are independent?

Check whether P(A and B) equals P(A) × P(B), or equivalently P(A | B) = P(A).

What if I only know P(B | A)?

Multiply by P(A) to get P(A and B), then divide by P(B) to get P(A | B).

Related calculators

Last updated 2026-11-09. See our disclaimer.