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.
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
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.
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 .
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
If , what do and simplify to?
Use the absorption laws from the theorem above.
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}