Math Home

Set Differences

The difference of the set \(A\) from the set \(B\) is the set \(\{x : x \in B\) and \(x \not\in A\}.\) The notation for the difference is \(B - A,\) but \(B \backslash 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\).

A B

This picture shows the set difference \(B - A\). The set \(B - A\) is the set \(B\) with the part overlapping with \(A\) missing.

B - A



Claim: \(B - A = A^C \cap B\).

This claim can be verified by a logical computation. See lesson 1.3 for an introduction to the logical notation used here. \begin{align} x \in B - A & = (x \in B) \wedge (x \not\in A) \\ & = (x \in B) \wedge (x \in A^C) \\ & = x \in A^C \cap B \end{align} 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 \cup B) - (A \cap B).\) The notation for the symmetric difference is \(A \triangle B.\) Conceptually, \(A \triangle 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 \triangle B = \{1, 2, 3, 5\} \triangle \{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\).

A B

This picture shows the symmetric difference \(A \triangle B\).

Symmetric difference of A and B

\(\triangle\) and \(\oplus\)

The symmetric difference is logically related to exclusive or: \[x \in A \triangle B = (x \in A) \oplus (x \in B)\]


Use the numbers \(1, 2,\) and \(3.\)

A - B \(=\) {1}\(\emptyset\)

A \(\triangle\) B \(=\) {1,3}\(\emptyset\)
\(A\) is not a set. \(B\) is not a set.
Check your understanding. Let \(A = \{a, b, c\}\) and \(B = \{b, c, d\}.\)

What set is \(A - B\)?

What set is \(A \triangle B\)?