Mapping to Square is Endomorphism iff Abelian

Theorem
Let $\struct {G, \circ}$ be a group.

Let $\phi: G \to G$ be defined as:
 * $\forall g \in G: \map \phi g = g \circ g$

Then $\struct {G, \circ}$ is abelian $\phi$ is a (group) endomorphism.

Necessary Condition
Let $\struct {G, \circ}$ be an abelian group.

Let $a, b \in G$ be arbitrary.

Then:

As $a$ and $b$ are arbitrary, the above holds for all $a, b \in G$.

Thus $\phi$ is a group homomorphism from $G$ to $G$.

So by definition, $\phi$ is a group endomorphism.

Sufficient Condition
Let $\phi: G \to G$ as defined above be a group endomorphism.

Then:

Thus, by definition, $G$ is an abelian group.