Difference of Sets
The difference of sets is one of the important and fundamental set theory operations. Union and intersection are the other set theory operations in addition to the difference of sets. The difference of two sets A and B is again a set that consists of the elements of A that are NOT in B.
In this article, let's learn more about the difference of sets, their properties along with Venn diagrams, and solved examples.
What Is the Difference of Sets?
The difference of two sets A and B is defined as the lists of all the elements that are in set A but that are not present in set B. The set notation used to represent the difference between the two sets A and B is A − B or A ∖ B. A - B in set-builder notation is defined as follows:
A - B = {x / x ∈ A and x ∉ B}
- A - B = the set that is obtained by removing the elements of A ∩ B from A
- B - A = the set that is obtained by removing the elements of A ∩ B from B
How to Find the Difference of Sets?
Let's look at an example to understand how to find the difference of two sets A and B.
- Consider the two sets A = {1, 2, 3, 4, 5} and B = {3, 4, 5, 6, 7, 9}
- To find the difference A - B of these two sets, strike off all the elements that are present in both A and B.
A - B = {1, 2, ̶3̶,̶ ̶4̶,̶ ̶5̶} - {3̶ ,̶4̶ ,̶5̶, 6, 7, 9} - A - B is the set of elements of A that are left. i.e., A - B = {1, 2}.
Order of Difference of Sets
Similar to how 5 - 3 is not the same as 3 - 5, we also need to be careful about the order when we compute the difference of sets. The difference of sets is not commutative. This means that the result may be different if we change the order of the difference of the two sets. Thus, for all sets A and B, we can conclude that A - B need not be equal to B - A.
Consider the same example of two sets A = {1, 2, 3, 4, 5} and B = {3, 4, 5, 6, 7, 9}.
We found that the difference A - B = {1, 2} and the difference B - A = {6, 7, 9}. Thus, we can see from this example that A - B ≠ B - A.
Difference of Sets Venn Diagram
Venn diagram is used to illustrate the relationship between different sets in the form of circles or ellipses. Let's see how we can use the Venn diagram to show the difference of two sets C and D. In the following Venn diagram, the left crescent moon represents C - D and the right crescent moon represents D - A.
Also, the difference of the two disjoint sets is a null set. We will understand this by an example.
Example of Difference of Sets by Venn Diagram
Consider two sets C = { a, b, c, d, e } and D = { a, e, f, g }. Then
- C - D = { ̶a̶, b, c, d, ̶e̶ } - { ̶a̶, ̶e̶ , f, g } = {b, c, d}
- D - C = { ̶a̶, ̶e̶, f, g } - { ̶a̶, b, c, d, ̶e̶ } = {f, g}
Complement and Difference of Sets
The complement of a set A is denoted by A' or Ac and it is the difference of the sets U and A, where U is the universal set. i.e., A' (or) Ac = U - A. This refers to the set of all elements that are in the universal set that are not elements of set A.
Example of Complement of a Set
- Consider the example of set A = {1, 2, 3} and U = {1, 2 ,3, 4, 6}, then the complement of A is,
A' (or) Ac = { ̶ ̶1̶,̶ ̶2̶,̶ ̶3̶, 4, 6} - { ̶ ̶1̶,̶ ̶2̶,̶ ̶3̶} = {4, 6}. - If the universal set is different, for example, U = {-3, -2, 0, 1, 2 }, then the complement of A is,
A' (or) Ac = {-3, -2, 0, 1̶,̶ ̶2̶} - {1̶,̶ ̶2̶, 3} = {-3, -2, 0}.
We need to pay attention to what universal set is considered for the difference.
Properties of Complement of a Set
The properties of the complement are as follows which directly follow from its definition.
- A ∪ Ac = U
- A ∩ Ac = ∅
Here, ∅ is the empty set.
DeMorgan's laws are:
- (A ∩ B)C = AC ∪ BC
- (A ∪ B)C = AC ∩ BC
Symmetric Difference of Sets
If A and B are two sets, then the symmetric difference of A and B is denoted by A Δ B and is defined as A Δ B = (A - B) U (B - A). There is an alternate formula for the symmetric difference of sets which says A Δ B = (A ∪ B) - (A ∩ B). Here is the Venn diagram of A Δ B.
We can understand this from the example below.
Example of Symmetric Difference of Sets
Let us consider two sets A = {1, 2, 4, 5, 8} and B = {3, 5, 6, 8, 9}. Then to find the symmetric difference of A and B,
- Step - 1: Find A - B.
A - B = {1, 2, 4, ̶5̶, ̶8̶} - {3, ̶5̶, 6, ̶8̶, 9} = {1, 2, 4} - Step - 2: Find B - A.
B - A = {3, ̶5̶, 6, ̶8̶, 9} - {1, 2, 4, ̶5̶, ̶8̶} = {3, 6, 9} - Step - 3: Find A Δ B = (A - B) U (B - A).
A Δ B = (A - B) U (B - A) = {1, 2, 4} U {3, 6, 9} = {1, 2, 3, 4, 6, 9}
Properties of Difference of Sets
For any two sets A and B, here are the properties of differece of sets. Here, ∅ denotes the empty set.
- A - B = A ∩ Bc
- A - A = ∅
- A - ∅ = A
- ∅ - A = ∅
- A - B = A if A ∩ B = ∅
- A - B = B - A = ∅ if A = B
- If A ⊂ B, then A - B = ∅
- n(A Δ B) = n(A - B) + n(B - A)
- n(A Δ B) = n(A U B) - n(A ∩ B)
Related Articles on Difference of Sets
Check out the following pages related to the difference of sets
Examples on Difference of Sets
-
Example 1: Find the differences of sets A - B and B - A, where set A = {1, 2, 3, 4} and set B = {2, 3, 5, 7}
Solution:
It is given that A = {1, 2, 3, 4} and B = {2, 3, 5, 7}. Then
- A - B = {1, ̶2̶,̶ ̶3̶, 4} - { ̶2̶,̶ ̶3̶, 5, 7} = {1, 4}
- B - A = { ̶2̶,̶ ̶3̶, 5, 7} - {1, ̶2̶,̶ ̶3̶, 4} = {5, 7}
Answer: A - B = {1, 4} and B - A = {5, 7}.
-
Example 2: Verify the identity (A ∩ B)C = AC ∪ BC if A = {a, b, c, d, e}, B = {c, d, f}, and U = {a, b, c, d, e, f, g, h}.
Solution:
We know that the complement of a set A is the difference of the sets U and A. So
AC = U - A = { ̶a̶,̶ ̶b̶,̶ ̶c̶,̶ ̶d̶,̶ ̶e̶, f, g, h} - { ̶a̶,̶ ̶b̶,̶ ̶c̶,̶ ̶d̶,̶ ̶e̶} = {f, g, h}
BC = U - B = {a, b, ̶c̶,̶ ̶d̶, e, ̶f̶, g, h} - { ̶c̶,̶ ̶d̶, ̶f̶} = {a, b, e, g, h}
Finding LHS:
For the given sets A and B, A ∩ B = {a, b, c, d, e} ∩ {c, d, f} = {c, d}
Its complement is, (A ∩ B)C = U - (A ∩ B) = {a, b, ̶c̶,̶ ̶d̶, e, f, g, h} - { ̶c̶,̶ ̶d̶} = {a, b, e, f, g, h}
Finding RHS:
AC ∪ BC = {f, g, h} ∪ {a, b, e, g, h} = {a, b, e, f, g, h}
Hence we have proved that (A ∩ B)C = AC ∪ BC.
Answer: We have proved the given DeMorgan identity.
-
Example 3: If n(A) = 100, n(B) = 70, and n(A ∩ B) = 20, then what is n(A Δ B)?
Solution:
From the formulas of set theory,
n(A U B) = n(A) + n(B) - n(A ∩ B)
= 100 + 70 - 20
= 150
From the symmetric difference of sets,
n(A Δ B) = n(A U B) - n(A ∩ B)
= 150 - 20
= 130
Answer: n(A Δ B) = 130.
FAQs on Difference of Sets
How Do You Find the Difference of a Set?
The process of finding the difference of sets is explained with an example.
- Consider the two sets A = {1, 2, 3, 4} and B = {3, 4, 5, 6, 9}
- To find the difference A - B of these two sets, let's begin by choosing all of the elements of A, and then remove every element of A that is also an element of B.
- Here, since the set A shares the elements 3 and 4 with B, the set difference A - B = {1, 2}.
What Is the Difference of a Set to Itself?
The difference of a set to itself is the empty set. i.e., A - A = ∅, for any set A. Here, ∅ is an empty set.
What Is the Symmetric Difference of Two Sets?
For any two sets A and B, the symmetric difference is denoted by A Δ B and is defined in two ways:
- A Δ B = (A - B) U (B - A) (or)
- A Δ B = (A ∪ B) - (A ∩ B)
What Is A minus B in sets?
The difference of sets is denoted with a minus symbol. The set A − B will consist of elements that are present in A but not in B. For example, if A = {1,2,3} and B={3,5,7}, then A−B={1,2}.
What Is the Difference Of Sets Of Equal Sets?
The difference of sets of two equal sets is equal to a null set. The equal sets have the same elements and the number of elements is also equal, and hence their difference is an empty set or a null set.
What Are the Operation of Sets Other than the Difference of Sets?
There are four basic operations of sets other than the difference of sets. They are:
- Union of Sets.
- Intersection of sets.
- Complement of sets.
- Cartesian Product of sets.
What Are the Identities of Difference of Sets?
Here is the list of some of the important identities involving the difference of sets.
- If two sets A and B are equal, then we get A-B = B-A = ∅. Here, ∅ is an empty set.
- When we subtract an empty set from a set, the result is that set itself, i.e, B – ∅ = B.
- When we subtract the set B from an empty set, then the result is an empty set, i.e., ∅ - B = ∅
- When we subtract a superset B from subset A, then the result is an empty set, i.e, A – B = ∅ if A ⊂ B
What Are the Identities of Difference of Sets that Combine Union and Intersection?
There are some set identities that combine other set operations like union and intersection as well. These are listed below:
- (A ∩ B)C = AC ∪ BC
- (A ∪ B)C = AC ∩ BC
visual curriculum