Rule of Sum and the Inclusion-Exclusion Principle
If there are ways of getting a result and ways to get a result , then the number of ways of getting or is , as long as the results and do not overlap.[more]
To get the right number when there is overlap, think of the possible results and as sets. Then the number of ways to get an element from or is . This is called the principle of inclusion-exclusion.[less]
The sum rule generalizes when there are more than two kinds of results, giving
as long as all the pairwise intersections
, , ,
If there are overlaps, the right-hand side of the formula is an alternating sum. For example, here is the formula for three sets:
 Wikipedia. "Rule of Sum." (Jun 4, 2018) en.wikipedia.org/wiki/Rule_of_sum.