Lecture 4 supplement: detailed proof

Here are the details of the proof we gave today that if \(|A| \leq |B|\) and if \(|B| \leq |A|\) that \(|A| = |B|\). This is called the Cantor-Schröder-Bernstein Theorem.

See Wikipedia for another writeup.


First a reminder of some relevant definitions:

The proof

We will do a direct proof. Assume that \(|A| \leq |B|\) and \(|B| \leq |A|\). By definition, this means that there exists functions \(f : A → B\) and \(g : B → A\) that are both one-to-one.

Our goal is to piece these together to form a function \(h : A → B\) which is both one-to-one and onto.


To build the function \(h\), we need to give its output on every input. To define it, we need to consider chains of elements that are formed by repeatedly applying \(f\) and \(g\).

The chain of an element \(x \in A\) contains \(x\), \(f(x)\), \(g(f(x))\), \(f(g(f(x)))\), \(g(f(g(f(x))))\) and so on. It also contains any elements that can be reached by going backwards along the chain. That is, if there happens to be some \(y\) such that \(g(y) = x\), then \(y\) is in the chain.

There need not be such a \(y\) because \(g\) is not onto. However, if there is a \(y\), it must be unique, because \(g\) is one-to-one. If such a \(y\) exists, we will call it \(g^{-1}(y)\). This discussion shows that \(g^{-1}\) is a partial function.

Similarly, the chain of \(x\) will include \(f^{-1}(g^{-1}(x))\), \(g^{-1}(f^{-1}(g^{-1}(x)))\) and so on.

We want to distinguish between various types of chains, based on what happens as you walk backwards along them (that is, if we consider \(x\), \(g^{-1}(x)\), \(f^{-1}(g^{-1}(x))\), ... as defined above). There are 4 types:

  1. The chain forms a loop
  2. Chains that go "backwards" forever without repeating.
  3. Chains that stop in \(A\). That is, they end on some \(x\) with \(g^{-1}(x)\) undefined.
  4. Chains that stop in \(B\).

Note that every element of both \(A\) and \(B\) is part of exactly one chain.

Constructing \(h\)

We define \(h\) as follows. If \(x\) is in a chain of type 1, 2, or 3, then we define \(h(x) = f(x)\). If \(x\) is in a chain of type 4, then we define \(h(x) = g^{-1}(x)\). \(g^{-1}(x)\) is defined, because if it wasn't, then \(x\) would be in a chain of type 3.

What's left is to show that \(h\) is one-to-one and onto.

Proof that \(h\) is one-to-one

We must show that whenever \(h(x_1) = h(x_2)\), that \(x_1 = x_2\). We will prove this directly: assume that \(h(x_1) = h(x_2)\). Notice that \(h(x)\) is always part of the same chain as \(x\). Therefore, \(x_1\) and \(x_2\) must be in the same chain.

Let's consider the possible types of chains:

In any case, we have shown that \(x_1 = x_2\), so we conclude that \(h\) is one-to-one.

Proof that \(h\) is onto

Given an arbitrary \(y \in B\), we must find some \(x \in A\) with \(h(x) = y\). We consider the chain containing \(y\).

In either case, we have found an element that maps to \(y\), so \(h\) is onto.


We have defined a function \(h : A → B\) and shown that it is both one-to-one and onto. Therefore (by definition) \(|A| = |B|\).