We use De Morgan’s Law to enumerate sets.

We begin by counting the number of elements in the union of two sets.

Proof
Let . Then is in or both.
Case 1. ( is in both) If is in both and , then the right hand side of the formula accounts for twice, once as an element of and again as an element of . But then, since is in both and , is in their intersection, . The coefficient of being , is “de-accounted” for once in the right hand side of the formula. In total, is accounted for twice and de-accounted for once, thereby accounting for it just once in total.
Case 2. ( is in only) If but , then the right hand side of the formula accounts for such exactly once, as a member of . Note that such an is not a member of and so it is not de-accounted for by the right hand side of the formula.
Case 3. ( is in only) This is the same as case 2 with the roles of and reversed.
Finally, we need to be sure that the right hand side of the formula does not count elements that are not in .
Case 4. ( is in neither nor ) In this case, none of the terms on the right hand side of the formula will either account for or de-account for (since either).
(problem 1) How many numbers from the given set are multiples of the given numbers and ?
a)
b)
c)
d)

Recall set complements from section 1.2:

De Morgan’s Law gives us a formula for the complement of a union in terms of the intersection of their complements.

Proof
First, let . Then which implies that and . By definition of complement, this means that and . Finally, by definition of intersection, . Thus .
Next, let . By definition of intersection, and . Then, and which implies that . Thus and we have shown that .
By virtue of being subsets of each other, the two sets are equal and De Morgan’s Law is proved.

The next example uses De Morgan’s Law in conjunction with the Rule for Complements and the Inclusion-Exclusion Principle (for two sets).

(problem 2) Computer passwords are eight characters long where a character can be either an upper case letter, lower case letter, digit 0-9, or one of 8 special symbols. How many passwords are possible if a password must contain:
a) at least one digit and at least one upper case letter?
b) at least one special symbol and at least one lower case letter?
c) at least one letter?
(problem 3) How many permutations are there of the letters in the phrase DOGS RULE in which neither the word DOGS nor the word RULE appears?
(problem 4) How many permutations are there of the letters in the word ABCDEF in which the letter A is not first and the letter F is not last?
(problem 5) How many non-negative integer solutions are there to the equation if and