Finite and countably infinite sets
Use bijections and enumerations to distinguish finite sets, countably infinite sets and larger cardinalities.
Finite and countably infinite sets
Cardinality measures how many elements a set contains, regardless of what those elements are or how they are ordered. Two sets have the same cardinality if there is a bijection between them. Each element of either set then has exactly one partner in the other.
The entry on cardinality gives the definition. Here we use it to distinguish finite sets, countably infinite sets and uncountable sets.
1. Finite sets
For a positive integer , write
A set is finite of cardinality if there is a bijection . The empty set has cardinality zero. We write
Counting by a bijection gives the same answer in any order. For a finite set, a map is injective exactly when it is surjective.
If two finite sets are disjoint, then
For any pair of finite sets,
If the sets overlap, subtract the elements counted twice.
2. Infinite sets
A set is infinite if it cannot be put in bijection with any finite initial segment . An infinite set can be in bijection with a proper subset of itself.
For example, the map
is a bijection between and the even natural numbers. The fact that a proper subset is strictly smaller holds for finite sets and need not extend to infinite ones.
3. Countability and enumeration
A set is countably infinite if there is a bijection
The function enumerates . Every element appears exactly once, at a finite index. A set is at most countable if it is finite or countably infinite.
A list with repetitions that reaches every element defines a surjection from . To obtain an enumeration without repetitions, keep only the first appearance of each element.
4. The integers are countably infinite
Enumerate the integers by alternating signs.
With , an explicit formula is
Every integer occurs once. Although the list goes on forever, each individual integer is reached after finitely many steps.
5. Countable products and unions
The set is countably infinite. Group the pairs by the sum of their coordinates.
Each diagonal is finite and every pair lies on some diagonal. This construction also shows that
- A product of finitely many countably infinite sets is countably infinite.
- A countable union of at most countable sets is at most countable when enumerations are available. Remove duplicate entries where needed.
- Every subset of an at most countable set is at most countable.
6. The rational numbers are countably infinite
Any rational can be written as with and , . The pairs form a subset of and hence are at most countable.
Several fractions can represent the same number, for example . Retain only reduced fractions with positive denominator or skip repeated values during enumeration. It follows that
The density of on the line is compatible with countability. Density concerns where points lie, while cardinality compares sets by bijections.
7. The real numbers are uncountable
For a contradiction, suppose all numbers in could be listed by their decimal expansions.
At position , choose a digit different from . To avoid a trailing sequence of , choose the new digit from and . The number
differs from at least at digit . It therefore belongs to the interval but is missing from the list. This contradiction shows that and hence are uncountable.
The argument rules out every proposed enumeration, however it is constructed.
8. Power sets and Cantor’s theorem
For any set , the singleton map embeds in its power set . The cardinality of is strictly greater because there is no surjection .
Suppose such a surjection existed. The diagonal set
would equal for some . But this gives
a contradiction. Infinite sets therefore come in different cardinalities.
9. Comparing cardinalities
A bijection proves equality of cardinalities. An injection shows that has cardinality at most that of . If there are injections in both directions, the Cantor–Bernstein theorem gives a bijection.
To make an elementary proof precise,
- Specify the sets and state the convention for .
- Construct an explicit map or a list that reaches every element.
- Check injectivity and surjectivity separately.
- Account for repeated entries or nonunique representations.
- Explain why the construction works for every element.
Applications and limits of cardinality
On a finite space of equally likely outcomes, counting gives
A discrete probability law assigns masses summing to one on a finite or countable support. An uncountable space alone does not guarantee a probability density. For more on these distinctions, see random variables, probability mass functions and probability densities.
If components with possible states can be combined freely, there are configurations. This product explains the rapid growth of exhaustive verification. With bits there are at most alternatives. To encode alternatives, choose the smallest integer satisfying .
A computer stores finite descriptions. Quantization and finite precision turn a continuous model into a finite collection of representable states. Counting them clarifies resolution, memory requirements and information loss. Geometry, probability and frequency of use also matter when distinguishing states in practice.
Common errors
- Assuming every proper subset has smaller cardinality.
- Confusing density with uncountability.
- Writing an infinite list without showing that it reaches every element.
- Counting different fractions that represent the same rational as different numbers.
- Interpreting countability as finiteness or practical feasibility.
- Using decimal diagonalization without handling numbers with two decimal expansions.
Checking your understanding
Construct enumerations of and . Explain why is countably infinite, distinguish density from cardinality and construct a real number that escapes any proposed list.
Worked problems on countability and cardinality
These problems apply the criteria for finite and countably infinite sets. The entry on cardinality gives the definition. Compare sets by maps between their elements. Geometric size, density and order answer different questions.
We use the convention
Here countably infinite means in bijection with . At most countable includes finite and countably infinite sets. Uncountable means neither finite nor countably infinite. The twenty exercises include four introductory problems, eleven intermediate problems and five more demanding ones.
Prerequisites and scope
You will use sets and set operations, number systems, and injective, surjective and bijective functions. We also use Cantor–Bernstein and the fact that the image of an at most countable set is at most countable.
The focus is cardinality. Combinatorial counting, inclusion–exclusion, density, completeness, upper and lower bounds, extrema, suprema and infima are separate topics. In particular, distinguish a finite string from an infinite sequence.
The formulas and tables below specify the exact pairings, enumerations and diagonals used in the proofs.
I. Finite sets and first comparisons
Exercise 1. Counting distinct roots
Find the set of integers satisfying
and find its cardinality.
Aim. Distinguish the number of distinct roots from their algebraic multiplicities.
Solution
The zero-product rule gives the roots , and . The root has multiplicity two, but appears only once in the set.
Check. At each of the three integers at least one factor vanishes. At every other integer all factors are nonzero.
Exercise 2. Removing distinct elements
Let be a set with . Find in the three cases
- e ;
- ;
- e .
Aim. Count the distinct elements removed when a name or value may occur more than once.
Solution
Two different elements are removed in the first case, and only one in each of the remaining cases. Hence
Check. In the second case . In the third case deleting an element outside the set leaves unchanged.
Exercise 3. Proper inclusion in finite sets
Prove that if and is finite, then
Deduce that for finite sets, and imply .
Aim. Identify how a finite set compares with each of its proper subsets.
Method. Partition into and the elements belonging only to .
Solution
Since the inclusion is proper, is nonempty. Furthermore,
with a disjoint union. Both pieces of the finite set are finite, so
Nonemptiness gives , hence .
If and , the inclusion cannot be proper. Therefore .
Check. Finiteness matters. The squares form a proper subset of the natural numbers with the same cardinality as the entire set.
Exercise 4. A parameter separating finite and infinite cases
For , consider
Classify as finite or countably infinite for each possible .
Aim. Check the degenerate parameter before interpreting a formula as an enumeration.
Solution
If , every product is zero.
If , the map
is onto by the definition of . It is also one-to-one, because and imply . Thus is countably infinite.
Check. The sign of changes the values but preserves bijectivity. All inputs give the same value only when .
Exercise 5. As many squares as natural numbers
Let
Show that but .
Aim. Exhibit a proper subset of an infinite set with the same cardinality.
Solution
The natural number is not a square, so . The map
is surjective by the definition of . On the nonnegative integers it is injective, because implies . It is therefore bijective and
Check. Exercise 3 assumed a finite ambient set, so there is no contradiction.
II. Enumerations and countable constructions
Exercise 6. Adding two elements to the natural numbers
Let and be two distinct objects outside , and define
Construct a bijection between and .
Aim. Show that adding finitely many elements preserves the cardinality of a countably infinite set.
Method. Reserve the first two indices for the new objects and shift all original indices.
Solution
Define
Its inverse is
The inverse establishes bijectivity, so is countably infinite.
Check. The values and each have exactly one preimage. Each comes from the natural number .
Exercise 7. Enumerating all integers
Define a bijection that gives the order
Aim. Turn an informal enumeration into an explicit bijection.
Method. Use even indices for nonnegative integers and odd indices for negative integers.
Solution
Set
Its first values are
|
|
|
|
|
|
|
|
|
|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
Each has the unique preimage
Hence is bijective and .
Check. The two inverse formulas give nonnegative even and odd indices, respectively, and together cover all integers.
Exercise 8. Finitely many copies of the natural numbers
Fix . Prove that
is countably infinite.
Aim. Interleave a finite number of copies of a countably infinite set.
Method. Encode the copy number as the remainder on division by .
Solution
Define
If , the two expressions have the same remainder modulo . Thus and then . This proves injectivity.
For each , Euclidean division supplies unique and such that
This proves surjectivity and hence bijectivity.
Check. For the pairs occur in the order . None are repeated or omitted.
Exercise 9. The union of two at most countable sets
Suppose and are at most countable. Show that is at most countable, allowing the lists to repeat elements.
Aim. Distinguish a list that reaches every element from a bijection without duplicates.
Method. Interleave one list for and one for . Repetitions cannot enlarge the image beyond the union.
Solution
If either set is empty the result is immediate. Otherwise choose lists
reaching all elements. For a finite nonempty set, the entries can repeat. Define
Every element of occurs in . This gives a surjection from onto , so the union is at most countable. If it is infinite, keeping only first occurrences yields a bijection with .
Check. Repeating a value can prevent from being injective, but it cannot omit an element reached by either list or add elements outside the union.
Exercise 10. Enumerating pairs of natural numbers
Prove that is countably infinite using
Aim. Convert a diagonal traversal into an explicit bijection.
Method. Group pairs by their coordinate sum . Triangular numbers mark the first index on each diagonal.
Solution
Write
On the diagonal the formula reduces to . The first pairs and their ranks are
|
Rank |
|
|
|
|
|
|
|
|
|
|
|---|---|---|---|---|---|---|---|---|---|---|
|
Pair |
|
|
|
|
|
|
|
|
|
|
Given a rank there is a unique such that
Recover the corresponding pair as follows.
This reconstruction is unique, so is bijective.
Check. From to inclusive there are exactly ranks, the number of points on diagonal .
Exercise 11. Why the rational numbers are countably infinite
Prove that is countably infinite using reduced representations and the preceding results.
Aim. Encode rationals uniquely, taking account of signs, denominators and equivalent fractions.
Method. Write each rational as its unique reduced fraction with positive denominator. Then encode the numerator–denominator pair.
Solution
Each has a unique representation
This defines an injection
Its target is countable. Encode by the inverse from exercise 7, encode by , then use the pairing function from exercise 10. There is also an injection from to .
The Cantor–Bernstein theorem now gives
Check. Requiring fixes the sign convention. Reduction to lowest terms removes duplicates such as and .
Exercise 12. All finite binary strings
Let be all finite binary strings, including the empty string . Construct a bijection with .
Aim. Distinguish finite words of arbitrary length from infinite sequences.
Method. Prefix each word with and read the result as the binary expansion of a positive integer.
Solution
Define as the natural number whose binary representation is the concatenation . For example,
|
|
|
|
|
|
|
|
|
|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Every positive integer has a unique binary expansion beginning with . Removing that digit recovers the unique word . Thus is a bijection.
Check. The empty word corresponds to the binary numeral .
Exercise 13. Subsets of a countably infinite set
Let be countably infinite and . Prove that is at most countable and that it is countably infinite if it is infinite.
Aim. Prove the result without requiring a formula for the subset or assuming it is finite.
Method. Use an enumeration of to identify with a set of natural-number indices. List the chosen indices in increasing order.
Solution
Let be a bijection and define
Restricting gives a bijection . If is finite, so is . If is infinite, define
Each minimum exists by well-ordering. The remainder cannot become empty, since is infinite. Every is eventually listed. Otherwise would remain available forever, and every new minimum would be at most . Infinitely many distinct minima cannot all belong to the finite set . Thus enumerates .
Check. The construction orders natural-number indices. It requires no order, density or limiting process on .
III. Countable unions and diagonal arguments
Exercise 14. A countable union of sets with given enumerations
For every let be at most countable. For each nonempty , a list reaching all its elements is supplied. Finite lists may be extended by repetition. Prove that
is at most countable.
Aim. Combine a countable family of given lists into one list.
Assumptions. The enumerations are supplied, so no simultaneous choice is required. If the union is nonempty, use a fixed element to fill the rows of empty sets. Repetitions do not affect the image.
Method. Visit pairs of indices and positions using the bijection from exercise 10.
Solution
If , the claim is immediate. Otherwise fix . For , write the given list as
and for set for every . Define
The map sends onto . For each there is an index with , and that list has a position with . Composing with gives a surjection
Its image is at most countable. If is infinite, keeping the first occurrence of each element produces a bijection with .
Check. Diagonal visits the pairs satisfying . Each pair belongs to exactly one diagonal.
Exercise 15. A diagonal argument for the power set
Prove that is uncountable.
Aim. Construct a subset missing from any proposed enumeration.
Assumptions. Suppose a list contains every subset of . Position in row indicates whether belongs to that subset.
Method. Reverse each membership decision on the diagonal .
Solution
Define
For every ,
Thus and disagree on at least . The subset belongs to but is absent from the list, contradicting completeness.
Check. We do not seek an element outside all the . We construct a new subset differing from row at position .
Exercise 16. Cantor’s theorem for any set
Let be any set. Show that no surjection exists
and deduce .
Aim. Generalize diagonalization without assuming is countable.
Assumptions. The set may be finite, infinite or empty. Strict inequality requires both an injection from to its power set and the impossibility of a bijection.
Method. Collect the elements missing from their own images. Compare this set with each possible value .
Solution
Suppose were surjective. Define
Since , surjectivity gives some with . This implies
a contradiction. No function is surjective.
The map is an injection from to . Since no bijection is possible,
Check. When , the domain is empty and . The inequality still holds.
Exercise 17. A decimal diagonal in the unit interval
Use Cantor’s diagonal argument to prove directly that is uncountable.
Aim. Construct a real number missing from the list while handling the two expansions of a terminating decimal.
Assumptions. For each real number choose the decimal expansion without an infinite tail of . Two different normalized expansions then give different numbers.
Method. Use only digits and in the new decimal, preventing a tail of .
Solution
Suppose a complete list exists.
|
Row |
Digit |
Digit |
Digit |
Digit |
Further digits |
|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Define
and set . The number belongs to and has no infinite tail of . For every , digit differs from , so . The proposed list is incomplete.
Check. Choosing between and forces a difference on the diagonal and avoids ambiguities such as .
IV. The continuum and applications
Exercise 18. Intervals and the real line
Prove that , and have the same cardinality.
Aim. Distinguish cardinality from proper inclusion and geometric length.
Method. Apply Cantor–Bernstein to the two intervals and give an explicit trigonometric bijection from the open interval to the line.
Solution
The inclusion is injective. For the other direction, the map
is injective with image . Hence Cantor–Bernstein gives
The map
is bijective with inverse
Therefore all three sets have cardinality .
Check. The inverse sends every real number into because
Exercise 19. Finite strings and infinite sequences
Compare , the set of finite binary strings, with , the set of infinite binary sequences.
Aim. Show how the same alphabet can generate sets of different cardinalities.
Method. Use the encoding of finite strings above. For an infinite sequence, record the positions occupied by .
Solution
Exercise 12 gave a bijection
so finite strings are countably infinite. Now define
From a subset recover the unique characteristic sequence
This makes a bijection. Its target is uncountable by exercise 15, so infinite binary sequences are uncountable too.
Check. A finite word has finitely many positions. An infinite sequence assigns a value at every natural-number index. Truncating it gives a different object.
Exercise 20. Finite programs and uncomputable functions
A programming language has a finite alphabet. Each program is a finite string that computes at most one function
Prove that some such functions cannot be computed by any finite program.
Aim. Derive a conclusion in theoretical computer science without having to exhibit a particular uncomputable function.
Assumptions. Valid programs form a subset of the finite strings. Different programs may compute the same function, and some programs may fail to halt. Neither feature increases the number of total functions that can be computed.
Method. Compare the set of programs with the set of infinite binary sequences.
Solution
List strings first by length and then lexicographically at each length. All finite strings over a finite alphabet are therefore at most countable, as is the subset of valid programs.
All functions form the set , uncountable by exercise 19. Let be the valid programs computing total binary-valued functions. The map sending each program in to its computed function has at most countable domain. Its image is at most countable and cannot contain all binary-valued functions.
Therefore some binary-valued functions on are not computed by any finite program.
Check. The argument counts programs computing total functions. It does not assume every string is a program or every program terminates.
Guide to the proofs
|
Goal |
Suitable construction |
|---|---|
|
Show a set is finite |
A bijection with |
|
Show it is countably infinite |
A bijection with |
|
Show it is at most countable |
An injection into the natural numbers, or for a nonempty set, a surjection from them |
|
Compare two cardinalities |
An explicit bijection, or injections both ways and Cantor–Bernstein |
|
Prove uncountability |
A diagonal construction producing an element outside any proposed list |
|
Construct a larger cardinality |
Pass from to |
State exactly which kind of map has been constructed. A list with repeated entries can establish at most countability even if the list itself is not a bijection. Proper inclusion gives strictly smaller cardinality in finite sets. For infinite sets compare the cardinalities using maps.
Back to contents