Skip to content

Probability Calculator: Two Events and Repeated Trials

P(A and B), P(A or B), conditional probability, complements and the chance of k successes in n trials.

Your details

Problem
%
%

Results update as you type

P(A and B) — both

20%

P(A or B) — at least one
70%
Exactly one of A, B
50%
A only (A and not B)
30%
B only (B and not A)
20%
Neither A nor B
30%
P(not A) — complement
50%
P(not B)
60%
P(A | B) — A given B
50%
P(B | A) — B given A
40%

Step-by-step solution
  1. P(A∩B) = P(A) × P(B) = 0.5 × 0.4 = 0.2
  2. P(A∪B) = P(A) + P(B) − P(A∩B) = 0.5 + 0.4 − 0.2 = 0.7
  3. P(A only) = P(A) − P(A∩B) = 0.3 ; P(B only) = 0.2
  4. P(neither) = 1 − P(A∪B) = 0.3
  5. P(A|B) = P(A∩B) / P(B) = 0.2 / 0.4 = 0.5
  6. P(B|A) = P(A∩B) / P(A) = 0.2 / 0.5 = 0.4

Most everyday probability questions come in two shapes. Either there are two events and you want the chance that both happen, that at least one happens, that neither does, or that one happens given the other; or the same experiment is repeated and you want the chance of at least one success, of exactly kk successes, or of at most kk.

This calculator handles both. In Two events mode, enter P(A)P(A) and P(B)P(B) as percentages and say how the events are related: independent (one does not affect the other, like two coin tosses), mutually exclusive (they cannot happen together, like rolling a 2 and a 5 on one die), or give P(A and B)P(A \text{ and } B) directly when you know it from a table. You get the intersection, the union, "A only", "exactly one", "neither", both complements and both conditional probabilities.

In Repeated trials mode, enter the probability of success pp, the number of trials nn and a number of successes kk. The calculator uses the exact binomial distribution — no normal approximation — even for a million trials, and draws the distribution around its mean.

How to use this calculator

  1. Choose Two events A and B or Repeated trials.
  2. Two events: type P(A)P(A) and P(B)P(B) in percent (50 for one half), then choose independent, mutually exclusive or "I know P(A and B)".
  3. Repeated trials: type the success probability pp of one trial, the number of trials nn and the number of successes kk you are interested in.
  4. Read the headline result, then the other probabilities. The steps show each rule that was applied.

Probabilities are shown in percent; divide by 100 for the decimal form used in most textbooks (40 % = 0.4).

The formula

Two events (OpenStax Introductory Statistics, ch. 3):

P(A∩B)=P(A) P(B) (independent)P(A∩B)=0 (mutually exclusive)P(A \cap B) = P(A)\,P(B) \ \text{(independent)} \qquad P(A \cap B) = 0 \ \text{(mutually exclusive)}
P(A∪B)=P(A)+P(B)−P(A∩B)P(A∣B)=P(A∩B)P(B)P(A \cup B) = P(A) + P(B) - P(A \cap B) \qquad P(A \mid B) = \frac{P(A \cap B)}{P(B)}
P(Aˉ)=1−P(A)P(neither)=1−P(A∪B)P(A only)=P(A)−P(A∩B)P(\bar A) = 1 - P(A) \qquad P(\text{neither}) = 1 - P(A \cup B) \qquad P(A \text{ only}) = P(A) - P(A \cap B)

Repeated independent trials with success probability pp (binomial distribution, ch. 4):

P(at least one)=1−(1−p)nP(X=k)=(nk)pk(1−p)n−kP(\text{at least one}) = 1 - (1 - p)^n \qquad P(X = k) = \binom{n}{k} p^k (1 - p)^{n - k}

"At most kk" adds P(X=i)P(X = i) for i=0i = 0 to kk, and "at least kk" is 1−P(X≤k−1)1 - P(X \le k - 1). The mean is npnp and the standard deviation np(1−p)\sqrt{np(1 - p)}. Cumulative sums are evaluated with the regularized incomplete beta function, which gives the exact binomial values without adding thousands of terms.

Worked example

Two independent events. P(A)=50%P(A) = 50\%, P(B)=40%P(B) = 40\%. Both: 0.5×0.4=0.5 \times 0.4 = 20%. At least one: 0.5+0.4−0.2=0.5 + 0.4 - 0.2 = 70%. A only: 30%; exactly one: 50%; neither: 30%.

Not independent: cards. Draw one card: AA = heart (13/52), BB = king (4/52), A∩BA \cap B = king of hearts (1/52). Then P(A∪B)=16/52=P(A \cup B) = 16/52 = 30.77% and P(heart∣king)=(1/52)/(4/52)=P(\text{heart} \mid \text{king}) = (1/52)/(4/52) = 25%.

At least one six in four rolls. 1−(5/6)4=0.51771 - (5/6)^4 = 0.5177, i.e. 51.77% — slightly better than even, the bet that puzzled the Chevalier de Méré.

Repeated trials. A part is defective with probability 10 %. In a batch of 10: at least one defective 1−0.910=0.65131 - 0.9^{10} = 0.6513 (65.13%); exactly two (102) 0.12 0.98=0.1937\binom{10}{2}\,0.1^2\,0.9^8 = 0.1937 (19.37%); at most two 92.98%.

Independent or mutually exclusive?

The two words are often confused, yet they are almost opposites. Independent events can happen together, and knowing that one happened does not change the chance of the other: P(A∣B)=P(A)P(A \mid B) = P(A). Mutually exclusive events never happen together, so if one happens the other is impossible: P(A∣B)=0P(A \mid B) = 0. Two events with non-zero probabilities cannot be both.

When neither description fits — a person who smokes and has a cough, a card that is a heart and a king — use "I know P(A and B)" and take the joint probability from a contingency table or survey data. The calculator checks that the value is possible: it can be no larger than the smaller of P(A)P(A) and P(B)P(B), and no smaller than P(A)+P(B)−100%P(A) + P(B) - 100\%.

The "at least one" trap

Adding probabilities across repeated trials is a classic mistake: with a 10 % chance each time, ten attempts do not give 100 %, but 65.13%. The reliable route is the complement — work out the probability that nothing happens, (1−p)n(1 - p)^n, and subtract it from 1. The same reasoning explains why rare risks become likely over many repetitions, and why the number of tries needed for a 95 % chance of at least one success is ln⁡(0.05)/ln⁡(1−p)\ln(0.05) / \ln(1 - p).

For counting arrangements behind such probabilities, see the combination calculator; for dice sums, the dice probability calculator.

Frequently asked questions

How do I calculate the probability of A and B?

For independent events multiply: P(A) × P(B). For mutually exclusive events it is 0. Otherwise you need the joint probability, or P(A) × P(B | A).

How do I calculate the probability of A or B?

Add the two probabilities and subtract the overlap: P(A) + P(B) − P(A and B). The subtraction stops outcomes in both events from being counted twice.

What is conditional probability?

P(A | B) is the probability of A once you know B has happened: the overlap divided by P(B). For independent events it equals P(A).

How do I find the probability of at least one success?

Compute the probability of no success, (1 − p) to the power n, and subtract it from 1. With p = 10 % and n = 10 this gives about 65.13 %.

Is the binomial result exact for large n?

Yes. The calculator uses the exact binomial formula and the incomplete beta function for cumulative probabilities, not the normal approximation, up to one million trials.

Sources

Last updated:

More Statistics calculators

People also use