# Understanding Set Operations

What is so special about a coin or a deck of cards that we use them for statistics and probability so much? Well, it’s that we can write them both out as sets. Most of the time, we use sets do describe groups of things (called elements) whatever they are such as numbers, letters, suits of cards, anything.

We can even manipulate sets so that they describe things in common, not in common, or even take one set out of another. These manipulations are called set operations. A set operation is a mathematical or logical manipulation of two or more sets. There are a few set operations that are pivotal to using and understanding set theory.

## The Overlap of Sets

For the sake of this post, we are going to use two sets, A and B. Set A contains the numbers 1, 2, 3, 4, 5, and 6, while set B contains the numbers 2, 4, 6, 8, and 10. In set notation, we would write it as
A = {1, 2, 3, 4, 5, 6} and B = {2, 4, 6, 8, 10}.

### Union

When we look at sets A and B, we notice that they both have some things in common but they also have some things that are different. We can describe both of them as one set through union. The union of two sets is considering all the elements of both sets. It is represented by ∪.

So, A ∪ B = {1, 2, 3, 4, 5, 6, 8, 10}

Since 2, 4, and 6 occur in both sets, we do not need to include them twice. Look at this diagram for an example ### Intersect

Of course, there are times when you are only concerned with the values that both sets have in common. This is called an instersect. An intersect is signified by the symbol ∩. When considering the sets A and B, we would say A ∩ B = {2, 4, 6}. Take a look at the diagram below Intersects are most common with probability calculations like conditional probability. You can think of intersects as the word and in logic. Intersect looks for elements that are in both A and B.

## The Math of Sets

Given that sets involve mathematical logic, it makes sense that we can use math problem solving (like the distributive law) to define our understanding of elements or events that occur in one or more sets. For example, there is the subtraction of sets and the complement of sets.

### Subtraction

Subtraction of sets is when elements are removed from an overlap of sets and one set is removed from the other. The subtraction of sets is basically when one set, including the intersect, is removed from the union of two (or more) sets. For example

A – B = {1, 2, 3, 4, 5, 6} – {2, 4, 6, 8, 10} = {1, 3, 5}

You can see that all the elements of B are removed including the ones that A and B share. Note that A – B is NOT equal to B – A. See the diagram below ### Complement

A and B are nice sets is a compliment. A complement is everything in the universal set that is not in the set itself. Just so you know, the universal set is every element that is under consideration, including the set of interest. In statistical terms, the universal set would be the population and the set would be the sample.

The complement is notated as A’ or Ac. So let’s take a look at a universal set, S, and complements. And its complement ## The Takeaways?

These are the basic set operations that are used in proofs and other set theory laws like De Morgan’s Laws. In addition to a few other topics in set theory, union, intersect, subtraction, and complement sets are considered the essential set theory operations. If you have any questions, let me know! Happy statistics!