# Prove that $f(n) = n^2 - 1$ is not injective and not surjective. Am I doing it right?

Determine if $f(n) = n^2 - 1$ is injective, surjective, and prove your answer.

The domain and codomain is the set of all integers: $\mathbb{Z}$

Let $-3 = n^2 - 1$

Then $n = \sqrt{-2} \notin \mathbb{Z}$

$\therefore f$ is not surjective.

Let $f(n) = 3$

Then $f(2) = 2^2 - 1 = 3$ and $f(-2) = (-2)^2 - 1 = 3$

$\therefore f$ is not injective. $\square$

-
Looks solid to me. Did you have any questions? – Clayton Feb 19 '13 at 7:38
Do I have to prove it is a function first? It seems like a dumb question, but thought I would ask anyways. – Leonardo Feb 19 '13 at 7:39
It doesn't seem necessary to me if the question is already asking you to prove or disprove injectivity/surjectivity. – Clayton Feb 19 '13 at 7:41
You have to see it is a function first, (if it isn't a function it can't be injective or surjective) but you don't need to write a proof for it. – Dominic Michaelis Feb 19 '13 at 7:44
Thanks, it helps to know I am not leaving anything out. – Leonardo Feb 19 '13 at 7:45

You shouldn't write something like $\sqrt{-2}\not\in \mathbb{Z}$. Just write that $-2=n^2$ has no solution.
The let $f(n)=3$ is not good too, since you could think this is true for any $n$.
So what should I say "choose" $f(n) = 3$ instead? – Leonardo Feb 19 '13 at 7:40
Na just say, $f(2)=3$ (with calculation) and $f(-2)=3$ so it can't be injective – Dominic Michaelis Feb 19 '13 at 7:42
@Leonardo: Simply show that $f(2)=f(-2)$ and point out that particularly, $2\neq-2$. – Clayton Feb 19 '13 at 7:42