Mapping to Power is Endomorphism iff Abelian

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

Let $n \in \Z$ be an integer.

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

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:

From Power of Product of Commutative Elements in Group it follows that $G$ is an abelian group.