The difference of the set A from the set B is the set {x:x∈B and x∉A}. The notation for the difference is B−A, but B∖A is also common.
For example, if A={1,2,4} and B={1,2,3,5}, then
B−A={1,2,3,5}−{1,2,4}={3,5}
The elements 1 and 2 are lost in the set difference, since those are elements of A. The elements 3 and 5 remain, since they are not in A. The 4 does nothing, since it is not in B to begin with.
The following picture shows two sets, A and B.
This picture shows the set difference B−A. The set B−A is the set B with the part overlapping with A missing.
Claim: B−A=AC∩B.
This claim can be verified by a logical computation. See lesson 1.3 for an introduction to the logical notation used here.
x∈B−A=(x∈B)∧(x∉A)=(x∈B)∧(x∈AC)=x∈AC∩B
The first line follows by replacing the English and with the logical and in the definition of B−A.
Symmetric Differences
The symmetric difference of the sets A and B is the set (A∪B)−(A∩B). The notation for the symmetric difference is A△B. Conceptually, A△B is the set of elements that are in A or B, but not both.
For example, if A={1,2,4} and B={1,2,3,5}, then
A△B={1,2,3,5}△{1,2,4}={3,4,5}
The elements 3,4, and 5 are in A or B, but not both.
The following picture shows two sets, A and B.
This picture shows the symmetric difference A△B.
△ and ⊕
The symmetric difference is logically related to exclusive or:
x∈A△B=(x∈A)⊕(x∈B)
Use the numbers 1,2, and 3.
A - B ={1}∅
A △ B ={1,3}∅ A is not a set.B is not a set.
Check your understanding. Let A={a,b,c} and B={b,c,d}.