Rotman's Introduction to the Theory of Groups Exercise 1.27 
My try for (i) $G = \{a_1,\dots,a_n\}$. If $n$ is even, an odd number of $a_j \ne e$ must have its inverse among the $a_j\ne 0$, then at least one $a_j\ne 0$ must be its own inverse, which contradicts the hypothesis. Thus $n$ must be odd. Thus each $a_j\ne 0$ is multiplied by its inverse in $a_1*a_2*\cdots*a_n$ so it equals $e*e = e$.
But I think something must be wrong with this proof because in (ii), using the hint, we would have that $\mathbb{Z}_p-\{0\} = \{1,\dots, p-1\}$ is a group satisfying the hypothesis in (i) with $n = p-1$ even for most $p$. Also, this won't lead to the answer because we would have $[(p-1)!] = [1]$ which leads to $(p-1)!\equiv_p 1$ and $1$ isn't equivalent to $-1\mod{p}$ for all $p$ prime.
What I'm doing wrong? Thanks in advance!
 A: Lemma.
(Part 3 here is the most relevant, see the corollary below.)
Let $G$ be a finite abelian group. Denote $G=\{g_1,g_2,\ldots,g_n\}$, and let $b$ be the product of all its elements, i.e., $b=g_1\cdot g_2\cdot \ldots\cdot g_n$. Thus:

*

*$b^2=e$.

*$H=\{x\in G\mid x^2=e\}$ is a subgroup of $G$.

*If there is exactly one an element in $G$ of order $2$, it's $b$.

*If there is more than one element in $G$ of order $2$, $b=e$.

Proof.

*

*Since every element in $G$ has its inverse, we can also write $G=\{g_1^{-1},g_2^{-1},\ldots,g_n^{-1}\}$. Therefore $b$ is also
$$b=g_1\cdot g_2\cdot \ldots \cdot g_n=g_1^{-1}\cdot g_2^{-1}\cdot \ldots \cdot g_n^{-1}.$$
Now, since $G$ is abelian, we can calculate $b^2$ as:
$$b^2=g_1 g_2 \ldots g_n g_1^{-1} g_2^{-1} \ldots g_n^{-1}=(g_1 g_1^{-1})( g_2 g_2^{-1})\ldots(g_n g_n^{-1})=e.$$

*It is easy to check that if $a^2=b^2=e$, using the fact that $G$ is abelian, that $(ab)^2=e$ and $a^{-1}=b^{-1}=e$ too. $e^2=e$ too, therefore $H$ is a subgroup of $G$, as it's nonempty and closed under product and inverse.

*If $x\in G$ is the only element of order $2$, it is therefore the only element that is the inverse of itself, so we can write
$$b=g_1 g_2\ldots g_n=e\cdot x\cdot \prod_{g\in G \textbf{ s.t. }   o(g) > 2} gg^{-1}=x.$$

*For $H\le G$ as before, denote $H=\{x_1,x_2,\ldots,x_r\}$. It is left to the reader to verify that it is a vector space over $\mathbb{F}_2=\{0,1\}$, the field with two elements, with $e=\vec{0}$ and every element being the additive inverse of itself. If $B=(v_1,\ldots ,v_m)$ is a basis for $H$, where $m=\log_{2} {r}$ (where $m\ge3$ from our assumption). There are $2^{m-1}$ elements such that their $i$'th component (in respect to the basis $B$) is $0$, and therefore an even number of elements with their $i$'th component being $1$. Convince yourself that the sum (or any group action, i.e., their sum as vectors) of all elements of $H$ is $\vec{0}$, as it's $0$ in every component. □

Corollary: Wilson's Theorem.
Let $p$ be a prime. So $p$ divides $(p-1)!+1$.
Proof. Consider $\mathbb{F}_p^*$, the multiplicative group of the field with $p$ elements. Note that it has $p-1$ elements. Since the polynomial $x^2-1$ has at most $2$ roots over the field $\mathbb{F}_p$, up to two elements $x\in \mathbb{F}_p^*$ might satisfy $x^2=1$. The number $1$ (or $1_{\mathbb{F}_p}$) satisfies this equation, and so does $-1$ (wich, by assuming $p>2$, are different elements). Since $1$ is of order $1$, $-1$ is the only element of order $2$. From part 3 of the lemma we obtain that the product of all elements of $\mathbb{F}_p$ is $b=-1$, therefore we have
$$1\cdot 2\cdot \ldots \cdot (p-1)=-1,$$
and, equivalently:
$$(p-1)!+1\equiv 0 \mod(p).$$ □
A: You're not doing anything wrong. Part (i) doesn't apply directly because $(-1)^2 = 1$ but you can still apply the same ideas. Every element $a$ which is not equal to $1$ or $-1$ has an inverse which is distinct from $a$ (think about why this is). So in evaluating $(p - 1)!$, all the terms cancel except $1$ and $-1$.
A: My approach is quite simple:
Let $s = g_{1}g_{2}...g_{n}$.
By multiplying s by the inverse of each element we should get the identity $e$, since G is abelian.
Consider the group homomorphism: 
$$\phi: G \rightarrow G, \phi(g) = g^{-1}$$
You can verify that this is indeed a bijection.
Thus $\phi(G) = G$, which is equivalent to saying that taking the inverse of each element of $G$ is the same group $G$.
$$s =g^{-1}_{1}g^{-1}_{2}...g^{-1}_{n}$$
$$sg^{-1}_{1}g^{-1}_{2}...g^{-1}_{n} = 1$$
$$s^{2} = 1$$.
Since we assumed $G$ has no elements of order 2, which is the same as saying no $g \in G-\{1\}$ satisfies $g^{2} = 1$, thus $s=1$.
