Let $M:=(X, \star)$ be a monoid and let $A\neq \emptyset$ be a set. We define a composition $\hat{\star}$ on $X^A$ by $$\hat{\star}:X^A\times X^A\rightarrow X^A , \ (f,g)\mapsto f\hat{\star} g$$ where $f\hat{\star} g\in X^A$ is defined by $$f\hat{\star} g:A\rightarrow X , \ a\mapsto f(a)\star g(a)$$
Show the following:
- $\hat{M}:=(X^A, \hat{\star})$ is a monoid.
- $M$ is commutative iff $\hat{M}$ is commutative.
- Describe the elements $f\in \hat{M}$, that are invertible.
$$$$
For 1. do we have to show the existence of an identity element?
For 2: We suppose that $M$ is commutative and so we get that $x,y\in X$ then $x\star y=y\star x$. Now we consider elements of $\hat{M}$. Let $\tilde{x}, \tilde{y}\in X^A$, so $\tilde{x}(a), \tilde{y}(a)\in X$. So from th commutativity of $M$ we get that $\tilde{x}(a)\star \tilde{y}(a)=\tilde{y}(a)\star \tilde{x}(a)$. Is this correct?
For 3: We have to find $g$ such that $f(a)\star g(a)=\text{id}$, or not?
I'll answer your questions and put the answer to the remainder of the question in spoilers.
1) Yes, having an identity is part of the definition of a monoid.
2) Your proof of this is correct.
3) Not quite. Having $fg = {\rm id}$ in $\widehat{M}$ says that $f$ has a right inverse and $g$ has a left inverse. However, being invertible in a monoid means that you must have both left and right inverses (and they will coincide in this case). For an explicit example, take some infinite set $S$ and let $M = ({\rm End}(S), \circ)$ where ${\rm End}(S)$ is all the maps $S \longrightarrow S$. Because $S$ is infinite, you can find a injection $f: S \longrightarrow S$ which is not surjective. Hence, we can find some $g: S \longrightarrow S$ such that $g \circ f = {\rm id}_S$ but because $f$ is not surjective we cannot find a right inverse.