# Is this function bijective?

Consider the function $\theta:\{0,1\}\times\mathbb{N}\rightarrow\mathbb{Z}$ defined as $\theta(a,b) = a-2ab+b$. Is this function bijective?

For injective, I tried doing the contrapositive by supposing $\theta(a,b)=\theta(c,d)$, then $a-2ab+b=c-2cd+d$, but I have no idea where to go from there. I tried solving for a and b separately and plugging it back in, but that just turned into a huge algebraic mess.

I haven't figured what I'm going to do for surjective yet.

I'm not very good at this subject, so sorry if this is a stupid question. Any hints are appreciated, thanks.

-
Is $\mathbb{N}=\{0,1,\dots\}$ or $\{1,2,\dots\}$? –  yunone Aug 1 '12 at 0:48
Hint: the domain of your function is the product of the two-element set $\{0, 1\}$ and the natural numbers. That means that it consists of all pairs of the form $(0, n)$ or $(1, n)$. We then have $\theta(0, n) = n$ in the first case and $\theta(1, n) = 1-n$ in the second. That ought to make your life easier for both injectivity and surjectivity. –  Rick Decker Aug 1 '12 at 0:50
N = {1,2,3,4...} –  laser295 Aug 1 '12 at 0:53

Formulas are nice, but let's find out what's really going on: $\theta(0,b)=b\,$ and $\theta(1,b)=1-b$. Much clearer.

Could $x=1-y\,$ where $x$ and $y$ are natural numbers? Depends on what one means by natural number. It can certainly happen if we allow $0$ to be a natural number. I am inclined to allow that, out of loyalty to logic, where it is a standard convention. But I am in a minority. Certainly it cannot happen if $x$ and $y$ are positive.

Finally, for surjectivity (love that word) is every integer of the form $x$ or $1-y$ where $x$ and $y$ are positive integers? Sure.

-
Minority or not, the OP intended $\mathbb{N}$ to be the positive integers. +1 for tidy answer. –  Rick Decker Aug 1 '12 at 1:01
Thank you Andre and Rick, I understand it much better now. –  laser295 Aug 1 '12 at 1:09

Hint $\$ Glue the bijections $\rm\ b = f_{\,0}(b):\Bbb N\to \Bbb N\$ and $\rm\ 1\!-\!b = f_{\!\ 1}(b): \Bbb N\to\, {-}\Bbb N\cup \{0\}\$ as below:

If $\rm\:S_0,\,S_1\:$ are disjoint subsets of $\,\Bbb Z\,$ and $\rm\:f_{\,i}(b) :\Bbb N\to S_i\,$ are bijections for $\rm\,i\in\{0,1\}\,$ then $\rm\:f(a,b):\{0,1\}\times\Bbb N \to S_0\!\cup S_1\,$ is a bijection for $\rm\ f(a,b)\ =\ a\,f_{\!\ 1}(b) + (1\!-\!a)\,f_{\,0}(b)$

-