Sub topic 12
De Morgan's Laws
De Morgan's laws tell you how to take the complement of a union or an intersection. In CAT problems they turn phrases like "not A or B" and "not both" into counts you can compute. This chapter assumes you know union, intersection, complement, the universal set, and the two-set formula n(A∪B) = n(A) + n(B) − n(A∩B).
The two laws
Let U be the universal set. Write A' for the complement of A, which is U − A.
- Law 1: (A ∪ B)' = A' ∩ B'
- Law 2: (A ∩ B)' = A' ∪ B'
In words:
- Law 1: Being outside the union means being outside A and outside B. "Neither A nor B" is the same as "not A and not B".
- Law 2: Being outside the intersection means failing at least one membership. "Not in both" is the same as "not in A or not in B".
The rule to remember is that the complement flips the operation: ∪ becomes ∩ and ∩ becomes ∪. The complement also applies to each set inside the brackets.
Why the laws hold
You can check each law with a membership argument for a single element x.
- x is in (A ∪ B)' exactly when x is not in A ∪ B.
- x is not in A ∪ B exactly when x is not in A and x is not in B.
- That is the same as x being in A' and in A'∩B'... more simply, x being in both A' and B', so x is in A' ∩ B'.
Law 2 follows the same way. x is not in A ∩ B exactly when x fails to be in A or fails to be in B, so x is in A' ∪ B'.
You can also see Law 1 on a two-set Venn diagram. The region outside both circles is the "neither" region. The region outside circle A overlaps the region outside circle B in exactly that area.
Checking the laws in code
Python's set operations let you test both laws on a small universe.
U = set(range(1, 21))
A = {n for n in U if n % 2 == 0} # even numbers
B = {n for n in U if n % 3 == 0} # multiples of 3
def comp(S):
return U - S
print(comp(A | B) == comp(A) & comp(B)) # True
print(comp(A & B) == comp(A) | comp(B)) # True
print(len(comp(A | B))) # 7 (neither even nor a multiple of 3)
print(len(comp(A & B))) # 17 (not a multiple of 6)Here A has 10 elements, B has 6, and A ∩ B is the multiples of 6: {6, 12, 18}. The union has 10 + 6 − 3 = 13 elements, so "neither" has 20 − 13 = 7 and "not both" has 20 − 3 = 17.
The laws as counting tools
Taking sizes of the two laws gives counting identities. Let N be the size of U.
- n((A ∪ B)') = N − n(A ∪ B). This is the "neither" count.
- n((A ∩ B)') = N − n(A ∩ B). This is the "not both" count.
Many students confuse these two, so keep them apart:
| Phrase in the problem | Set expression | Count |
|---|---|---|
| Neither A nor B | (A ∪ B)' = A' ∩ B' | N − n(A ∪ B) |
| Not both A and B | (A ∩ B)' = A' ∪ B' | N − n(A ∩ B) |
| At least one of A, B | A ∪ B | n(A) + n(B) − n(A ∩ B) |
| Both A and B | A ∩ B | n(A) + n(B) − n(A ∪ B) |
| At most one of A, B | (A ∩ B)' | N − n(A ∩ B) |
| Not A | A' | N − n(A) |
"At most one" and "not both" describe the same group. This group includes people who are in neither set.
Worked example: two sets
A survey of 200 customers finds that 120 own a car, 90 own a bike, and 40 own both.
- Find the union: 120 + 90 − 40 = 170.
- Neither car nor bike: (A ∪ B)' has 200 − 170 = 30 customers.
- Not both: (A ∩ B)' has 200 − 40 = 160 customers.
Now check Law 2 by counting each side separately. A' has 200 − 120 = 80 customers. B' has 200 − 90 = 110 customers. A' ∩ B' is the "neither" group, 30. The union A' ∪ B' has 80 + 110 − 30 = 160 customers, which matches the "not both" count.
total = 200
n_a, n_b, both = 120, 90, 40
union = n_a + n_b - both # 170
neither = total - union # 30
not_both = total - both # 160
# Law 2 check using complements of each set
n_a_c, n_b_c = total - n_a, total - n_b # 80, 110
via_law = n_a_c + n_b_c - neither # 160
print(union, neither, not_both, via_law) # 170 30 160 160The matching totals confirm that the counts are consistent. This is a useful sanity check on an exam, because the two routes use different arithmetic.
Extending to three sets
The laws extend to any number of sets, with the same flip of operation.
- (A ∪ B ∪ C)' = A' ∩ B' ∩ C'. This is "none of the three".
- (A ∩ B ∩ C)' = A' ∪ B' ∪ C'. This is "not all three", meaning at least one is missing.
Take the three-set data from the inclusion-exclusion chapter: n(A) = 30, n(B) = 25, n(C) = 20, pairwise overlaps 10, 8 and 6, and n(A∩B∩C) = 4. The union is 55. Suppose the universe has 80 elements.
- None of the three: 80 − 55 = 25.
- Not all three: 80 − 4 = 76.
- Exactly three: 4.
total = 80
n_a, n_b, n_c = 30, 25, 20
n_ab, n_bc, n_ac, n_abc = 10, 8, 6, 4
union = n_a + n_b + n_c - (n_ab + n_bc + n_ac) + n_abc # 55
none_of_three = total - union # 25
not_all_three = total - n_abc # 76
print(union, none_of_three, not_all_three) # 55 25 76Note that "not all three" includes the 25 people in none of the sets, the 39 in exactly one and the 12 in exactly two. These add up: 25 + 39 + 12 = 76.
Using the laws on percentage and range problems
De Morgan's laws combine well with minimum and maximum overlap questions. Suppose 70% of employees like tea and 60% like coffee. What is the range of the percentage who like neither?
- The union is at most 100%. It reaches 100% when the overlap is at least 30%, because 70 + 60 − 100 = 30.
- The union is at least 70%. This happens when the coffee drinkers are all inside the tea drinkers.
- Neither = 100% − union, so neither ranges from 0% to 30%.
To make "neither" as large as possible, you make the union as small as possible, which means maximizing the overlap. Applying the complement reverses the direction of the optimization.
Common errors
- Not flipping the operation. Writing (A ∪ B)' = A' ∪ B' is the most common mistake. The correct form is A' ∩ B'.
- Complementing only one set. (A ∪ B)' is not A' ∪ B. Each set inside the bracket needs its own complement.
- Mixing up "neither" and "not both". The first removes the whole union. The second removes only the overlap.
- Forgetting the universe. A complement is meaningful only relative to U. If the problem says "out of 200 customers", then N = 200, even if only some customers are mentioned elsewhere.
- Reading "not A or B" ambiguously. English can mean (A ∪ B)' or A' ∪ B. In CAT problems the intended reading is usually clear from context. When it is not, rewrite the phrase with brackets before you compute.
Exercises
Exercise
In a group of 150 students, 90 play cricket, 70 play football and 30 play both. How many students play neither, and how many do not play both sports?
Show answer
The union is 90 + 70 − 30 = 130, so neither = 150 − 130 = 20. Not both = 150 − 30 = 120.
Exercise
Using De Morgan's laws, rewrite "(A' ∪ B)'" without brackets around a union or intersection of complements.
Show answer
Apply Law 2 with the sets A' and B: (A' ∪ B)' = (A')' ∩ B' = A ∩ B'. Applying the union form of the law gives the elements that are in A but not in B.
Exercise
Of 500 people, 300 read newspaper P, 250 read newspaper Q, and 100 read both. Using Law 1, find how many read neither, by counting A' and B' and their overlap.
Show answer
The union is 300 + 250 − 100 = 450, so neither = 500 − 450 = 50. Check: A' = 200 and B' = 250. Since A' ∩ B' = 50, A' ∪ B' = 200 + 250 − 50 = 400, which equals 500 − 100 = 400, the "not both" count. The consistent totals confirm the answer.
Exercise
In a class of 60, 35 like maths, 30 like science and 20 like history. 10 like maths and science, 8 like science and history, 6 like maths and history, and 3 like all three. How many students do not like all three subjects, and how many like none?
Show answer
Union = 35 + 30 + 20 − (10 + 8 + 6) + 3 = 64. This exceeds the class size of 60, so the data are inconsistent. A union cannot be larger than the universe. The problem as stated has no valid answer.