Prove: $(G^{S},*)$ is abelian group if and only if $(G,\cdot )$ is abelian.

Let $$S \neq \emptyset$$ and $$(G,\cdot )$$ group. On set $$G^{S} = \{ f \colon S \to G\}$$ we define operation $$*$$ $$(f * g)(s) = f(s) \cdot g(s) , \forall s \in S.$$ Prove: $$(G^{S},*)$$ is abelian group if and only if $$(G,\cdot )$$ is abelian.

I am having trouble with proving that $$(G,\cdot )$$ is abelian. If we choose $$a,b \in G$$ there is no guarantee that there will be $$c,d \in S$$ nor $$f,g \in G^{S}$$ so that $$a = f(c)$$ and $$b = g(d)$$, and even when that happens, how can we prove that $$a \cdot b = b \cdot a$$ (case $$c \neq d)$$. Am I missing something obvious?

• Define functions $f$ and $g$ as $f(x)=a$ and $g(x)=b$ for all $x$. Since $S$ is nonemtpy, evaluate $(f*g)$ and $(g*f)$ at any arbitrary point. – Luiz Cordeiro Jul 30 '19 at 13:53
• Should be easier to prove the contrapositive. – Hw Chu Jul 30 '19 at 13:55
• @HwChu I don't know. The direct proof seems short and straight-forward enough to me. – Arthur Jul 30 '19 at 13:59
• +1. That is a good one. – Hw Chu Jul 30 '19 at 14:00

$$G^S$$ is the space of all functions $$S\to G$$. So given any $$a, b\in G$$, there is an element $$s\in S$$ and functions $$f, g:S\to G$$ such that $$f(s) = a, g(s) = b$$ (for instance, you can let $$f$$ and $$g$$ be suitable constant functions). Then since $$f*g = g*f$$ by assumption, we have $$a\cdot b = f(s)\cdot g(s) = (f*g)(s) = (g*f)(s) = g(s)\cdot f(s) = b\cdot a$$ There is no need to have two different elements of $$S$$ for this. Translating between $$\cdot$$ and $$*$$ only works when both functions are fed the same input. So it makes sense to make sure that the two functions are fed the same input.
More structurally, we have a group homomorphism, embedding $$G$$ to the constant maps $$S → G$$, $$\mathrm{const}\colon G → G^S,~g ↦ \operatorname{const} g$$ as well as for every $$s ∈ S$$ a group homomorphism $$\mathrm{ev}_s\colon G^S → G,~f ↦ f(s),$$ so that obviously $$\mathrm{ev}_s∘\mathrm{const} = \mathrm{id}_G$$. So “$$G^S$$ abelian $$\implies$$ $$G$$ abelian” can be deduced by either that $$\mathrm{ev}_s$$ is surjective or that $$\mathrm{const}$$ is injective. You only need $$S ≠ ∅$$.
Furthermore: Since $$\mathrm{ev}_s$$ for $$s ∈ S$$ are all group homomorphisms, we also have a group isomorphism $$\mathrm{ev}\colon G^S → \prod_{s ∈ S} G,~f ↦ (f(s))_{s ∈ S}.$$ Depending on what you already know about products and provided that $$S ≠ ∅$$, this already gives the desired equivalence “$$G^S$$ abelian $$\iff$$ G abelian”.