How to find onto, one to one and everywhere defined from a formula? I was reading functions, I came across this question,

Next, the author has given an exercise to find out 3 things from the example,
 1. Onto
 2. Everywhere defined
 3. One to one

I am stuck with how do I come to know if it has these there qualities? I mean if I had values I could have come up with an answer easily but with just a function formula, I don't get how to proceed. Please guide me.
thanks
 A: Presumably when the problem says $A=B=Z$ it means that $A$ and $B$ are each the set of (positive, zero and negative) integers.
So you now have the values and can test each of the three properties for this function. 
A: A function is "onto" if for every element $c$ in the range there is an element $b$ in the domain such that $f(b)=c$.  So can you determine whether this is true?  If I give you a number $c$, can you find an appropriate $b$?
A function is "one to one" if $f(c)=f(d)$ implies $c=d$.  $g(x)=x^2$ is not one to one because $g(2)=g(-2)$.  What happens here?
Added:  If the sets are finite, you can draw a diagram.  You have some points that are set A and some points that are set B.  If you draw a line from each point in A to its image in B, 


*

*Onto means that every point in B is the image of at least one point in A.  So there must be a line to all the points of B

*Everywhere defined means there is a line from each point in A.  Sometimes people require that a function be everywhere defined, reducing the set A as necessary so every element has a function value.

*One to one means that each point in B is connected to at most one point in A.



