Difference of Sets: Definition, Formula, and Examples

Difference of Sets: Definition, Formula, and Examples

[toc]

What Is the Difference of Sets?

The difference of two sets A and B, written A−B (or A∖B), is the set of all elements that are in A but not in B. You take set A and remove from it everything it shares with B.

Set-difference formula: A−B={x : x∈A and x∉B}.

Read it aloud: "x is in A and x is not in B." Both conditions must hold. The word "not" is doing the heavy lifting — it is what makes the difference of sets different from the intersection or the union.

Examples of the Difference of Sets

The examples move from a plain computation to reasoning about order and disjoint sets.

Example 1

If A={1,2,3,4,5,6} and B={3,4,5,6,7,8}, find A−B.
Keep the elements of A that are not in B. 1 and 2 are in A but not in B. 3, 4, 5, 6 are in both, so they leave.
A−B={1, 2}.

Example 2

Using the same A and B, a student writes B−A={1,2} as well. Is that correct?
The student assumes that because difference "removes the overlap," the leftover is the same either way. B−A must also be {1,2}.
Watch it fail. B−A means "elements in B but not in A." The elements 1 and 2 are not in B.
The correct way: scan B instead. 7 and 8 are in B but not in A. B−A={7, 8}.
So A−B={1,2} but B−A={7,8}: different sets. Order matters.

Example 3

If A={a,b,c} and B={c,d,e}, find A−B and B−A.
A−B: Keep a and b that are not in B. Only c is shared, so it leaves. A−B={a, b}.
B−A: Keep d and e that are not in A. Only c is shared, so it leaves. B−A={d, e}.

Example 4

If A={2,4,6} and B={1,3,5} are disjoint, find A−B.
A and B share no elements. So removing B from A removes nothing.
A−B={2, 4, 6} = A.

Example 5

If A={1,2,3}, find A−A and A−∅.
A−A: Keep elements of A not in A, of which there are none. A−A=∅ (the empty set).
A−∅: Remove nothing from A. A−∅={1, 2, 3} = A.

Example 6

If A={1,2,3,4} and B={2,3} with B⊆A, find A−B and B−A.
A−B: Keep 1 and 4 that are not in B. A−B={1, 4}.
B−A: Keep 2 and 3 not in A, both are in A. B−A=∅.

Whenever B⊆A, the subset subtracted from itself gives the empty set: B−A=∅.

Where the Difference of Sets Earns Its Keep

The difference of sets is the mathematics of "what's left after you take something away" — and that shows up long before anyone writes A−B.

Because A−B and B−A answer different questions, keeping the order straight is not pedantry — it is the whole point of the tool.

Properties of the Difference of Sets

These rules follow directly from the definition "in A and not in B," and they cover almost every question an exam can ask.

Where the Difference of Sets Goes Wrong

Mistake 1: Treating A−B as commutative

Where it slips in: Right after learning addition and multiplication of numbers, where order does not matter.
Don't do this: Assume A−B=B−A.
The correct way: Compute each separately. A−B keeps the leftovers of A; B−A keeps the leftovers of B. Ask "which set am I keeping elements from?" avoids the swap that trips up the rusher every time. Set difference is not commutative.

Mistake 2: Removing shared elements from the wrong set

Where it slips in: When the overlap is large and the two sets look similar.
Don't do this: Cross out elements of B that happen not to be in A.
The correct way: Start from A, then delete only the elements that also appear in B. Everything you keep must have come from A.

Mistake 3: Confusing A−B with A∩B or A∪B

Where it slips in: The three operations sit next to each other in the same chapter.
Don't do this: Report the shared elements (that's the intersection) when the question asked for the difference.
The correct way: Difference keeps what's in A and not in B; intersection keeps what's in both; union keeps what's in either.

Conclusion