Maths WorkshopMaths problems with full solutions
Exercise 341Logic, sets and proofs › Countability and cardinalityL1Added 31 Oct 2026

The integers are countable

#bijection#countability

Statement

Show that there is a bijection from N\mathbb{N} to Z\mathbb{Z}.

Hint

Send even numbers to non-negative integers and odd numbers to negative integers.

Show solutionHide solution

Solution

Define f:N→Zf:\mathbb{N}\to\mathbb{Z} by
f(n)={n2if n is even,−n+12if n is odd.f(n)=\begin{cases}\dfrac n2&\text{if }n\text{ is even},\\[2mm]-\dfrac{n+1}{2}&\text{if }n\text{ is odd}.\end{cases}
The values start 0,−1,1,−2,2,−3,…0,-1,1,-2,2,-3,\dots

On even numbers n=2kn=2k we have f(n)=kf(n)=k, which takes every non-negative integer exactly once. On odd numbers n=2k+1n=2k+1 we have f(n)=−(k+1)f(n)=-(k+1), which takes every negative integer exactly once.

The two sets of values are disjoint and together cover Z\mathbb{Z}, so ff is a bijection.