For these proofs, , , , , and .
Functions used for comparing sets
Let be a function. Its image is
and its preimage of is
The notation can mean the preimage of the singleton ; it does not mean that an inverse function exists. An inverse function exists only when the map is bijective.
Definition
Injection, surjection, and bijection
The function is injective if
Thus every element of has at most one preimage. It is surjective if
or equivalently ; every element of the codomain is hit. It is a bijection if it is both injective and surjective.
The codomain matters. For example, defined by is injective but not surjective because is not hit. If its codomain were , the same rule would be bijective. A claim about cardinality must therefore state both the domain and codomain.
Worked example
Checking the three properties
Consider with
The map is not injective because although . It is not surjective because and are not outputs. This small example separates the two conditions: injectivity concerns repeated outputs, whereas surjectivity concerns omitted codomain elements.
Same cardinality and countability
Concept lensStructural
Cardinality as counting and as matching
With finite sets, size can feel like an inventory: count the elements. For arbitrary sets, the definition replaces inventory with a matching test: can every element of be paired with exactly one element of , and vice versa? This is why and the even natural numbers have the same cardinality via , even though is a proper subset of . The bijection records equal size; proper containment alone does not imply strictly smaller cardinality.
Definition
Same cardinality
Sets and have the same cardinality, written
if there is a bijection .
The elements being paired need not be alike. A pairing between numbers and ordered pairs is just as legitimate as a pairing between two lists of numbers. For finite sets this agrees with ordinary counting.
Definition
Finite set
A set is finite if for some , where we represent by the finite label set ; when , this means . We then write . The empty set is finite, with .
Definition
Countable and at most countable
A set is countable in this course if it is finite or if
Equivalently, it is at most countable when it is finite or countably infinite. Some texts use “countable” only for the infinite case, so the phrase “at most countable” removes that convention ambiguity. A set that is not at most countable is uncountable.
For a countably infinite set, an enumeration is a sequence containing every element exactly once. Saying “exactly once” combines surjectivity of the listing with injectivity of its index map. Merely writing down an infinite sequence is not enough: it must be clear why no element is omitted and why repetitions do not occur.
Explicit countable sets
The integers
Theorem
The integers are countable
.
Assume . Define
This gives the list .
Proof. Every integer is either , a positive integer , or a negative integer with . These occur respectively at index , index , and index . Hence is surjective. The three cases have disjoint values, and within the positive or negative cases the displayed indices determine uniquely, so is injective. Therefore is a bijection. If is indexed from , shift the indices by one; the cardinality statement is unchanged.
This is the basic infinite-set surprise: adding all negative integers to does not create a larger cardinality. The comparison concerns the existence of a bijection, not whether one set contains the other.
The rationals
Theorem
The rationals are countable
The set of rational numbers is at most countable, and in fact countably infinite.
Every positive rational has a unique lowest-terms representation , where and . Put in row and column of a grid. Scan the grid by the finite diagonals . Within each diagonal, scan in increasing numerator (any fixed order would do), and retain only coprime pairs. The beginning is
Worked example
Why the rational diagonal scan works
Take . It is already in lowest terms and lies on the diagonal . Only finitely many diagonals precede diagonal , and diagonal contains only finitely many pairs. Thus is reached at a finite position. Conversely, retaining only coprime pairs means that two recorded pairs cannot represent the same positive rational: uniqueness of lowest terms forces to be the same pair. The scan is therefore both onto and one-to-one.
The same argument explicitly proves both directions. No positive rational is missed because it has a lowest-terms pair, and no positive rational is repeated because that pair is unique. If the resulting list is , then
lists all of exactly once. Zero occurs once, and every nonzero rational has one sign and one positive absolute value. Hence is countable. It is not finite: the inclusion from into is injective, so contains infinitely many distinct integers.

Figure. The diagonal scan turns a two-dimensional grid into one sequence; the lowest-terms condition removes duplicate names for the same rational.
Density is a different property. The rationals meet every nonempty open interval of the real line, but the diagonal procedure still places them in a single list. Dense does not mean uncountable.
Products of countable sets
The grid argument also gives a useful explicit pairing of two copies of . For , let
All pairs with fixed form a finite diagonal, and the triangular number skips exactly the preceding diagonals. Therefore lists every pair once. More formally, from one recovers the unique diagonal satisfying , then and . Thus is a bijection.
Theorem
A countable triple is countable
.
Proof. Define
Both applications of are bijections, so their composition is a bijection from to . The inverse first recovers and then recovers . This is the concrete content of “countable times countable times countable”: a finite-dimensional grid can be scanned by successive finite diagonals. The argument also handles empty factors in the usual way: if one factor is empty, the product is empty and therefore finite; the displayed bijection concerns three copies of .
The same pairing handles a finite number of labelled copies of a countable set. For example, map and into by . The map is injective, so two copies of can be stored in one copy of ; applying the inverse pairing to the appropriate coordinates recovers the label and the original number. This explains why an infinite list can absorb a finite amount of extra bookkeeping. It does not say that every enlargement has the same size: the existence of the particular map must still be proved.
More generally, cardinality comparisons can be transported through maps. If and are injections, their composition gives . If both maps are bijections, the composition is a bijection. These two simple rules are the bookkeeping behind the integer, rational, and triple enumerations in this section.
Cardinal inequalities
Definition
Cardinal inequality
For sets and , write
if there exists an injection . Write if and .
The arrow direction is essential: an injection from into says that has enough distinct locations to store every element of , so the domain is the no-larger side. The inclusion , , proves ; it does not alone prove equality. The enumeration of supplies the reverse size comparison, or the explicit bijection above supplies equality directly.
Worked example
A finite comparison with unused codomain elements
The map given by , , is injective. Thus . It is not surjective because is unused, which is exactly why the inequality may be strict.
Theorem
Cardinal inequalities form a partial-order pattern
The relation is reflexive, transitive, and antisymmetric on cardinalities. Consequently is irreflexive and transitive.
Proof. Reflexivity follows from the injective identity map . For transitivity, if and are injections, then is injective: equality of its outputs first gives equality of the outputs, then equality of inputs. Antisymmetry is precisely the Cantor-Bernstein theorem below. Finally, is impossible because ; transitivity of strict inequality follows by combining transitivity of with the unequal-cardinality conditions.
There is no set whose elements are all sets. Assuming such a universal set would permit a Russell-type self-membership construction and a contradiction. Accordingly, is not being presented as one relation with a global “set of all sets” as its domain. The partial-order statements are about any chosen collection of sets, or the cardinalities represented by that collection, that we are comparing. This qualification is foundational bookkeeping; it does not change any of the maps or proofs above.
A surjection intuitively says that is no larger than , but turning that intuition into an injection requires selecting one preimage for each . The next note examines that choice issue; here we use injections and bijections directly, without assuming a choice function.
Countable unions of countable sets
Theorem
A countable union of countable sets is countable
Assuming the axiom of choice, if is a countable family of countable sets, then
is countable.
The empty-union case is immediate: if , the empty function is an injection into . Now assume is nonempty. Since each is countable, for each index there exists an injection
When , the unique empty function is such an injection. We use the axiom of choice to choose the whole family of injections simultaneously, including those empty-member cases. This is a choice issue about the family of witnesses; it is not a claim that a countable union of arbitrary uncountable sets is countable.
Now define
where
The index set is nonempty because belongs to the union, and the well-ordering of gives its least element. This consequence of induction is proved in 6.3 Intervals, Cantor set, density, and well-ordering. The map is injective. If , equality of the first coordinates gives . Equality of the second coordinates then gives , and the injectivity of gives .
Finally, diagonal enumeration gives an injection , so composing it with makes countable. List , then the pairs whose coordinates sum to , then those whose coordinates sum to , and so on; each pair appears at a finite stage. The index set and every member must be countable: an uncountable index set of singletons, or one uncountable member, can make the union uncountable. Empty members contribute no element.
Common mistake
Countable union is not the same as arbitrary union
The theorem here is about a countable family . It does not say that an arbitrary union of countable sets must be countable.
Theorem
is dense in
Let and let . By the Archimedean property, choose such that
Choose the largest integer satisfying
Then
Dividing by gives
Thus
satisfies . Therefore is dense in .
Polynomials as finite formal sums
Definition
Polynomial over R
A polynomial with real coefficients is a formal sum
where each and all but finitely many coefficients are zero. The set of all such polynomials is denoted by .
The word "formal" matters. A polynomial is not merely a function value at one particular ; it is the whole list of coefficients, with only finitely many nonzero entries. Once the coefficients are fixed, the polynomial expression is fixed.
Concept lensStructural
Coefficients first, values after substitution
Two formal polynomials are equal precisely when every corresponding coefficient agrees, including omitted zero coefficients. Thus and are equal. Evaluating at a real number instead produces the number . The infinite summation notation involves no convergence question: only finitely many summands are nonzero.
An evaluated value contains less information than the coefficient list. For example, and both give at but have different coefficients. Over , agreement at every real input does imply polynomial equality; later in this note the root bound will justify that converse. Until then, coefficient equality is the definition, and evaluation is an operation applied to the already-defined object.
If at least one coefficient is nonzero, the degree of is the largest index for which . If every coefficient is zero, we call the zero polynomial and set
This convention lets degree formulas include the zero polynomial without many exceptional cases.
A nonzero constant has degree , since its constant coefficient is its highest nonzero coefficient. The zero polynomial has no such coefficient and is not a degree-zero polynomial. In degree comparisons is smaller than every nonnegative integer; use and , including . These are conventions for degree bookkeeping, not claims that a polynomial has a negative integer exponent. The zero polynomial has no leading coefficient and is not monic.
A polynomial is monic if its leading coefficient is . For instance, is monic, while is not.
Common mistake
Do not read the displayed last term as the degree
If a polynomial is written as
then only when . The notation by itself does not guarantee that the displayed final coefficient is nonzero.
Addition, multiplication, and degree
Let
Their sum is formed coefficient-by-coefficient:
Their product is given by the convolution rule:
Only finitely many terms contribute, so the product is again a polynomial.
Theorem
Degree rules
For ,
- ;
- .
The second identity uses the fact that the coefficient field has no zero divisors.
The inequality in the first rule can be strict because leading terms may cancel. For example,
The product rule is stronger: if and are nonzero with leading coefficients and , then the coefficient of in is , which is nonzero.
To see why no higher product term survives, let and . A contribution at an index must have either or , so one coefficient is zero. At index , only the pair , can contribute. Its product is nonzero because the coefficients belong to a field. Consequently a product of two nonzero polynomials cannot be the zero polynomial.
For addition, every coefficient above is zero. If the degrees are unequal, the higher leading term has no counterpart to cancel, so the bound is attained. With equal degrees, cancellation can continue through all coefficients: has degree . If either factor in a product is zero, the product is zero and the stated conventions give the same rule.
Theorem
Division algorithm for polynomials
Let with . Then there exist unique polynomials such that
For existence, consider the nonempty set
It contains by taking . If , choose with and take ; the remainder condition follows from . Otherwise every element of has nonnegative integer degree, so well-ordering gives an element of least degree.
Suppose , with leading coefficients and respectively. Since , the field permits the coefficient . Form
The exponent is nonnegative, so the added expression is a polynomial and is still in . The two leading terms cancel and all remaining terms have degree below . If , it contradicts ; otherwise its smaller degree contradicts minimality. Therefore , and supply the required pair.
Uniqueness is just as important as existence. If
with both remainders of degree less than , then
The left side is either zero or has degree at least ; the right side has degree strictly less than . Thus both sides must be zero, so and .
Proof X-Ray
Where the uniqueness contradiction occurs
Assume the quotients differ. Their difference is then a nonzero polynomial, whose degree is at least . Multiplying by nonzero makes the left side have degree at least . On the right, subtraction may cancel terms, but cannot increase the degree beyond that of the larger remainder. Thus the two sides cannot be equal. The quotients must agree, and substituting back forces the remainders to agree too. This argument uses the degree bound and the nonzero-divisor hypothesis together.
Remainders from evaluation
When the divisor is linear, the division algorithm becomes especially powerful.
Theorem
Remainder theorem
Let and . When is divided by , the remainder is .
Indeed, the remainder has degree less than , so it is a constant . Writing
and substituting gives .
Here is regarded as a constant polynomial in the division identity; it may be zero. We do not divide the identity by and then substitute , since that would divide by zero. Evaluation is legitimate directly in the polynomial identity.
Polynomial divisibility means that if for some polynomial in the same coefficient field. For nonzero , this is equivalent to having zero remainder. In particular, every polynomial divides the zero polynomial, although division with remainder requires a nonzero divisor.
Theorem
Factor theorem
For and ,
The factor theorem translates between algebraic factorization and roots. It is one of the main reasons roots become useful: a root supplies a linear factor, and a linear factor supplies a root.
How many roots can a nonzero polynomial have?
The factor theorem gives a degree bound on roots.
Theorem
Root bound
A nonzero polynomial of degree over or has at most distinct roots.
The base case is degree : a nonzero constant never evaluates to zero. Assume the bound for degree , and let have degree . If it has no roots, the claim already holds. Otherwise choose a root . The factor theorem gives , where is nonzero and has degree by the product rule.
For any distinct root , evaluation gives . The scalar is nonzero in the coefficient field, so . By induction there are at most such distinct roots, plus the one value . This proves the bound for degree . The argument does not require : even if is also a root of , it is still only one value in the set of roots.
An immediate consequence is that a polynomial of degree at most with distinct roots must be the zero polynomial. This is a uniqueness theorem: too many zeros force every coefficient to vanish.
The root bound also needs its exact hypotheses. The zero polynomial vanishes at every input and is excluded. The word “distinct” counts values, rather than the number of times a factor occurs. Applying the bound to shows that polynomials of degree at most agreeing at distinct inputs are equal: otherwise their nonzero difference would have too many roots. Agreement at every real input is a special case, completing the connection between formal polynomials and their evaluated functions.
Countable products and unions with supplied enumerations
Let . For each , suppose a domain and a surjection are given together as one family of data. Empty sets use ; a finite list may use a finite . Under these hypotheses is countable. Likewise, the product of two sets with supplied enumerations is countable.
Proof. Fix the bijection given by
It scans successive finite diagonals. For a union, retain only pairs with and , and, in order of their -indices, output . Every member of the union occurs because its supplied map is surjective. For each output , the set of indices at which occurs is a nonempty subset of , so it has a unique least member. Assigning that least index is injective: one index corresponds to one pair and hence one output. Thus the union is countable; the empty union is immediate. This construction uses the supplied enumeration of each set.
For a product , use the supplied maps and and retain only pairs . The output reaches every product element; assigning the least valid -index of each output proves countability as above. If either factor is empty, the product is empty.
Uniform rational lists. Fix an enumeration of as . For each fixed , enumerate index tuples in by increasing coordinate sum and then lexicographically, and send to . Every tuple occurs; each diagonal is finite. For use the single empty tuple. These rules supply the lists simultaneously for all , so the union of finite rational strings is countable without choosing unspecified lists.
A nonzero rational-coefficient polynomial has finitely many real roots. For each nonzero polynomial in the supplied countable list, list its real roots in increasing order, using an empty list if it has none. Every finite subset of has a unique increasing listing, so this rule supplies the entire family of root lists without an arbitrary choice of enumerations. Their union is the set of real algebraic numbers, hence it is countable.
Density, countability and rational intervals
A set is dense if every nonempty open interval contains an element of . Rational density implies irrational density: fix an irrational and choose rational . Then is irrational. Thus a countable set can be dense, and two disjoint dense sets can coexist. Density and cardinality answer different questions.
Examples
Countable dense rational points. The rational points can be indexed even though every interval contains infinitely many of them. Listing them by denominator and numerator does not make them isolated.
Finite rational data. For each fixed , rational -tuples form a countable set by repeated products. The union over shows that all finite rational strings are countable; in particular, rational-coefficient polynomials are countable. Every nonzero polynomial has finitely many roots, so the algebraic real numbers are countable. Since is uncountable, transcendental numbers exist.
Practice
P01. Let . Give an explicit listing of all integers and a bijection from to the even nonnegative integers.
P02. Show that removing a countable set from an uncountable set leaves an uncountable set.
P03. Prove that every interval with contains an irrational number, using rational density.
P04. Prove that the set of open intervals with rational endpoints is countable and that every open subset of is a union of a subcollection of those intervals.
Full solutions
P01. List the integers as . The map is a bijection from to the even nonnegative integers.
P02. If the removed set and the remainder were both countable, their union would be countable, contradicting the uncountability of the original set. If the removed set is not a subset of the original set, use its intersection with the original set instead.
P03. Fix an irrational , such as . Rational density gives . Then . If it were rational, subtracting would make rational, a contradiction.
P04. Pairs of rationals are countable, so the subset whose first coordinate is less than the second is countable. If is in an open set , choose with , then choose rationals and . The interval contains and lies in . The union of all such intervals is exactly ; for the union is empty.