Commonly sets interact. At this party, two sets are being combined, though it might turn out that there are some friends that were in both sets.

Union, Interection, and Complement

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

The union is notated (A cup B)

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

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

The intersection is notated (A cap B)

More formally, (x in A cap B) if (x in A) and (x in B)

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

The complement is notated (A), or (A^{c}), or sometimes (sim A).

Example 5

Consider the sets:

(quad A={ ext { red, green, blue }} quad B={ ext { red, yellow, orange }} quad C={ ext { red, orange, yellow, green, blue, purple }})

- Find (A cup B)
- Find (A cap B)
- Find (A^{c} cap C)

**Solution**

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

Notice we only list red once.

b) The intersection contains all the elements in both sets: (A cap B={ ext { red }})

c) Here we're looking for all the elements that are not in set (A) and are also in (C).

(A^{c} cap C={ ext { orange, yellow, purple }})

Try it Now 2

Using the sets from the previous example, find (A cup C) and (B^{c} cap A)

**Answer**(A cup C={ ext { red, orange, yellow, green, blue purple }})

(B^{c} cap A={ ext { green, blue }})

Notice that in the example above, it would be hard to just ask for (A^{c},) 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 (A^{C}) contains all the elements in the universal set that are not in (A).

Example 6

- If we were discussing searching for books, the universal set might be all the books in the library.
- If we were grouping your Facebook friends, the universal set would be all your Facebook friends.
- 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

(A^{c}={3,5,6,7,8,9})

As we saw earlier with the expression (A^{c} cap 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={ ext { cat, dog, rabbit, mouse }}, F={ ext { dog, cow, duck, pig, rabbit }} quad W={ ext { duck, rabbit, deer, frog, mouse }})

- Find ((H cap P) cup W)
- Find (H cap(F cup W))
- Find ((H cap P) cap W)

**Solution**

a) We start with the intersection: (H cap F={ ext { dog, rabbit }})

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

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

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

c) We start with the intersection: (H cap F={mathrm{dog}, ext { rabbit }})

Now we want to find the elements of (W) that are not in (mathrm{H} cap F)

((H cap P)^{c} cap W={ ext { duck, deer, frog, mouse }})