Introduction
A set is an unordered collection of distinct objects, called its elements or members. Sets are the common language of discrete mathematics: relations and functions are sets of ordered pairs, a graph is a pair of sets, an event in probability is a set of outcomes, a formal language is a set of strings, and a database relation is a set of tuples.
The topics are the notation, the algebra of set operations, the size of finite sets built from other sets, and the distinction between countable and uncountable infinite sets, which matters in the theory of computation.
Prerequisites
- None formally. The connectives of Propositional Logic () are mirrored by complement, intersection and union.
Core concepts
Notation and conventions
- : is an element of ; : it is not.
- Roster form ; set-builder form .
- Order and repetition do not matter: . A collection where repetition matters is a multiset.
- Standard sets. integers, rationals, reals. Convention in these notes: includes 0 (as in Rosen); . Some textbooks start at 1, so read each question's definition.
- The empty set has no elements. : the second set has one element.
- is the cardinality (number of elements) of a finite set .
Subsets and equality
- (subset) means every element of is in : .
- or (proper subset) means and . Some books use for ; these notes write when properness matters.
- if and only if and . This "double inclusion" is the standard way to prove two sets equal.
- For every set : and . ( is vacuously true.)
- Membership and subset differ: for , both and hold, and also holds; holds too.
Set operations
Fix a universal set containing every set under discussion.
| Operation | Notation | Definition |
|---|---|---|
| Union | ||
| Intersection | ||
| Difference | or | |
| Complement | or | |
| Symmetric difference | or |
and are disjoint if . A partition of a non-empty set is a collection of non-empty, pairwise disjoint subsets whose union is (partitions correspond to equivalence relations; see Relations).

Set identities
Each identity corresponds to a law of propositional logic (replace by , by , complement by ).
| Law | Identity |
|---|---|
| Identity | , |
| Domination | , |
| Idempotent | , |
| Complementation | |
| Commutative, associative | for , and |
| Distributive | , |
| De Morgan | , |
| Absorption | , |
| Complement | , |
| Difference |
Useful facts about symmetric difference: , , and if and only if (so has cancellation). Union and intersection have no such cancellation: does not imply .
Power set
The power set (also ) is the set of all subsets of . If , then
because each of the elements is independently in or out of a subset. Example: . Note , which has one element, and .
Cartesian product
The Cartesian product is a set of ordered pairs: if and only if and . In general , and
. A relation from to is any subset of , so there are relations from to .
Sizes of unions: inclusion-exclusion
For finite sets :
The general -set formula and its counting applications are in Counting.
Related identities: , , and .
Countable and uncountable sets
Two sets have the same cardinality if there is a bijection between them (see Functions). A set is countable if it is finite or has the same cardinality as (countably infinite); otherwise it is uncountable.
| Countable | Uncountable |
|---|---|
| , | , any interval with |
| , all finite strings over a finite alphabet | , the set of all languages over a non-empty alphabet |
| A countable union of countable sets | The set of all functions |
| The set of all programs (Turing machines) | The set of all real numbers in |
Cantor's theorem: for every set , there is no surjection from onto , so . Proof sketch (diagonal argument): given any , the set differs from every at the element , so is not in the range of .
Consequence for computing: there are countably many programs but uncountably many languages over , so some languages are not recognised by any program. This is the counting argument behind undecidability.
Worked examples
Example 1: an identity by algebra
Simplify .
Union with : .
Example 2: inclusion-exclusion
Among the integers 1 to 100, how many are divisible by 2, 3 or 5?
Let be the multiples of 2, 3 and 5. Then , , , , , , .
So 74 are divisible by at least one of them and by none.
Example 3: power sets and products
Let , . Then , (the number of relations from to ), and .
Example 4: a tricky membership question
. Which are true? (i) ; (ii) ; (iii) ; (iv) ; (v) ; (vi) .
All six are true. (i) and (iii) list the two elements; (ii) holds for every set; (iv) holds because the single element of is in ; (v) holds because ; (vi) because .
Example 5: symmetric difference
, . , and . Check cancellation: .
Important properties and observations
- is equivalent to each of , , , and .
- in general; difference is neither commutative nor associative.
- , but only (equality only when one of contains the other).
- and .
- An infinite subset of a countable set is countably infinite; a superset of an uncountable set is uncountable.
GATE examination perspective
- Identity MCQs. Reduce with and De Morgan, or test with a three-set Venn diagram (8 regions) by checking which regions each side shades.
- Counting with sets. Inclusion-exclusion for "divisible by" and "at least one" questions; complements for "none of".
- Power-set and product sizes. subsets, relations from an -set to an -set.
- Countability. Expect statements such as "the set of all languages over is countable" (false) or "the set of all Turing machines is countable" (true).
- Trap: versus , and versus .
- Trap: whether contains 0 changes answers about smallest elements and counts. Check the definition given.
Summary
Sources
- K. H. Rosen, Discrete Mathematics and Its Applications, 7th ed., McGraw-Hill, 2012: Sections 2.1 (Sets), 2.2 (Set Operations) and 2.5 (Cardinality of Sets).