In probability theory, **the law of total probability** is a useful way to find the probability of some event *A* when we don’t directly know the probability of *A* but we do know that events *B*_{1}, *B*_{2}, *B*_{3}… form a partition of the sample space *S*.

This law states the following:

The Law of Total Probability

If

B_{1},B_{2},B_{3}… form a partition of the sample spaceS, then we can calculate the probability of eventAas:

P(

A) = ΣP(A|B_{i})*P(B_{i})

The easiest way to understand this law is with a simple example.

Suppose there are two bags in a box, which contain the following marbles:

**Bag 1:**7 red marbles and 3 green marbles**Bag 2:**2 red marbles and 8 green marbles

If we randomly select one of the bags and then randomly select one marble from that bag, what is the probability that it’s a green marble?

In this example, let P(*G*) = probability of choosing a green marble. This is the probability that we’re interested in, but we can’t compute it directly.

Instead we need to use the conditional probability of *G*, given some events *B* where the *B*_{i}‘s form a partition of the sample space *S*. In this example, we have the following conditional probabilities:

- P(G|B
_{1}) = 3/10 = 0.3 - P(G|B
_{2}) = 8/10 = 0.8

Thus, using the law of total probability we can calculate the probability of choosing a green marble as:

- P(G) = ΣP(G|B
_{i})*P(B_{i}) - P(G) = P(G|B
_{1})*P(B_{1}) + P(G|B_{2})*P(B_{2}) - P(G) = (0.3)*(0.5) + (0.8)*(0.5)
- P(G) =
**0.55**

If we randomly select one of the bags and then randomly select one marble from that bag, the probability we choose a green marble is **0.55**.

Read through the next two examples to solidify your understanding of the law of total probability.

**Example 1: Widgets**

Company A supplies 80% of widgets for a car shop and only 1% of their widgets turn out to be defective. Company B supplies the remaining 20% of widgets for the car shop and 3% of their widgets turn out to be defective.

If a customer randomly purchases a widget from the car shop, what is the probability that it will be defective?

If we let P(*D*) = the probability of a widget being defective and *P(B*_{i}) be the probability that the widget came from one of the companies, then we can compute the probability of buying a defective widget as:

- P(D) = ΣP(D|B
_{i})*P(B_{i}) - P(D) = P(D|B
_{1})*P(B_{1}) + P(D|B_{2})*P(B_{2}) - P(D) = (0.01)*(0.80) + (0.03)*(0.20)
- P(D) =
**0.014**

If we randomly buy a widget from this car shop, the probability that it will be defective is **0.014**.

**Example 2: Forests**

Forest A occupies 50% of the total land in a certain park and 20% of the plants in this forest are poisonous. Forest B occupies 30% of the total land and 40% of the plants in it are poisonous. Forest C occupies the remaining 20% of the land and 70% of the plants in it are poisonous.

If we randomly enter this park and pick a plant from the ground, what is the probability that it will be poisonous?

If we let P(*P*) = the probability of the plant being poisonous, and *P(B _{i})* be the probability that we’ve entered one of the three forests, then we can compute the probability of a randomly chosen plant being poisonous as:

- P(P) = ΣP(P|B
_{i})*P(B_{i}) - P(P) = P(P|B
_{1})*P(B_{1}) + P(P|B_{2})*P(B_{2}) + P(P|B_{3})*P(B_{3}) - P(P) = (0.20)*(0.50) + (0.40)*(0.30) + (0.70)*(0.20)
- P(P) =
**0.36**

If we randomly pick a plant from the ground, the probability that it will be poisonous is **0.36**.

**Additional Resources**

How to Find the Mean of a Probability Distribution

How to Find the Standard Deviation of a Probability Distribution

Probability Distribution Calculator