Evanalysis
6.1Embedded interactionEstimated reading time: 15 min

6.1 Cardinality, countability, and cardinal inequalities

Compare sizes of sets by bijections and injections, prove that Z and Q are countable, and read the Cantor-Bernstein theorem as the antisymmetry principle for cardinal size.

Course contents

MATH1090: Set theory

Rigorous course notes on logic, sets, number construction, the real numbers, limits, cardinality, and the first algebraic structures, written in linked sections with careful proofs and examples.

Chapter 7Sets with structure1 sections

Chapter 6 begins with a change of viewpoint. Earlier chapters built and studied particular number systems. Here the question is broader: how can we compare the sizes of sets, especially when the sets are infinite?

For finite sets, counting elements is enough. For infinite sets, the useful notion is not ordinary counting but the existence of carefully chosen functions. A bijection says that two sets have exactly matching elements. An injection says that one set can be faithfully coded inside another.

Same cardinality

Definition

Same cardinality

Let XX and YY be sets. We say that XX and YY have the same cardinality, and write

X=Y,|X|=|Y|,

if there exists a bijection f:XYf:X\to Y.

This definition deliberately avoids saying that the elements have to look similar. The two sets may have very different kinds of elements. What matters is whether every element of XX can be paired with exactly one element of YY, and every element of YY is paired with exactly one element of XX.

For finite sets this agrees with ordinary counting. If a set can be put in bijection with a set of n labels, then it has n elements.

Definition

Finite set

A set XX is finite if

X=n|X|=|n|

for some natural number n.

In that case we usually write simply X=n|X|=n.

The notation |X| is therefore not a number in the usual sense for every set. It is a symbol for the size, or cardinality, of XX. For finite sets this size is represented by a natural number. For infinite sets, we compare sizes through maps.

Countable and uncountable sets

Definition

Countable and uncountable

A set XX is countable if it is finite or if

X=N.|X|=|N|.

A set which is not countable is called uncountable.

Thus a countably infinite set is one whose elements can be listed in a sequence without omission and without repetition:

x0,x1,x2,x_0,x_1,x_2,\ldots

depending on the indexing convention for NN. The exact starting index is not important. What matters is that there is a bijection from the natural numbers to the set.

Common mistake

Countable does not mean finite

In this chapter, countable includes finite sets and sets with the same cardinality as NN. The word "countable" is therefore broader than "finite".

The integers are countable

A useful exercise is to prove that

N=Z.|N|=|Z|.

The key idea is that the integers can be arranged in a single infinite list.

Worked example

Enumerating the integers

One convenient ordering is

0,1,1,2,2,3,3,.0,1,-1,2,-2,3,-3,\ldots .

This list reaches every integer exactly once. It therefore gives a bijection from NN to ZZ after choosing the corresponding indexing convention.

For example, with N={0,1,2,}N=\{0,1,2,\ldots\}, define

f(0)=0,f(2k1)=k,f(2k)=kf(0)=0,\qquad f(2k-1)=k,\qquad f(2k)=-k

for k1k\ge 1. Then f:NZf:N\to Z is bijective.

Proof

Why this proves countability

The example is important because it shows the first surprise about infinite sets: a proper-looking enlargement of NN can still have the same cardinality as NN.

The rationals are countable

Theorem

The rationals are countable

The set QQ of rational numbers is countable.

The proof first treats the positive rationals. It is enough to enumerate Q+Q_+, because then one may interleave positive rationals, negative rationals, and zero.

The positive rational numbers can be organized by numerator and denominator. A positive rational in lowest terms has the form

pq\frac{p}{q}

where p,qNp,q\in N are positive and share no common factor greater than 1. Place this rational at row p and column q in an infinite grid. Then traverse the grid by diagonals:

p+q=2,p+q=3,p+q=4,p+q=2,\quad p+q=3,\quad p+q=4,\quad \ldots

and record the reduced fractions encountered along the way.

Worked example

The first few positive rationals by diagonals

Following the diagonals and keeping only fractions in lowest terms gives a list beginning like

1, 12, 2, 13, 3, 14, 23, 32, 4,.1,\ \frac12,\ 2,\ \frac13,\ 3,\ \frac14,\ \frac23,\ \frac32,\ 4,\ldots .

The exact displayed beginning is less important than the mechanism: every positive rational p/q in lowest terms appears on the diagonal p+qp+q, and that diagonal is reached after finitely many previous diagonals.

A diagonal scan of positive rational numbers

Figure. The diagonal scan is not a decorative picture; it is the mechanism that turns a two-dimensional grid of positive rationals into one sequence.

Why does this produce a bijection with Q+Q_+?

  • It is surjective because every positive rational has a lowest-term representative p/q, hence occurs somewhere in the grid.
  • It is injective because using lowest terms prevents repetitions such as 1/1, 2/2, and 3/3 from all being recorded as the same rational.

Once Q+Q_+ is listed, the full set QQ can be listed by alternating signs and including zero:

0, q1, q1, q2, q2, q3, q3,.0,\ q_1,\ -q_1,\ q_2,\ -q_2,\ q_3,\ -q_3,\ldots .

So QQ is countable.

Common mistake

A dense set can still be countable

The rationals are dense in the real line, but density is not cardinality. The diagonal enumeration shows that the rationals can still be placed into one sequence.

Comparing cardinalities by injections

Bijections decide equality of cardinality. To compare unequal sizes, we use injections.

Definition

Cardinal inequality

Let XX and YY be sets. We write

XY|X|\le |Y|

if there exists an injection f:XYf:X\to Y.

We write

X<Y|X|<|Y|

if XY|X|\le |Y| and XY|X|\ne |Y|.

An injection from XX to YY means that YY has enough room to store a distinct code for every element of XX. This is why it is the correct analogue of "less than or equal to" for cardinalities.

Worked example

A simple cardinal inequality

The inclusion map

i:NZ,i(n)=ni:N\to Z,\qquad i(n)=n

is injective. Therefore NZ|N|\le |Z|.

This alone does not prove equality. Equality requires a bijection, or two opposite injections together with Cantor-Bernstein.

Cardinal inequality behaves like a partial order

Theorem

Cardinal inequalities form a partial-order pattern

The relation \le on cardinalities is reflexive, antisymmetric, and transitive. Consequently << is irreflexive and transitive.

Here is the proof structure.

Reflexivity. The identity map

idX:XXid_X:X\to X

is injective, so XX|X|\le |X|.

Transitivity. If f:XYf:X\to Y and g:YZg:Y\to Z are injections, then

gf:XZg\circ f:X\to Z

is also an injection. Thus XY|X|\le |Y| and YZ|Y|\le |Z| imply XZ|X|\le |Z|.

Antisymmetry. This is exactly the Cantor-Bernstein theorem.

Common mistake

There is no set of all sets

Strictly speaking, \le is not a relation on one giant set of all sets, because there is no such set. The point is that the partial-order properties hold for any collection of cardinalities that one is comparing.

Cantor-Bernstein theorem

Theorem

Cantor-Bernstein theorem

Let XX and YY be sets. If

XYandYX,|X|\le |Y| \qquad\text{and}\qquad |Y|\le |X|,

then

X=Y.|X|=|Y|.

In words: if XX injects into YY and YY injects into XX, then the two sets actually have the same cardinality. This looks intuitively obvious, but the proof is more delicate than the finite case.

Here is the standard sketch. Suppose

f:XY,g:YXf:X\to Y,\qquad g:Y\to X

are injections. Since g embeds YY into XX, the image g(Y) is a copy of YY sitting inside XX. The proof builds nested subsets

A0B0A1B1A_0\supset B_0\supset A_1\supset B_1\supset\cdots

of XX by

A0=X,B0=g(Y),A_0=X,\qquad B_0=g(Y),

and

An+1=g(f(An)),Bn+1=g(f(Bn)).A_{n+1}=g(f(A_n)),\qquad B_{n+1}=g(f(B_n)).

The map gf:XXg\circ f:X\to X carries each difference layer

AnBnA_n\setminus B_n

bijectively onto the next difference layer

An+1Bn+1.A_{n+1}\setminus B_{n+1}.

The desired bijection h:XYh:X\to Y is then assembled by using f on the layers where f should be used, and using g1g^{-1} on the remaining part:

h(x)={f(x),xAnBn for some n,g1(x),otherwise.h(x)= \begin{cases} f(x), & x\in A_n\setminus B_n\text{ for some }n,\\ g^{-1}(x), & \text{otherwise.} \end{cases}

The point of the construction is not that one can guess the bijection by inspection. The point is that the two injections provide enough structure to divide XX into pieces and define a genuine bijection piece by piece.

Proof

Why the piecewise definition is plausible

A supporting comparison lab

The widget below is secondary to the proof language. Use it as a way to compare what bijections, injections, and two-sided injections are saying before reading the formal statements again.

Read and try

Compare set sizes by maps

The lab compares equality of cardinality, injection-only comparison, and countable enumeration using concrete maps.

Key relation

|X| = |Y|

Points to

a -> 1, b -> 2, c -> 3

Why it works

Every element of X is used once and every element of Y is hit once, so the displayed function is a bijection.

Common mistakes and subtle points

Common mistake

Do not prove equality from one injection

An injection XYX\to Y proves XY|X|\le |Y|. It does not by itself prove X=Y|X|=|Y|. Equality requires a bijection, or injections in both directions plus Cantor-Bernstein.

Common mistake

Do not count unreduced fractions as different rationals

The symbols 1/1, 2/2, and 3/3 describe the same rational number. The countability proof for Q+Q_+ avoids duplicates by using lowest terms.

Common mistake

A surjection points in the opposite comparison direction

If f:XYf:X\to Y is surjective, it is tempting to conclude immediately that YX|Y|\le |X|. That conclusion is true with the axiom of choice, but the argument postpone the proof until choice functions are introduced.

Quick checks

Quick check

What kind of function proves that two sets have the same cardinality?

Name the function property and say what it does to elements.

Solution

Answer

Quick check

Why does the diagonal argument for Q+ not get stuck on any particular positive rational p/q?

Think about the diagonal containing that fraction.

Solution

Answer

Quick check

If there are injections X to Y and Y to X, what theorem lets us conclude same cardinality?

This is the antisymmetry part of cardinal comparison.

Solution

Answer

Exercises

Quick check

Give an explicit enumeration of Z and explain why it has no repetitions.

Start with 0, then alternate positive and negative integers.

Solution

Guided solution

Quick check

Explain why the composition of two injections is injective.

Use the definition of injective twice.

Solution

Guided solution

Quick check

Why does countability of Q+ imply countability of Q?

Account for zero and negative rationals.

Solution

Guided solution

Read this after 2.2 Functions and relations, especially the sections on injections, surjections, bijections, and partial orders. Then continue to 6.1.2-6.3 Cantor's theorem, continuum, and choice.

Key terms in this unit