## Learning mode > Inclusion-exclusion principle (Difficulty: Easy)

Question: In a city, 2802500 people speak German or Portuguese. If 69% speak (at least) German and 57% (at least) Portuguese, how many speak both languages?

Help (How do I enter my solution?)

#### Inclusion-exclusion principle

Rule of sum applies to disjoint sets.

The inclusion-exclusion principle can be used as rule of sum for determining the summation of any N sets regardless of being disjoint or non-disjoint. Size of the union of N disjoint or non-disjoint sets can be determined by summing up sizes of each set, minus sizes of the N times pairwise intersections, plus sizes of the N-1 times intersections between every three sets, minus sizes of the N-2 times intersections of each four sets, and so on. In case of having only two sets, the size of the union of two sets is equal to the summation of size of each set, minus the sizes of the intersections because they are counted two times. For the case of three sets there are three pairwise intersections that we remove, this is why the size of the intersection of the three sets should be added again, as shown below. The same concept can be extended for any N disjoint or non-disjoint sets.

Two sets
|A ∪ B| = |A| + |B| - |A ∩ B|
|A ∩ B| = |A| + |B| - |A ∪ B|

Three sets
|A ∪ B ∪ C| = |A| + |B| + |C| - |A ∩ B| - |A ∩ C| - |B ∩ C| + |A ∩ B ∩ C|
|A ∩ B ∩ C| = |A ∪ B ∪ C| - |A| - |B| - |C| + |A ∩ B| + |A ∩ C| + |B ∩ C|

(The lower formula in each case results from reformulating the upper formula)