What is Set Difference?
You have tasks. Your friend already did some of them.
What’s left? That’s set difference — what’s in A but not in B.
Symbol: ∖ or −
A∖B
This reads: “A minus B”
Example
A={1,2,3,4} B={3,4,5}
Find A∖B:
Go through A — is it also in B? If so, remove it.
- 1: not in B → keep
- 2: not in B → keep
- 3: in B → remove
- 4: in B → remove
A∖B={1,2}
Keep what’s only in A.
More Examples
| A | B | A∖B | Why? |
|---|
| {a,b,c} | {b,c,d} | {a} | Only a isn’t in B |
| {1,2,3} | {4,5} | {1,2,3} | Nothing to remove |
| {1,2} | {1,2,3} | ∅ | Everything removed |
| {1,2,3} | ∅ | {1,2,3} | Empty set removes nothing |
Order Matters
Unlike union and intersection, order matters here.
A∖B=B∖A
Example:
A={1,2,3},B={3,4,5}
- A∖B={1,2}
- B∖A={4,5}
Different results. Think of it like subtraction: 5−3=3−5.
Properties
Difference with itself:
A∖A=∅
Remove everything, nothing left.
Difference with empty set:
A∖∅=A
Nothing to remove.
Empty set difference:
∅∖A=∅
Start with nothing, end with nothing.
The Formal Definition
A∖B={x∣x∈A and x∈/B}
This reads: “The set of all x such that x is in A and x is not in B.”
Set difference asks: is it only in A?