What function to use to show one to one correspondence? This problem is from Discrete Mathematics and its Applications


Here's an example problem that the author gave


I'am working on problem 2e. I first recognized the set as countably infinite. If you do the Cartesian product of A with some zs say a portion of it, {1,2,3}, you get coordinates {(2,1),(2,2),(2,3)...} and so on which are countable and keep going(because the set of integers keeps going on. My question is what function to use to show the one to one correspondence between the set of positive integers and this set(Cartesian product of A and z+. set of positive integers)? I have a hard time with coming up with some function that will map a positive integer to a member of this set. The example problem's function was pretty intuitive. If you have a positive integer, to map to a odd positive integer, have a function like f(n) = 2n -1, or multiply it by 2 and subtract 1. What about this case?
Let $f:\mathbb{N}\to \mathbb{Z} \setminus \{0\}$ be

$$f(n) = \begin{cases}\dfrac{n+1}{2} &amp; n \ \text{ is odd}\\ -\dfrac{n}{2} &amp; n \ \text{ is even}\end{cases}$$

Then define $g:\mathbb{Z}\setminus \{0\}\to A\times \mathbb Z^+$ as

$$g(n) = \begin{cases}\{2\}\times \{-n\} &amp;: n &lt;0\\ \{3\}\times \{n\} &amp;: n &gt;0\end{cases}$$

$f$ and $g$ are both bijections. So $g\circ f$ is also a bijection.
Here's a simple function that maps the tuples in $\{2, 3\}\times \mathbb Z^+$ to the positive integers.

Let $(t_0, t_1)$ be a member of $\{2, 3\}\times \mathbb Z^+$

Then $(t_0 - 2)(2t_1 - 1) - (t_0 - 3)(2t_1)$ maps each $(t_0, t_1)$ to a unique member of $\mathbb Z^+$

If $t_0 = 2$ the 1st term vanishes and we get $-(-1)(2t_1)$ = $2t_1$

If $t_1 = 3$ the 2nd term vanishes and we get $(1)(2t_1 - 1)$ = $2t_1 - 1$

So we've mapped tuples of the form $(2, t_1)$ to even numbers and tuples of the form $(3, t_1)$ to odd numbers.

Inverting this function will be left as an exercise for the reader. :)