# SP18:Lecture 8 Cardinality

We proved some of the claims about inverses from the last lecture, and defined set cardinality relationships in terms of 'jectivity.

# Inverses and 'jectivity

At the end of the last lecture, we made several claims about the relationship between inverses and 'jectivity:

In this lecture we prove one direction of these claims; the other directions are left for homework.

## Function equality

Recall that the definition of left inverse states that two functions are equal:

Therefore, in order to prove that functions are left inverses of each other, we must have a definition of function equality:

Two functions and are equal (written ) if they agree on every input. In other words, if, for all , .

## Proof outlines

We now proof that injections have left inverses and surjections have right inverses. The idea behind these proofs is that we do the best we can to construct an inverse.

## Injections have left inverses

Proof: injections have left inverses
To demonstrate the technique of the proof, we start with an example.

We want to construct an inverse for ; obviously such a function must map to 1 and to 2. We must also define (so that is a function, i.e. total). So we'll just arbitrarily choose a value to map it to (say, 2).

Then we plug into the definition of left inverse and we see that and , so that is indeed a left inverse.

Note that this wouldn't work if was not injective. For example,

then the we constructed would need to map to both and ; if we did both then would be ambiguous and thus not a function. If we chose one of the two (say ), then would give the wrong answer on the other ( would be , not ).

Here is the general proof:

Choose an arbitrary , , and an injection . We want to show that there exists a left inverse of .

Let be an element of (we know that such an element exists because ).

Let be given by

is well defined, because if and then (since is injective). Thus the output of is unambiguous.

To see that is a left inverse of , choose an arbitrary ; we have

so , which is the

definition of a left inverse.

## Surjections have right inverses

We want to construct an inverse for ; obviously such a function must map to a, but we have a choice of where to map . We can't map it to both and (because then would be ambiguous), but we can just pick one of them (say ).

Then we plug into the definition of right inverse and we see that and , so that is indeed a right inverse.

Note that this wouldn't work if was not surjective, (for example, if had no pre-image) we wouldn't have any output for (so that wouldn't be total).

Here is the general proof:

Proof: surjections have right inverses
Choose an arbitrary , , and a surjection . We want to show that there exists a right inverse of .

Define on input as follows: we know that there exists at least one with , since is surjective. Choose one of them and call it .

Note: it is not clear that there is an unambiguous way to do this; the assumption that it is possible is called the axiom of choice.

Now, we must check that is a right inverse of , i.e. that .

Choose an arbitrary . We have by definition of . Therefore

as required.

# Cardinality definitions

You may have noticed that in our examples of injections , there are always at least as many elements in as there are in . Similarly, surjections always map to smaller sets, and bijections map to sets of the same size.

This insight lets us use functions to compare the sizes of sets in a way that applies to infinite sets as well as finite sets. We give some definitions here.

The cardinality of a set (written ) is the size of the set. However, for the time being, we will not use this definition by itself. Doing so will encourage you to write proofs about cardinality that don't apply to infinite sets.

Instead, we will only define relationships between the cardinalities of sets; these definitions come from the intuitive relationship between sizes and 'jectivity described above.

Definition:
If and are sets, then means that there exists an injection
Definition:
If and are sets, then means that there exists a surjection
If and are sets, then means that there exists a bijection

## Cardinality properties

Note that it is dangerous to redefine symbols like ≤ and ≥! People expect that these relations work the same way they do for numbers, but it is not a-priori obvious that they do. For example, you might expect that

Luckily, these are all true (most will be proved on the homework), but it's important to note that they need to be proved!

The last of these claims is called the Cantor-Schroeder-Bernstein theorem; the proof is much more difficult than the others.