acalculator

What is the probability of A and B?

Enter the probabilities of two events to see the chance that both happen, either happens, exactly one happens, or neither does.

Your numbers

A and B are
P(A and B)
0.2

With P(A) = 0.5 and P(B) = 0.4, P(A and B) is 0.2 and P(A or B) is 0.7.

P(A or B)
0.7
P(exactly one)
0.5
P(neither)
0.3
P(not A)
0.5
P(not B)
0.6
P(A given B)
0.5
P(B given A)
0.4

P(A and B): 0.2. With P(A) = 0.5 and P(B) = 0.4, P(A and B) is 0.2 and P(A or B) is 0.7.

How to calculate

Computes the probability of two events both happening, either happening, exactly one, or neither, and the conditional probabilities, from P(A) and P(B).

Example with the default inputs (P(A) 0.5, P(B) 0.4, A and B are Independent): With P(A) = 0.5 and P(B) = 0.4, P(A and B) is 0.2 and P(A or B) is 0.7.

Method: P(A and B) = P(A) × P(B) for independent events, 0 for mutually exclusive events; P(A or B) = P(A) + P(B) − P(A and B); P(neither) = 1 − P(A or B); P(A given B) = P(A and B) ÷ P(B).

  • Probabilities are decimals from 0 to 1 (0.25 means a 25% chance).
  • The arithmetic is exact on the decimals you type, then rounded once for display.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. P(A) 0.5, P(B) 0.4, A and B are Independent gives P(A and B) 0.2, P(A or B) 0.7, P(exactly one) 0.5, P(neither) 0.3, P(not A) 0.5, P(not B) 0.6, P(A given B) 0.5, P(B given A) 0.4.Source: OpenStax, Introductory Statistics 2e, §3.3 Two Basic Rules of Probability. https://openstax.org/books/introductory-statistics-2e/pages/3-3-two-basic-rules-of-probability
  2. P(A) 0.3, P(B) 0.45, A and B are Mutually exclusive gives P(A and B) 0, P(A or B) 0.75, P(exactly one) 0.75, P(neither) 0.25, P(A given B) 0.Source: OpenStax, Introductory Statistics 2e, §3.2 Independent and Mutually Exclusive Events. https://openstax.org/books/introductory-statistics-2e/pages/3-2-independent-and-mutually-exclusive-events
  3. P(A) 0.4, P(B) 0.5, A and B are I know P(A and B), P(A and B) 0.2 gives P(A or B) 0.7, P(A given B) 0.4, P(B given A) 0.5.Source: OpenStax, Introductory Statistics 2e, §3.3 Two Basic Rules of Probability. https://openstax.org/books/introductory-statistics-2e/pages/3-3-two-basic-rules-of-probability
  4. P(A) 0.1, P(B) 0.2, A and B are Independent gives P(A and B) 0.02, P(A or B) 0.28, P(neither) 0.72.Source: OpenStax, Introductory Statistics 2e, §3.3 Two Basic Rules of Probability. https://openstax.org/books/introductory-statistics-2e/pages/3-3-two-basic-rules-of-probability

How it works

Enter P(A) and P(B), and say how the events are related:

  • Independent: P(A and B) = P(A) × P(B).
  • Mutually exclusive: P(A and B) = 0. P(A) + P(B) must be at most 1.
  • I know P(A and B): you enter P(A and B). It must be at most the smaller of P(A) and P(B), and at least P(A) + P(B) − 1.

Then, with P(A and B) known:

  • P(A or B) = P(A) + P(B) − P(A and B) (the addition rule).
  • P(exactly one) = P(A or B) − P(A and B).
  • P(neither) = 1 − P(A or B).
  • P(not A) = 1 − P(A), and P(not B) = 1 − P(B).
  • P(A given B) = P(A and B) ÷ P(B), shown only when P(B) is above 0.
  • P(B given A) = P(A and B) ÷ P(A), shown only when P(A) is above 0.

Rules

  • Every probability is a decimal from 0 to 1.
  • Mutually exclusive events with P(A) + P(B) above 1 have no answer.
  • A known P(A and B) above P(A) or above P(B), or below P(A) + P(B) − 1, has no answer.
  • The arithmetic is exact on the decimals as typed (0.1 is exactly one tenth), and each result is rounded once to the nearest 64-bit float. So 0.1 and 0.2 give P(A or B) = 0.28 exactly.
  • Results show up to 6 decimal places (6 significant digits below 0.0001), with halves rounded up.

Worked examples by hand

Independent, P(A) = 0.5, P(B) = 0.4. P(A and B) = 0.5 × 0.4 = 0.2. P(A or B) = 0.5 + 0.4 − 0.2 = 0.7. Exactly one: 0.7 − 0.2 = 0.5. Neither: 1 − 0.7 = 0.3. Not A: 0.5; not B: 0.6. A given B: 0.2 ÷ 0.4 = 0.5; B given A: 0.2 ÷ 0.5 = 0.4.

Mutually exclusive, P(A) = 0.3, P(B) = 0.45. P(A and B) = 0. P(A or B) = 0.3 + 0.45 = 0.75, all of it exactly one event. Neither: 0.25. A given B: 0 ÷ 0.45 = 0.

Known overlap, P(A) = 0.4, P(B) = 0.5, P(A and B) = 0.2. P(A or B) = 0.4 + 0.5 − 0.2 = 0.7. A given B: 0.2 ÷ 0.5 = 0.4; B given A: 0.2 ÷ 0.4 = 0.5.

Independent, P(A) = 0.1, P(B) = 0.2. P(A and B) = 0.02. P(A or B) = 0.1 + 0.2 − 0.02 = 0.28. Neither: 0.72.

Other questions people ask

How do I find the probability of A and B?

For independent events, multiply: P(A and B) = P(A) × P(B). A fair coin landing heads (0.5) and a die showing a six (1/6) together have probability 0.5 × 1/6 = 1/12, about 0.083. For events that are not independent you need P(A and B) itself, or a conditional probability.

How do I find the probability of A or B?

Add the two probabilities and subtract the overlap, so it is not counted twice: P(A or B) = P(A) + P(B) − P(A and B). With P(A) = 0.5, P(B) = 0.4 and independent events, P(A or B) = 0.5 + 0.4 − 0.2 = 0.7.

What is the difference between independent and mutually exclusive events?

Independent events do not affect each other: knowing that A happened leaves the chance of B unchanged. Mutually exclusive events cannot happen together, so P(A and B) = 0. Two events that each have a probability above 0 cannot be both independent and mutually exclusive, because if one happens the other becomes impossible.

What is conditional probability?

P(A given B) is the chance of A once you know B happened: P(A and B) ÷ P(B). If 20% of people both drink coffee and tea and 50% drink tea, then P(coffee given tea) = 0.2 ÷ 0.5 = 0.4.

What is the probability that an event does not happen?

Subtract its probability from 1: P(not A) = 1 − P(A). A 0.3 chance of rain is a 0.7 chance of no rain.

How do I find the chance of something happening at least once in several tries?

For independent tries with the same chance p, the chance of at least one success in n tries is 1 − (1 − p)ⁿ. With p = 0.1 and 10 tries it is 1 − 0.9¹⁰ ≈ 0.651. The binomial distribution calculator gives this as P(X ≥ 1).

Can I enter a percentage?

Enter probabilities as decimals from 0 to 1: 25% is 0.25. The results are decimals too, so you can type any result back in as an input.