Q:

$X$ a set and $G$ a group. Let $G^X$ be the set of mappings from $X$ to $G$, show that $G^X$ can have same structure.

So I've got this exercise:

Let $X$ be a set and $(G, \star)$ a group. We denote $G^X$ the set of a mappings from $X$ to $G$.
  Show that $G^X$ has a group structure induced by $G$

So this is my attempt. I first have to show that it has the identity element, but I will skip this for now. I then have to show that if $f,g \in G^X$ then $f \star g \in G^X$, so:
Let $f,g \in G^X$, and let $x \in X$, then $f(x) \in G$ and $g(x) \in G$. Thus $(f \star g)(x) = f(x) \star g(x) \in G$ because of the previous argument. 
Now for the associativity:
Let $x \in X$ and $f,g,h \in G^X$, then $((f\star g)\star h)(x)=f(x)\star g(x) \star h(x) \in G$ and as $G$ is a group, we have $f(x) \star g(x) \star h(x) = (f(x) \star (g(x) \star h(x)) = (f \star (g \star h))(x)$. So associativity is confirmed. 
Now for the inverse element. I want to show that if $x \in X$ and $f \in G^X$ then if I construct a map $g$ such that $(f\star g)(x)=(g \star f)(x) = f(x) \star g(x) = g(x) \star f(x) = e$, which is obviously true because $f(x) \in G$ thus it has in inverse, which is $g$ and $g$ is indeed a map from $X$ to $G$, so $g$ exists. But I am unsure about this.
And finally, this is where I get really stuck. How do I show that $G^X$ has an identity element? Do I just construct $f \in G$ such that $\forall x \in X, f(x) = e$ where $e$ is the identity element of $G$?

A:

The identity element of the set of mapping, which I'll denote $f$, must verify: $\forall g \in G^X, \forall x \in X, (f\star g)(x)=e$.
We thus notice that in particular, for all $y\in G$ we can choose $g$ to be the constant application over $X$ of value $y$. Thus, $\forall y \in G, \forall x \in x, f(x)\star y = y$.
Therefore, for all $x\in X$, we must have $f(x)=e$ and therefore f as such defined is the (unique) identity element in $G^X$.

