What Is the Difference of Sets?
The difference of two sets and , written (or ), is the set of all elements that are in but not in . You take set and remove from it everything it shares with .
Set-difference formula: .
Read it aloud: " is in and is not in ." 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 and , find .
Keep the elements of that are not in . and are in but not in . are in both, so they leave.
.
Example 2
Using the same and , a student writes as well. Is that correct?
Here is the intuitive-but-wrong move.
The student assumes that because difference "removes the overlap," the leftover is the same either way, so must also be .
Watch it fail. means "elements in but not in ." The elements and are not even in , so they cannot possibly be in .
The correct way: scan instead. and are in but not in . .
So but : different sets. Order matters.
Example 3
If and , find and .
: keep that are not in . Only is shared, so it leaves. .
: keep that are not in . Only is shared, so it leaves. .
Example 4
If and are disjoint, find .
and share no elements. So removing from removes nothing.
.
When two sets are disjoint, and , so nothing gets subtracted.
Example 5
If , find and .
: keep elements of not in , of which there are none. (the empty set).
: remove nothing from . .
Example 6
If and with , find and .
: keep not in . .
: keep not in , but both are in . .
Whenever , the subset subtracted from itself gives the empty set: .
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 .
The complement is a difference. The complement of is just , where is the universal set. Set difference and complement are the same idea, one relative to and one relative to everything.
De Morgan-style rewriting. A useful identity is : "take , intersect with everything outside ." It links difference, intersection, and complement in one line.
Filtering data. "Customers who bought last month but not this month" is . "Files in the backup but not in the source" is a difference. The operation names a question people ask constantly.
Because and 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 and not in ," and they cover almost every question an exam can ask.
Complement form: — the difference is intersected with everything outside . This links difference to the intersection of sets.
Not commutative: in general; they agree only when .
Self-difference: .
Empty-set rules: and .
Disjoint sets: if , then and .
Subset case: if , then .
Always a subset: ; the difference never adds elements that were not already in .
Where the Difference of Sets Goes Wrong
Mistake 1: Treating as commutative
Where it slips in: Right after learning addition and multiplication of numbers, where order does not matter. That habit carries over.
Don't do this: Assume .
The correct way: Compute each separately. keeps the leftovers of ; keeps the leftovers of . The reader who slows down to ask "which set am I keeping elements from?" avoids the swap that trips up the rusher every time. Set difference is not commutative — that is the habit-breaker to internalise.
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: For , cross out elements of that happen not to be in (they were never there to remove).
The correct way: Start from , then delete only the elements that also appear in . Everything you keep must have come from in the first place.
Mistake 3: Confusing with or
Where it slips in: The three operations sit next to each other in the same chapter, and their symbols blur together.
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 and not in ; intersection keeps what's in both; union keeps what's in either. In the real world, a data-migration audit once double-counted records because "in system A but not system B" () was computed as "in both" () — the kind of set-logic slip that the ProofWiki identity is designed to keep you honest about.
Conclusion
The difference of sets keeps what's in but not .
It is not commutative: in general.
For disjoint sets, ; for , ; and .
The identity links difference to intersection and complement.
The Venn diagram makes the answer visible: shade the crescent of the first set that lies outside the second.
To take the difference of sets further with a teacher, explore Bhanzu's algebra tutor, help with algebra, or math classes online. Want to build set operations with a live trainer? Book a free demo class.
Now try these: with and , find , , and . If the order of subtraction confuses you, come back to Example 2.
Read More
Was this article helpful?
Your feedback helps us write better content

