# Bijective functions questions.

I'm having some problems with these questions on functions being bijective or not and I would appreciate some help.

Are the following functions bijective?

a) $f\colon \Bbb N \to \Bbb N$ defined as: $f(n)=n^2$.

b) $f\colon [-1,1]\to[0,1]$ defined as: $f(n) = n^2$.

c) $f\colon \Bbb R^2 \to \Bbb R^2$ defined as: $f(x,y)=(x+y,x-y)$.

d) $f\colon \Bbb Z^2 \to \Bbb Z^2$ defined as: $$f(x,y)=\begin{cases}(x,y+1), &\text{if x and y are both even or odd}\\(x+1,y),&\text{otherwise}\end{cases}$$

I have two questions from these sets of questions.

For (b) I said the $0$ from the $[0, 1]$ set does not have a pre-image because no number from the $[-1, 1]$ set squared equals $0$. Therefore it's not surjective so it's not bijective. I am not sure if I am going about this question the right way, or if it's even right.

And also for (c), from what I understand, the input is a set of pairs of rational numbers and so is the output, however, I don't know how to prove it through disproving injection or surjection. Any help would be appreciated.

UPDATE: I attempted to do D and this is what I got. I first tried to prove surjectivity. So, if I have an element [20, 10] for example, you can't get to there because the function only outputs pairs of numbers that are 1 apart. So this means its not surjective so it cannot be bijective. Is this correct?

-
The function in (b) is surjective: $f(0)=0^2=0$, and certainly $0\in[0,1]$. It is not injective, however: $f(-1)=(-1)^2=1=1^2=f(1)$. The symbol $\Bbb R$ in (c) denotes the set of real numbers, not the set of rational numbers; the latter set is commonly called $\Bbb Q$. – Brian M. Scott Aug 17 '13 at 7:21
OK now I am really confused. My text book is saying for a function f : A -> B, to be surjective, it must be the case that every element from B has a pre-image A such that f(a) = b. So for this case, A is [-1, 1] and B is [0, 1] so there is no 'a' for f(a) = 0 to be true? – Ogen Aug 17 '13 at 7:28
There is an $a\in[-1,1]$ such that $f(a)=0$: take $a=0$. For any real numbers $a$ and $b$, $[a,b]$ is the set of all real numbers $x$ such that $a\le x\le b$: it’s a whole closed interval on the real line. Were you confusing it with $\{-1,1\}$, the two-element set whose elements are the integers $-1$ and $1$? – Brian M. Scott Aug 17 '13 at 7:32
Yes I was. The difference between square and curly brackets never occurred to me. (I've only just started doing discrete mathematics for computer science.) – Ogen Aug 17 '13 at 7:40
That’s something that you’ll have to watch out for: parentheses, curly braces, and square brackets can all have specific meanings (in addition to their use simply to group expressions). – Brian M. Scott Aug 17 '13 at 7:43

To show that $f$ is bijective, you must show that it is both injective and surjective.
• $f$ is injective. Suppose that $\langle x_0,y_0\rangle,\langle x_1,y_1\rangle\in\Bbb R^2$ and $f(x_0,y_0)=f(x_1,y_1)$; then $\langle x_0+y_0,x_0-y_0\rangle=\langle x_1+y_1,x_1-y_1\rangle$, so $x_0+y_0=x_1+y_1$ and $x_0-y_0=x_1-y_1$. Adding these two equations, we find that $2x_0=2x_1$ and hence that $x_0=x_1$; subtracting this from $x_0+y_0=x_1+y_1$, we find that $y_0=y_1$. Thus, $\langle x_0,y_0\rangle=\langle x_1,y_1\rangle$, and $f$ is therefore injective. (This is the standard approach to proving injectivity: assume that the function takes two things in the domain to the same thing in the range, and show that the things in the domain were actually the same thing.)
• $f$ is surjective. Let $\langle u,v\rangle\in\Bbb R^2$ be arbitrary; we must find $\langle x,y\rangle\in\Bbb R^2$ such that $f(x,y)=\langle u,v\rangle$, i.e., such that $\langle x+y,x-y\rangle=\langle u,v\rangle$, or, finally, $x+y=u$ and $x-y=v$. Adding these two equations, we find that $2x=u+v$, so we must set $x=\frac12(u+v)$. Subtracting the second from the first gives us the equation $2y=u-v$, from which we see that we must set $y=\frac12(u-v)$. You can now check that with these values for $x$ and $y$ we do indeed find that $f(x,y)=\langle u,v\rangle$, and it follows that $f$ is surjective.