Set Difference

Download as PDF

Ever wondered what remains when you take one collection of items away from another? That's the core idea behind set difference! In this lesson, we'll explore how to find the elements that are in one set but not in another, a key operation in set theory.

Set Difference — an original Algebra911 reference diagram defining set difference with its key formula and a worked example.
Set Difference: Understanding A - B in Set Theory

What Is Set Difference?

Set difference is a fundamental operation in set theory that creates a new set containing all the elements of one set that are not present in another set. In simple terms, if you have two sets, say set A and set B, the difference AB (read as "A minus B") is the set of elements that belong to A but do not belong to B.

Think of it like this: Imagine you have a basket of fruits, A={apple, banana, orange, grape}. Your friend has another basket, B={orange, grape, mango}. If you calculate the set difference AB, you are essentially asking, "What fruits are in my basket that are not in my friend's basket?" You would start with your fruits and remove any that also appear in your friend's basket. You'd remove the 'orange' and the 'grape'. What's left? The 'apple' and the 'banana'. So, AB={apple, banana}.

The notation for set difference is typically a minus sign () or a backslash (). Both AB and AB mean the exact same thing.

Formally, the definition of the set difference between set A and set B is:

A - B = \{x \mid x \in A \text{ and } x \notin B\}

This mathematical sentence reads: "The set difference AB is the set of all elements x such that x is an element of set A and x is not an element of set B." The key takeaway is that we only care about the elements in the first set, A, and we remove the ones that overlap with the second set, B.

How Do You Calculate Set Difference? A Step-by-Step Guide

Calculating the set difference might seem abstract at first, but it's a straightforward process. By following a clear procedure, you can solve any set difference problem accurately. Let's break it down into simple steps.

  1. Identify Your Sets: Clearly write down the two sets involved. Let's call them set A (the set you are starting with) and set B (the set you are subtracting).
  2. Iterate Through the First Set: Go through each element in set A, one by one.
  3. Check for Membership in the Second Set: For each element from set A, ask yourself: "Is this element also present in set B?"
  4. Decide What to Keep:
    • If the answer is NO (the element is in A but not in B), then you keep this element. It will be part of your final answer.
    • If the answer is YES (the element is in both A and B), then you discard this element. It will not be in the set difference.
  5. Construct the Final Set: Collect all the elements you decided to keep. This collection forms the new set, which is the result of AB. Remember to write your final answer using curly braces {} to denote it as a set.

Let's walk through an example to see this process in action.

Example 1

Let set A={2,4,6,8,10,12} and set B={10,11,12,13}. Find the set difference AB.

Step 1: Identify the sets.
A={2,4,6,8,10,12}
B={10,11,12,13}

Step 2 & 3: Iterate through A and check against B.

  • Is 2 in B? No. Keep it.
  • Is 4 in B? No. Keep it.
  • Is 6 in B? No. Keep it.
  • Is 8 in B? No. Keep it.
  • Is 10 in B? Yes. Discard it.
  • Is 12 in B? Yes. Discard it.

Step 4: Construct the final set.
The elements we kept are 2,4,6, and 8.

Therefore, the set difference is:
AB={2,4,6,8}

Notice that the elements 11 and 13 from set B have no effect on the outcome of AB. We only care about which elements to remove from A.

How Can Venn Diagrams Help Visualize Set Difference?

Venn diagrams are an excellent tool for visualizing the relationships between sets, and they make understanding set difference much more intuitive. A Venn diagram typically uses overlapping circles, where each circle represents a set. The elements of the set are considered to be inside that circle.

Let's imagine two overlapping circles. The left circle represents set A, and the right circle represents set B. The overlapping region in the middle represents the intersection (AB), which contains elements that are in both sets.

So, where is the set difference AB on this diagram?

To find AB, you are looking for the part of set A that is not part of set B. Visually, this is the portion of the circle for A that does not overlap with the circle for B. It often looks like a crescent moon shape on the left side of the diagram.

Here’s how to think about it visually:

  • The entire left circle: This is set A.
  • The entire right circle: This is set B.
  • The overlapping middle section: This is the intersection, AB. These are the elements you need to remove from A.
  • The part of circle A that is NOT overlapping: This shaded region represents the set difference AB.

Similarly, the set difference BA would be the crescent moon shape on the right side—the part of circle B that does not overlap with circle A. By looking at a Venn diagram, it becomes immediately obvious that AB and BA are two completely different regions. This visual confirmation helps solidify the concept that the order matters greatly in set difference.

Using a Venn diagram can be a great first step before calculating a difference, as it helps you mentally map out which elements belong where and which ones you should be excluding from your final answer.

Is Set Difference Commutative? Exploring A - B vs. B - A

In mathematics, an operation is called commutative if changing the order of the operands does not change the result. For example, addition is commutative because 3+5=8 and 5+3=8. The result is the same regardless of the order.

A critical question for any new operation is whether it shares this property. So, is set difference commutative? Does AB equal BA?

The answer is a firm no. Set difference is a non-commutative operation. In almost all cases (unless the sets are identical), ABBA.

Let's think about why.

  • AB asks: What is in A that is not in B?
  • BA asks: What is in B that is not in A?

These are two fundamentally different questions. The first focuses exclusively on the unique elements within A, while the second focuses exclusively on the unique elements within B. A concrete example makes this crystal clear.

Example 2

Let set P be the set of primary colors and set S be the colors in a school's logo.

P={red, yellow, blue}
S={blue, gold, white}

Let's find both PS and SP.

Part 1: Calculate PS

We start with the elements in P and remove any that are also in S.

  • Is 'red' in S? No. Keep it.
  • Is 'yellow' in S? No. Keep it.
  • Is 'blue' in S? Yes. Discard it.

So, PS={red, yellow}.

Part 2: Calculate SP

Now, we start with the elements in S and remove any that are also in P.

  • Is 'blue' in P? Yes. Discard it.
  • Is 'gold' in P? No. Keep it.
  • Is 'white' in P? No. Keep it.

So, SP={gold, white}.

Conclusion

As we can see, {red, yellow}{gold, white}. Therefore, PSSP.

This example demonstrates that the order in which you perform set difference is crucial. Always pay close attention to which set is being subtracted from which.

What Are the Key Properties of Set Difference?

Like other mathematical operations, set difference has several key properties that help us understand its behavior and relationship with other set operations. Understanding these properties can make solving more complex problems much easier.

Here is a summary of the most important properties of set difference:

Property NameFormulaExplanation
Subset PropertyABAThe result of AB will always be a subset of A. This is because the operation only removes elements from A; it never adds new ones. Every element in AB was originally in A.
Empty Set DifferenceA=ASubtracting the empty set (a set with no elements) from any set A leaves the set A unchanged. You are removing nothing, so everything remains.
Difference with ItselfAA=Subtracting a set from itself results in the empty set. You are removing all elements that are in A from A, which leaves nothing behind.
Disjoint Sets(AB)(BA)=The sets AB and BA are disjoint, meaning they have no elements in common. This makes sense because one contains elements unique to A and the other contains elements unique to B.
Relation to ComplementAB=ABcThe set difference AB is equivalent to the intersection of set A with the complement of set B. The complement Bc means 'everything not in B'. So this says, 'the elements in A that are also not in B'.
Difference from Universal SetUA=AcIf you subtract a set A from the universal set U (the set of all possible elements), the result is the complement of A, denoted Ac.

These properties are the 'rules of the road' for set difference. Keeping them in mind will help you simplify expressions and avoid common errors.

How Does Set Difference Work with Infinite Sets?

The concept of set difference isn't limited to finite sets with a handful of elements. The same logic applies seamlessly to infinite sets, which are sets that go on forever. Common examples of infinite sets include the set of all integers, the set of all even numbers, or the set of all real numbers.

When working with infinite sets, you can't list out every element one by one. Instead, you have to think about the properties or rules that define the sets. The question remains the same: "What elements are in the first set that are not in the second set?"

Let's consider some well-known infinite sets in mathematics:

  • The set of Natural Numbers: N={1,2,3,4,...}
  • The set of Whole Numbers: W={0,1,2,3,...}
  • The set of Integers: Z={...,3,2,1,0,1,2,3,...}
  • The set of Even Integers: E={...,4,2,0,2,4,...}
  • The set of Odd Integers: O={...,3,1,1,3,...}

Let's use these to work through an example.

Example 3

Let Z be the set of all integers and E be the set of all even integers. Find the set difference ZE.

Step 1: Understand the sets.
Z contains all whole numbers and their negative counterparts (...,2,1,0,1,2,...).
E contains all integers that are divisible by 2 (...,4,2,0,2,4,...).

Step 2: Apply the definition of set difference.
We need to find the set of elements that are in Z but are not in E. In other words, we are looking for all the integers that are not even.

Step 3: Determine the resulting elements.
An integer that is not even is, by definition, an odd integer. If we take the entire list of integers and cross out all the even ones, the numbers remaining would be ...,5,3,1,1,3,5,....

Step 4: Write the final set.
The set of all odd integers is denoted by O.

Therefore:
ZE=O

This shows that the logic of set difference—taking elements from one set and removing any that appear in a second—works just as well for concepts like "all integers" as it does for a small list of numbers.

What Are Common Mistakes When Calculating Set Difference?

When first learning about set difference, students can fall into a few common traps. Being aware of these mistakes is the best way to avoid making them. Here are some of the most frequent errors to watch out for.

  • Confusing AB with BA.
    This is the most common mistake. As we've discussed, set difference is not commutative. The set AB is completely different from BA. Always double-check which set is being subtracted.
  • Mistaking Difference for Intersection.
    Students sometimes list the elements the sets have in common. Remember, finding common elements is the job of the intersection (AB). Set difference (AB) is about finding what's in A that is not common.
  • Including Elements from the Second Set.
    The result of AB can only contain elements that were originally in A. If an element is in B but not in A, it can never be part of the answer for AB. For example, if A={1,2} and B={2,3}, AB={1}. The element 3 is irrelevant to this specific calculation.
  • Forgetting to Remove All Common Elements.
    Make sure you check every element of the first set against the entire second set. It's easy to miss an overlap, especially in larger sets. A systematic, element-by-element approach is the safest way to ensure accuracy.
  • Incorrect Set Notation.
    The answer to a set difference problem is a set itself. Therefore, your final answer must be enclosed in curly braces {}. Writing the elements without braces is technically incorrect. For example, the answer should be {1,3}, not just 1,3.

By keeping these points in mind, you can approach set difference problems with more confidence and improve your accuracy.

Quick Summary and Reference

This lesson covered the definition, calculation, and properties of set difference. Here is a quick summary of the key points to remember for easy reference.

  • Definition: The set difference AB is the set of all elements that are in set A but are not in set B.
  • Formula: The formal definition is AB={xxA and xB}.
  • Notation: Set difference can be written as AB or as AB. Both mean the same thing.
  • Key Property (Non-Commutative): The order matters. In general, ABBA.
  • Venn Diagram Visualization: In a Venn diagram, AB is the region of the circle for A that does not overlap with the circle for B.
  • Calculation Process: To find AB, go through each element of A and remove it only if it is also found in B.
  • Relationship to Subsets: The result AB is always a subset of the first set, A. That is, ABA.

Frequently Asked Questions

What's the difference between set difference and intersection?

Set difference AB gives you the elements that are in set A only, after removing anything it has in common with B. Set intersection AB gives you only the elements that sets A and B have in common.

Can the result of a set difference be an empty set?

Yes, absolutely. If set A is a subset of set B (meaning all elements of A are also in B), then AB will be the empty set, , because there are no elements in A that are not also in B.

What does the symbol mean in set theory?

The backslash symbol is an alternative notation for set difference. It is sometimes called the relative complement. The expression AB is read the same way and means the exact same thing as AB.

Is A - B always a subset of A?

Yes, always. The operation AB starts with the elements of A and only removes some of them. It never adds any new elements. Therefore, every element in the resulting set must have originated in A, making it a subset of A.

How is set difference related to the complement of a set?

Set difference is closely related to the concept of a complement. The set difference AB is formally equivalent to the intersection of A with the complement of B, written as ABc. This means 'the elements in A that are also not in B'.

Does the order of elements matter in the final set difference answer?

No. The final answer is a set, and in set theory, the order of elements within a set does not matter. For example, the set {1,2,3} is identical to the set {3,1,2}.

Can I find the difference between three sets, like A - B - C?

Yes, you can. You should perform the operations from left to right, just like with standard subtraction. First, you would calculate an intermediate set D=AB. Then, you would calculate the final result by finding DC.