Sets are the basic objects that let us talk about collections without constantly repeating the same description. In this course, sets are not a side topic. They are the language behind logic, functions, relations, and the later number constructions.
If the notation here feels unfamiliar, that is normal. The point of this unit is to make the language precise enough that later chapters can use it freely.
Sets, membership, and equality
Definition
A set
A set is a collection of things.
If x is an element of a set , we write . If x is not an element of
, we write .
Examples:
{1, 2, 3}is a set.{Hong Kong Island, Kowloon, New Territories}is a set.- is the empty set, the set with no elements.
The same object may be written in different ways, but a set is determined only by its elements.
Theorem
Extensionality
Two sets are equal if and only if they have exactly the same elements.
In symbols:
This is the rule that makes set equality practical. To prove , the standard method is to prove both inclusions:
- show ;
- show .
Common mistake
Do not confuse equal sets with equal descriptions
{1, 2, 3} and {3, 2, 1} are the same set, because they have the same
elements. The order of listing does not matter.
Common mistake
Subset notation varies across books
This course uses to mean “every element of is in ”. Some books write for that idea and reserve for strict subset. Always check the local convention.
Set-builder notation and bounded predicates
After predicate logic, the most common way to define a set is to start with a known set and then keep exactly the elements satisfying a condition:
This notation should be read carefully. The symbol before the vertical bar tells you where the variable is allowed to live; the predicate after the bar tells you which of those allowed elements survive. For example,
is the set of even integers.
Common mistake
Do not ignore the ambient set
The expression is often convenient shorthand, but the rigorous version is bounded inside a set already under discussion. This prevents the definition from pretending that every verbal description automatically creates a safe mathematical object.
Common mistake
Sets are not multisets
A set remembers whether an object is present, not how many times it was listed.
Thus \{1,1,2,3\} and \{1,2,3\} describe the same set, even though they would
be different multisets.
Building new sets
Once we know some sets, we usually want to build more. The standard operations do exactly that.
| Operation | Symbol | Definition |
|---|---|---|
| Union | elements in or in | |
| Intersection | elements in both and | |
| Difference | elements in but not in | |
| Complement | elements outside in a chosen universal set |
The complement depends on a universal set . In this unit we usually assume all sets live inside some fixed , so means .
Worked example
Track elements through several set operations
Let
and take the universal set
Then:
Solution
Why the complement needs a universal set
Why the identities are true
The set laws in this unit are not memorized by magic. They are proved by tracking one element at a time.
Theorem
Basic algebra of sets
For sets , , and :
- if and only if
- if and only if
- if and only if
The key proof method is element chasing. For example:
which is equivalent to
and therefore to
Proof
Guided proof: why implies
Other set constructions
The course also uses a few larger constructions that are still built from the same language.
Cartesian products
is the set of ordered pairs (a, b) with and .
Order matters: (a, b) and (b, a) are different unless .
If and , then .
is the Cartesian plane.
Finite products
The n-fold product is the set of all n-tuples with entries in .
This is just the repeated Cartesian product of with itself.
Power sets
P(A) is the set of all subsets of .
If has n elements, then P(A) has elements. A useful way to think
about this is the indicator-function viewpoint: every subset of can be
encoded by a function .
For example,
Disjoint union
Sometimes two sets may overlap as raw collections, but we still want to keep track of where each element came from. The disjoint union does that by tagging the elements with their origin.
Informally, is “ with tag 1” together with “ with tag 2”.
How to prove a set identity carefully
At this stage of the course, a set identity should be read as a statement about membership, not as a picture to be memorized.
The standard proof pattern is:
- take an arbitrary element
x; - rewrite each side into logical conditions;
- simplify those conditions until both sides say the same thing.
Worked example
Prove
Start with
This means:
- ,
- ,
- .
But that is exactly the condition for
Since the reasoning can be read in either direction, the two sets are equal.
This is the same idea used for De Morgan’s laws, distributive laws, and later proofs about relations and number constructions.
Reading Venn diagrams correctly
Venn diagrams are useful for organizing a situation, but the proof still comes from membership conditions. A diagram can suggest that a region is empty, inside another region, or split into several pieces; the written argument must then say which inclusion, disjointness condition, or counting equation that picture represents.
For three sets, a statement such as means every element of lies in at least one of or . It does not say that , and it does not say that . Keeping those possibilities separate is a good test of whether the diagram is being read logically rather than visually only.
Worked example
Translate four Venn conditions into regions
Assume , , and are non-empty sets. The following common worksheet conditions are best read as region instructions, not as vague pictures.
| Condition | What the diagram must show |
|---|---|
| , , and | Both and sit inside , but they do not overlap each other. The set may still have points outside both of them. |
| , , , and | Each pair overlaps, but the central triple-overlap region is empty. The three pairwise overlaps must be separate regions. |
| and | Since , the intersection is just . Thus lies inside , and lies inside . |
| , not , and not | No point of is outside , but must have at least one point in and at least one point in . |
The fourth line is the easiest one to misread. It does not merely say that touches both circles. It says that is completely covered by and , while still failing to be contained in either one alone.
Counting finite sets
The language of sets also controls counting.
For finite sets:
- ,
- ,
- .
The last formula matters because elements in the intersection are counted twice
if you simply add |A| and |B|.
Worked example
Count a union and a power set
Suppose , , and .
Then
Now let . Each element either belongs to a subset or does not, so there are
possible subsets. Hence .
Worked example
A Venn-diagram count without drawing the diagram
Ten students go hiking. Seven use sunscreen, six wear a hat, and two use no sun protection.
Let be the sunscreen set and the hat set. Since two students use neither form of protection,
By inclusion-exclusion,
So five students use both sunscreen and a hat.
A checklist for subset proofs
Subset proofs are common enough that they should become routine.
To prove , start with an arbitrary element x in . Then use
the definition of to deduce enough information to show that the same x
lies in . Because x was arbitrary, the conclusion applies to every element
of .
This direct-proof pattern is exactly what later chapters reuse for relations, orders, and equivalence classes.
Common mistakes
Common mistake
Complement is not the same as difference
means “everything outside in the chosen universe”. means “the part of that is not in ”. They are related, but not the same.
Common mistake
The universal set cannot be ignored
If you write a complement, you must know what universe you are working in. Otherwise the symbol is ambiguous.
Common mistake
Order matters in products
and usually contain different ordered pairs. This is why products are the correct language for functions and relations.
Quick checks
Quick check
If and , what is ?
Keep only the elements that belong to both sets.
Solution
Answer
Quick check
Why is not defined until a universal set is chosen?
Ask what the complement is supposed to be taken inside.
Solution
Answer
Quick check
Ten students go hiking. Seven use sunscreen, six wear a hat, and two use neither. How many use both?
Translate the two students using neither into the size of the union first.
Solution
Answer
Quick check
If , what do and simplify to?
Use the absorption laws from the theorem above.
Solution
Answer
Quick check
Suppose , but is not a subset of and not a subset of . Which two parts of must be non-empty?
Turn each failed subset statement into an existential statement.
Solution
Answer
Why this matters later
This unit is the first place where the course starts building the later number systems in a disciplined way.
- is used to construct the integers.
- Equivalence classes are later used to construct the rationals.
- Relations on one set become the language for orders and classes.
- Power sets and products reappear whenever we talk about families of subsets or tuples.
Read and try
Compare one pair of sets
The live explorer lets you move elements in and out of A and B and watch the resulting operations update immediately.
Set A
Set B
Union
{1, 2, 3, 4}
Intersection
{2, 4}
Difference A \ B
{1}