What Is the Difference of Two Sets in Set Theory?

Illustration of the difference of sets with a Venn diagram
The red region of the Venn diagram denotes the set A - B. C.K.Taylor

The difference of two sets, written A - B is the set of all elements of A that are not elements of B. The difference operation, along with union and intersection, is an important and fundamental set theory operation.

Description of the Difference

The subtraction of one number from another can be thought of in many different ways. One model to help with understanding this concept is called the takeaway model of subtraction.

In this, the problem 5 - 2 = 3 would be demonstrated by starting with five objects, removing two of them and counting that there were three remaining. In a similar way that we find the difference of two numbers, we can find the difference of two sets.

An Example

We will look at an example of the set difference.  To see how the difference of two sets forms a new set, let's consider the sets A = {1, 2, 3, 4, 5} and B = {3, 4, 5, 6, 7, 8}. To find the difference A - B of these two sets, we begin by writing all of the elements of A, and then take away every element of A that is also an element of B. Since A shares the elements 3, 4 and 5 with B, this gives us the set difference A - B = {1, 2}.

Order Is Important

Just as the differences 4 - 7 and 7 - 4 give us different answers, we need to be careful about the order in which we compute the set difference. To use a technical term from mathematics, we would say that the set operation of difference is not commutative.

What this means is that in general we cannot change the order of the difference of two sets and expect the same result. We can more precisely state that for all sets A and B, A - B is not equal to B - A.

To see this, refer back to the example above. We calculated that for the sets A = {1, 2, 3, 4, 5} and B = {3, 4, 5, 6, 7, 8}, the difference A - B = {1, 2 }.

To compare this to B - A, we begin with the elements of B, which are 3, 4, 5, 6, 7, 8, and then remove the 3, the 4 and the 5 because these are in common with A. The result is B - A = {6, 7, 8 }.  This example clearly shows us that A - B is not equal to B - A.

The Complement

One sort of difference is important enough to warrant its own special name and symbol. This is called the complement, and it is used for the set difference when the first set is the universal set. The complement of A is given by the expression U - A. This refers to the set of all elements in the universal set that are not elements of A. Since it is understood that the set of elements that we can choose from are taken from the universal set, we can simply say that the complement of A is the set comprised of element that is not elements of A.

The complement of a set is relative to the universal set that we are working with. With A = {1, 2, 3} and U = {1, 2 ,3, 4, 5}, the complement of A is {4, 5}. If our universal set is different, say U = {-3, -2, 0, 1, 2, 3 }, then the complement of A {-3, -2, -1, 0}. Always be sure to pay attention to what universal set is being used.

Notation for the Complement

The word "complement" starts with the letter C, and so this is used in the notation.

The complement of the set A is written as AC. So we can express the definition of the complement in symbols as: AC = U - A.

Another way that is commonly used to denote the complement of a set involves an apostrophe, and is written as A'.

Other Identities Involving the Difference and Complements

There are many set identities that involve the use of the difference and complement operations. Some identities combine other set operations such as the intersection and union. A few of the more important are stated below. For all sets A, and B and D we have:

  • A - A =∅
  • A - ∅ = A
  • ∅ - A = ∅
  • A - U = ∅
  • (AC)C = A
  • DeMorgan’s Law I: (AB)C = ACBC
  • DeMorgan’s Law II: (AB)C = ACBC
Format
mla apa chicago
Your Citation
Taylor, Courtney. "What Is the Difference of Two Sets in Set Theory?" ThoughtCo, Jun. 7, 2017, thoughtco.com/difference-of-two-sets-3126580. Taylor, Courtney. (2017, June 7). What Is the Difference of Two Sets in Set Theory? Retrieved from https://www.thoughtco.com/difference-of-two-sets-3126580 Taylor, Courtney. "What Is the Difference of Two Sets in Set Theory?" ThoughtCo. https://www.thoughtco.com/difference-of-two-sets-3126580 (accessed January 23, 2018).