## Union, Intersection, and Complement

Commonly sets interact. For example, you and a new roommate decide to have a house party, and you both invite your circle of friends. At this party, two sets are being combined, though it might turn out that there are some friends that were in both sets.

### Union, Intersection, and Complement

The union of two sets contains all the elements contained in either set (or both sets).

The union is notated A B.

More formally, x A B if x A or x B (or both)

The intersection of two sets contains only the elements that are in both sets.

The intersection is notated A B.

More formally, x A B if x A and x B

The complement of a set A contains everything that is not in the set A.

The complement is notated A’, or Ac, or sometimes ~A.

### Example 5

Consider the sets:       A = {red, green, blue}             B = {red, yellow, orange}

C = {red, orange, yellow, green, blue, purple}

a) Find A B

The union contains all the elements in either set: A B = {red, green, blue, yellow, orange}

Notice we only list red once.

b) Find A B

The intersection contains all the elements in both sets: A B = {red}

c) Find Ac C

Here we’re looking for all the elements that are not in set A and are also in C.

Ac C = {orange, yellow, purple}

### Try it Now 2

Using the sets from the previous example, find A C and Bc A

Notice that in the example above, it would be hard to just ask for Ac, since everything from the color fuchsia to puppies and peanut butter are included in the complement of the set. For this reason, complements are usually only used with intersections, or when we have a universal set in place.

### Universal Set

A universal set is a set that contains all the elements we are interested in. This would have to be defined by the context.

A complement is relative to the universal set, so Ac contains all the elements in the universal set that are not in A.

### Example 6

a)     If we were discussing searching for books, the universal set might be all the books in the library.

c)     If you were working with sets of numbers, the universal set might be all whole numbers, all integers, or all real numbers

### Example 7

Suppose the universal set is U = all whole numbers from 1 to 9. If A = {1, 2, 4}, then

Ac = {3, 5, 6, 7, 8, 9}.

As we saw earlier with the expression Ac C, set operations can be grouped together. Grouping symbols can be used like they are with arithmetic – to force an order of operations.

### Example 8

Suppose H = {cat, dog, rabbit, mouse}, F = {dog, cow, duck, pig, rabbit}

W = {duck, rabbit, deer, frog, mouse}

a) Find (H F) ⋃ W

Now we union that result with W: (H F) ⋃ W = {dog, duck, rabbit, deer, frog, mouse}

b) Find H ⋂ (F W)

We start with the union: F W = {dog, cow, rabbit, duck, pig, deer, frog, mouse}

Now we intersect that result with H: H ⋂ (F W) = {dog, rabbit, mouse}

c) Find (H F)c W