Prove that Z(integers) and A = {a ∈ Z| a = 4r + 2 for some r ∈Z} have the same cardinality I'm having trouble coming up with a proof.
I know that to how an equal cardinality I must show each of the sets has the same numbers of elements (in this case infinite integers). I have begun my proof as follows:
$\{a \in Z| a = 4r + 2\}$ for some $r \in Z$
Because $a$ is an integer than $a$ means that some integer is equal to $4r+2$.
Because an integer can be positive or negative, we must show that $a$ is either $2k$ or $2k+1$ 

Case 1: Show $a$ is even

$a = 4r+2$
$a = 4(2k)+2$
$a = 8k+2$
$a = 2(4k+1)$
$a = 2(n)$

Case 2: show that $a$ is odd

$a = 4r+2$
$a = 4(2k+1)+2$
$a = 8k+6$
$a = 2(4k+2)+1$
$a = 2(n)+1$
Because we have proven $a$ is an even or odd integer then some $a$ can be represented by some even or odd integer. Thus for whatever $a$, there is an integer $r$ that can represent it and thus they have the same cardinality.
Is my proof proof correct and if not could you explain the correct process I should be taking?
 A: We say that $A$ and $B$ have the same cardinality if there exists a bijection between them, that is, a function $f : A \to B$ such that:


*

*(Injective) Whenever $f(x) = f(y)$ for $x,y$ in $A$ we have $x=y$, and

*(Surjective) For any $y$ in $B$ there is an $x$ in $A$ with $f(x)=y$.


So in this case we'll take $B$ to be $\mathbb{Z}$ (the integers), and $A$ the set $\{a \in \mathbb{Z} : a=4r+2 \text{ for some } r \in \mathbb{Z}  \}$.
Let's consider the function $f(x) = 4x+2$.
Firstly, if $r$ is in $\mathbb{Z}$, then $f(r) = 4r+2$ for an integer $r$, so $f(r) \in A$. This tells us that $f$ is indeed a function from $\mathbb{Z}$ to $A$. Now we want to show that it is a bijection.


*

*Suppose we have $f(x) = f(y)$ for integers $x$ and $y$. This means that $4x+2 = 4y+2$. Can you see how this implies that $x=y$?

*Let's pick any element $a$ in $A$. By the definition of $A$ we know that there is some integer $r$ with $a=4r+2$. So $f(r)=a$.


And now we've shown that $f$ is a bijection between $\mathbb{Z}$ and $A$, therefore the two sets have the same cardinality.
