Equivalence classes of a kernel 
Let $f$ be a function with domain $A$ and codomain $B$. Consider the relation $K \subseteq A \times A$ defined on the domain of $f$ by $(x, y) \in K$ if and only if $f(x) = f(y)$. The relation $K$ is called the kernel of $f$.
For the specific case of $A = \mathbb{Z}$, where $\mathbb{Z}$ is the set of integers, let $f: \mathbb{Z} \rightarrow \mathbb{Z}$ be defined by $f(x) = x^2$. Describe the equivalence classes of the kernel for this specific function.

As I understand, I can simplify this down to: find the set of functions where its table looks like:




$x$
$y$




...
...


$-2$
$4$


$-1$
$1$


$0$
$0$


$1$
$1$


$2$
$4$


...
...




I would say $\{f(y) = y^2, f(y) = (-y)^2\}$ is a subset of the equivalence classes. But I'm not sure if that is all. First of all, am I going in the right direction? "Describe the equivalence classes" is kind of vague. Second, how can I be sure that my answer is the complete set of equivalence classes of the kernel?
 A: First: you need to check that the relation is actually an equivalence relation. So define
$$x\sim y\ \iff \ f(x)=f(y)$$
and show reflexivity, symmetry and transitivity. Otherwise it does not make much sense to talk about equivalence classes and such (if this was already checked elsewhere: good; I just think it's an important thing to do).

Now, the equivalence class $[n]$ of $n\in\Bbb Z$ is the subset of $\Bbb Z$ consisting of all elements in $\Bbb Z$ which are equivalent to $n$ under the given equivalence relation. Formally:
$$[n]=\{m\in\Bbb Z\,\mid\,n\sim m\}=\{m\in\Bbb Z\,\mid\, f(n)=f(m)\}\subseteq\Bbb Z$$
You are expected to explictely describe $[n]$ given $n\in\Bbb Z$ arbitrarily. So, given $n\in \Bbb Z$ you want to determine for which $m\in\Bbb Z$ you have
$$n\sim m\ \iff\ f(n)=n^2=m^2=f(m)\,.$$
If not written as subset of $\Bbb Z$: you can write it as subset of $\Bbb Z\times\Bbb Z$ (in the end a relation on a set $S$ is nothing else than a subset of $S\times S$)
$$[n]=\{(n,m)\in\Bbb Z\times\Bbb Z\,\mid\,n\sim m\}=\{(n,m)\in\Bbb Z\times\Bbb Z \,\mid\, f(n)=f(m)\}\subseteq K\subseteq\Bbb Z\times\Bbb Z$$
but this depends on how you have defined equivalence relations and equivalence classes.

Can you do this? that is describe $[n]$ as an explicit subset of $\Bbb Z$?
(Hint: you have to make a minor case distinction)
