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?
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$.