Statement
Define by Prove that is a bijection.
Solution
The first values are : the function lists all integers in order.
Surjectivity. Let .
- If , take (odd): .
- If , take (even, ): . In every case has a preimage, so is surjective.
Injectivity. The values on odd inputs are all positive (), those on even inputs are all : so two numbers of different parity have different images. On the odd inputs is strictly increasing, hence injective; likewise on the even inputs with . Therefore is injective.
Being injective and surjective, is a bijection.