Show that $\mathbb Z$ with operation $•$, $a•b =a+b$ if $a$ is even ; $a•b =a-b$ if $a$ is odd is a group. Suppose that $•$ is the operation defined on $\mathbb{Z}$ by:

*

*$a • b = a + b$ if $a$ is even.

*$a • b = a-b$ if $a$ is odd.

Prove that it is a group.

Closure: if $a,b\in (\mathbb{Z}, •)$ $\implies$ $a • b\in(\mathbb{Z} •)$;
Associative: $a • (b • c) = (a • b) • c$, $\forall$ $a, b, c \in (\mathbb{Z}, •)$, therefore
$$a + (b + c) = (a + b) + c$$
$$a- (b-c) = (a-b) -c$$
for all integers.
Identity element: $0$
$a • 0 = a + 0 =a$
$a • 0 = a - 0 = a$
Inverse element: $-a$ or $a$
$a • -a = a + (- a) = 0 $
$a•a =a-a = 0$
I ask if the demonstration is acceptable and some advice to improve it.
Thanks so much.
 A: Your proof for closure is fine. Essentially, there is nothing to show.
For associativity, it is not clear what you have tried to do, but as things stand you have not proved that the operation is associative. You must separately consider $4$ different cases: one for each possibility where $a$ and $b$ are even or odd. For instance, in the case where $a$ is odd and $b$ is even, we have
$$
a \bullet(b \bullet c) = a \bullet (b + c) = a - (b + c) = a - b - c\\
(a \bullet b) \bullet c = \underbrace{(a - b)}_{\text{this is odd!}} \bullet c = (a - b) - c = a - b - c.
$$
For the identity element, you must show that we have both $a \bullet 0 = a$ and $0 \bullet a = a$.
For the inverse element, you must clarify that $a$ is the inverse of $a$ in the case that $a$ is even, and $-a$ is the inverse of $a$ in the case that $a$ is odd.

For another way to see that $\bullet$ is a group operation, note that
$$
a \bullet b = a + (-1)^a b.
$$
Thinking of a $a$ as the map $f_a: \Bbb Z \to \Bbb Z$ defined by $f_a(x) = a + (-1)^a x$ allows us to identify $(\Bbb Z,\bullet)$ with a subset of the invertible maps over $\Bbb Z$. To see that this subset is a subgroup, it suffices to verify that the subset is closed under composition and inverses. For closure under composition, note that
$$
(f_a \circ f_b)(x) = a + (-1)^a(b + (-1)^bx) 
\\ = (a + (-1)^ab) + (-1)^{a + b}x\\
\\ = f_{a + (-1)^ab}(x),
$$
which is a map of the desired form.
Interestingly, once we prove that $\bullet$ is a group operation in this way, we can say that
$$
(f_a \circ f_b)(x) = f_a(b \bullet x) = a \bullet (b \bullet x) = (a \bullet b)\bullet x = f_{a \bullet b}(x).
$$
That is, if the image of $(\Bbb Z,\bullet)$ in $S_\Bbb Z$ under $a \mapsto f_a$ yields a subgroup, the associativity of $\bullet$ follows.

For my own curiosity, the question of identifying the group:
We see that $a^2 = 0$ whenever $a$ is odd.  Also, we note that all even elements can be written as $2k = 2^{\bullet k}$.  Finally, we note that
$$
2 \bullet 1 = 2 + 1 = 3.
$$
In other words,
$$
(\Bbb Z, \bullet) = \langle 1,2 \mid 1^{\bullet 2} = (1 \bullet 2)^{\bullet 2} = 0 \rangle.
$$
That is, $(\Bbb Z, \bullet)$ is the infinite dihedral group.
It would be interesting to produce a direct isomorphism between $\{f_a : a \in \Bbb Z\}$ an the isometry group of $\Bbb Z$.
