How do $\mathbb Z$ and $\mathbb Z^+$ have the same cardinality

abstract-algebraelementary-set-theory

The book "First Course in Abstract Algebra" by John Fraleigh says that $\mathbb Z$ and $\mathbb Z^+$ have the same cardinality.

He defines the pairing like this

1 <-> 0
2 <-> -1
3 <-> 1
4 <-> -2
5 <-> 2
6 <-> -3

and so on.

How exactly is this the same cardinality? Is he using the fact that both are infinite sets to say that they have the same cardinality? Does that mean that all infinite sets have the same cardinality?

Best Answer

You have to focus on the definition of having the same cardinality. By definition, two sets $A$ and $B$ have the same cardinality if there exists a function $f: A \to B$ which is bijective (see the links for more info).

Then, $\mathbb{Z}$ and $\mathbb{Z}^+$ have the same cardinality since there exists a bijection between them. The one you cited, it is just a possible bijection between many, which can be characterized as follows:

\begin{align*} & f: \mathbb{Z}^+ \to \mathbb{Z},\\ f(x) = & \ \begin{cases} \frac{x-1}{2} & \text{ if $x$ is odd;} \\ - \frac{x}{2} & \text{ if $x$ is even.} \end{cases} \end{align*}