A factory takes 60 percent of its items from source A and 40 percent from source B, and an item is faulty with probability if it comes from A and if it comes from B. What is the overall probability that an item is faulty? The plain average of the two rates is , but source A supplies more of the items, so its rate should count for more. The law of total probability says exactly how to combine rates measured inside separate groups into one overall probability. This lesson states the law, explains why each rate is weighted by the probability of its group, and shows how to handle a group of probability zero.
Key terms
Partition
Definition Events form a partition of the sample space if each is nonempty and the events are pairwise disjoint, for , and exhaustive, . Every outcome then lies in exactly one of the groups. For any event , the pieces are disjoint and their union is .
In plain words A partition gives every item exactly one label. No item is left out, and no item gets two labels.
Example In the factory model let be the event that an item comes from source A and the event that it comes from source B. These two events form a partition, because every item has exactly one source. Labels such as tagged and priority fail to form a partition if some item is both or neither. The four combinations , , and are disjoint and cover every item, so the nonempty ones among them form a partition.
Group weight
Definition The weight of a group in a partition is its probability . The weights are nonnegative, and because the groups are disjoint and their union is , additivity gives
In plain words A group weight says how often a randomly selected outcome falls in that group. The weights split the total probability among the groups.
Example In the factory model the weights are and , and . A different supply contract might change them to and , which still add to .
Conditional rate
Definition For a target event and a group with , the conditional rate of in that group is
It is a probability measured with as the reference group. Rates of different groups refer to different reference groups, so they need not add to . The rate differs from the joint probability unless or .
In plain words A conditional rate says how often the event happens among the items of one group. The weight says how large the group is, and the rate says what happens inside it.
Example Let be the event that an item is faulty. The model gives and . These rates add to , which is no contradiction, since they describe different groups. The joint probability that an item is faulty and from source A is , smaller than the rate because only 60 percent of the items come from A.
Law of total probability
Definition Let be a partition of and let be any event. Because the pieces are disjoint with union ,
By the multiplication rule, each group with contributes . So when every group has positive probability,
The same law holds for a partition into countably many events.
In plain words Split the event by group, find each group’s share of it as weight times rate, and add the shares. In a two-stage probability tree that first picks the group and then decides the event, this is the sum over the paths that end in the event.
Example For the factory,
A constructed population of 10,000 items that matches the model exactly has 6,000 items from A, of which 120 are faulty, and 4,000 from B, of which 200 are faulty. Then 320 of the 10,000 items are faulty, a share of . These counts only illustrate the model. They are not measured data, and a random batch of that size need not have exactly these counts.
Weighted average
Definition If and , the number is a weighted average of . It lies between the smallest and the largest that carry positive weight. The law of total probability writes as a weighted average of the conditional rates of the groups with positive weight, with the group weights as the weights. The plain average of the rates is the special case of equal weights.
In plain words A large group pulls the overall probability toward its own rate. The overall answer lands between the lowest and the highest rate among groups with positive weight, which gives a quick check on any calculation.
Example The plain average of and is , but the weights and give . If the mix changes to from A and from B, with the same rates,
Both and lie between and . Moving weight to the source with the higher fault rate raised the overall probability, although neither rate changed.
Zero-weight group
Definition A group of a partition with is a zero-weight group. Its joint contribution is , since , so it can be left out of the sum. With the set of indices for which , the law reads
The rate is not defined by the ratio formula, since it would divide by zero. So the sum should not contain a term like , which multiplies zero by an undefined quantity.
In plain words A group with probability zero contributes nothing to the total, and the ratio formula gives it no rate. Drop it, or keep its joint contribution of , but do not invent a rate for it.
Example Suppose the supplier list also names a third source C with weight , while and as before. The events , and still form a partition. The three joint pieces are , and , so as before. No fault rate for source C enters the calculation, and the model does not define one.
Check yourself
- A request goes to the main server with probability and to the backup server with probability . A timeout happens with probability for the main server and for the backup. Find the probability of a timeout and the probability of no timeout.
Show the answer
Let and be the events that the request goes to the main and to the backup server, and the event of a timeout. Each request goes to exactly one server, so and form a partition and
The probability of no timeout is the complement, . As a check, lies between the two rates and .
- A colleague reports a timeout probability of for the routing in question 1, found by averaging and . For which routing would that number be correct, and why is it wrong here?
Show the answer
The plain average is the weighted average with equal weights. With routing and ,
With two groups and different rates, this is the only routing that gives . If a share goes to the main server, then , and this equals only for . In question 1 the main server, which has the lower rate, receives most of the requests, so it pulls the overall probability down to .
- In a model warehouse, 40 percent of parcels are fragile and 30 percent are oversized. Fragile parcels are damaged with probability and oversized parcels with probability . A clerk computes as the overall probability of damage. Why is this not the law of total probability, and what would the law need?
Show the answer
The groups “fragile” and “oversized” do not form a partition. Their weights add to , not , so at least 30 percent of parcels belong to neither group, and their damage is left out entirely. If some parcels are both fragile and oversized, those parcels also enter both terms.
The law needs disjoint, exhaustive groups, the weight of each group and the damage rate of each group with positive weight. One option is the nonempty combinations of fragile or not and oversized or not. Another is a single classification, such as fragile versus not fragile. The given numbers do not determine the answer.