A conditioned morphism in a group Let $(G,+)$ be an abelian group of at least $3$ elements and $f:G \to G$ a homomorphism such that $f(x) \in \{0, x, -x\}$ for all $x \in G$. Show that $f \in \{0_G, 1_G, -1_G\}$.
I tried proving that $f = 0_G$ by assuming that a $x_0 \in G, x_0 \neq 0$ exists with $f(x_0) = 0$ and then showing that $f(x) = 0$ for any $x$ (and similar assumptions for the other cases). However, this was a bit more trickier than I thought.
Can you help me with this one?
 A: Here's a more conceptual alternative. Consider the three "eigenspaces" $G^0=\ker(f)$, $G^+=\{x\in G\mid f(x)=x\}$ and $G^-=\{x\in G\mid f(x)=-x\}$. It is easily checked that these are subgroups of $G$ and $f$ maps each of them into itself. More precisely, $f$ acts on $G^0$ as $0$, on $G^+$ as $1_{G^+}$ and on $G^-$ as $-1_{G^-}$. By asumption, $G=G^0\cup G^+\cup G^-$ and the claim is that in fact $G=G^0$ or $G=G^-$ or $G=G^+$.
Let's consider $f^2$. If $x\in G^+$, then $f^2(x)=f(f(x))=f(x)=x$. If $x\in G^-$, then $f^2(x)=f(f(x))=f(-x)=-f(x)=-(-x)=x$. In particular, it follows that $f^2$ is the identity on $G^+\cup G^-$ and the zero map on $G^0$. Thus, we see that there is a difference in behavior depending on whether $f$ is injective or not. We use these observations to first reduce the question to the injective case and then generalize.
Note that $f$ induces an endomorphism $\tilde{f}\colon\tilde{G}\rightarrow\tilde{G},\,x+\ker(f)\mapsto f(x)+\ker(f)$ of $\tilde{G}=G/G^0$. This is injective, for if $f(x)+\ker(f)=\ker(f)$, then $f^2(x)=0$. If $x\in G^+\cup G^-$, then $x=f^2(x)=0$, or $x\in G^0$. In any case, $x\in\ker(f)$, so $x+\ker(f)=\ker(f)$, proving injectivity.
Furthermore, $\tilde{f}$ also has the property that $\tilde{f}(\tilde{x})\in\{0,\tilde{x},-\tilde{x}\}$ for all $\tilde{x}\in\tilde{G}$. If we apply the observations from the first paragraph together with the injectivity of $\tilde{f}$, we can write $\tilde{G}=\tilde{G}^+\cup\tilde{G}^-$. However, it is well-known that a group cannot be the union of two proper subgroups, so $\tilde{G}=\tilde{G}^+$ or $\tilde{G}=\tilde{G}^-$, i.e. $\tilde{f}=\pm1_{\tilde{G}}$. Multiplying $f$ by $-1$ if necessary, we may WLOG assume that $\tilde{f}=1_{\tilde{G}}$.
Now, $\tilde{f}=1_{\tilde{G}}$ means that $x+\ker(f)=f(x)+\ker(f)$ for all $x\in G$, i.e. $f(x)-x\in\ker(f)$ for all $x\in G$, i.e. $f^2(x)=f(x)$ for all $x\in G$. If $x\not\in\ker(f)$, then this means $f(x)=f^2(x)=x$, so $x\in G^+$. It follows that $G=G^0\cup G^+$. For the same reason as before, $G=G^0$ or $G=G^+$, i.e. $f=0$ or $f=1_G$, as desired.
A: Suppose exists $g\ne e$ such that $f(g)=e$. Take $x\in G$, $x\ne e$. There exists $y\in G$ such that $gy=x$.
If $f(x)=x$, then $f(x)=f(gy)=f(y)=x$. By the conditions on $f$, there are only two options: $y=x$ or $y=x^{-1}$. The first one leads to $gx=x$ but $g\ne e$ and this is not possible. The second is possible only if $x=x^{-1}$ since $f(x^{-1})=f(x)^{-1}=x^{-1}$.
If $f(x)=x^{-1}$, then $f(x)=f(gy)=f(y)=x^{-1}$ again we have only two options $y=x$ or $y=x^{-1}$ and so on.
Note that taking $x=e$ doesn't lead to any contraddiction.
So, if exists $g\ne e$ such that $f(g)=e$, the conditions on $f$ implie $f=e$.
The other cases where $f(g)=g$ and $f(g)=g^{-1}$ are very similar using this trick of writing an element $x$ as $gy=x$.

Let's study the case $f(g)=g$ for some $g\ne e$. If every $x\in G$ is such that $x = x^{-1}$ there is nothing to prove. Hence, you can assume that $g\ne g^{-1}$. Let $x\ne e$ such that $f(x)=x^{-1}$.
Let $x=gy$, then $e\ne x^{-1}=f(x)=f(gy)=gf(y)$ and so $f(y)=(xg)^{-1}$. Due to conditions on $f$, there are three cases: $y=xg,\:y=(xg)^{-1},\:y=e$.

*

*If $y=xg$ we have already $x=gy$ and this means $g=g^{-1}$.

*If you have $x^{-1}=gy=x$ and then $f(x)=x$ and this is ok.

*$y=e\implies x=g$...

