Is $f$ injective and surjective? Let $f:\mathbb{N}\to \mathbb{Z}$ given by
$\displaystyle f(a)=\frac{(-1)^a(2a-1)+1}{4}$. Is $f$ injective and surjective?
I am having trouble bringing down the $a$ from the exponent. 
For injective, I'm at $(-1)^a(2a-1) = (-1)^b(2b-1)$
For surjective, I'm at:
If $b \in \mathbb{Z}$, then there exists an $a \in \mathbb{N}$ such that $f(a)=b$. Then, $\displaystyle \frac{(-1)^a(2a-1)+1}{4}=b$. How do I get $a$ isolated to see if it is in $N$? Thanks. 
 A: HINT: It never hurts to gather some numerical data. Calculate the first few values of $f(a)$:
$$\begin{array}{rcc}
a:&1&2&3&4&5&6&7\\
f(a):&0&1&-1&2&-2&3&-3
\end{array}$$
This makes it pretty easy to guess that 
$$f(a)=\frac{a}2$$ when $a$ is even, and 
$$f(a)=-f(a-1)=-\frac{a-1}2=\frac{1-a}2$$ 
when $a$ is odd. Proving these guesses, which is not hard to do, would make your life a bit easier. For instance, it would make it clear that $f(a)\le 0$ for odd $a$, and $f(a)>0$ for even $a$, so that you can’t possibly have $f(a)=f(b)$ unless $a$ and $b$ are both odd or both even.
More abstractly, any time you see a factor of $(-1)^a$ for integer $a$, you should think about dividing the problem into two cases, one for even $a$ (for which $(-1)^a=1$) and one for odd $a$ (for which $(-1)^a=-1$).
A: As you pointed out, if the function is not injective, there exist $a$ and $b$ (distinct) such that
$$
(-1)^{a}(2a-1)=(-1)^{b}(2b-1).
$$
We can, w.l.o.g., assume $2b-1\neq0$ since $a$ and $b$ are distinct.
Then,
$$
\frac{2a-1}{2b-1}=(-1)^{b-a}.
$$
If $b-a$ is even, then
$$
2a-1=2b-1
$$
and hence $a=b$ (a contradiction). If $b-a$ is odd, then
$$
2a-1=-2b+1
$$
so that
$$
a+b=1.
$$
If your definition of $\mathbb{N}$ is $\mathbb{N}=\{1,2,\ldots\}$ (i.e. excluding zero), this is a contradiction, since it $a+b\geq1+1=2$.
As for surjectivity, see Doug's comment.
