Monoid - Commutativity 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? 
 A: 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.

 Explicitly, if $e \in X$ is the identity of $M$, you can show that the function $f(a) = e$ for all $a \in A$ is the identity of $\widehat{M}$.

2) Your proof of this is correct.

 To prove the converse, consider the map $M \longrightarrow \widehat{M}$ via $x \mapsto \widehat{x}$, which is defined via $\widehat{x}(a) = x$ for all $a \in A$. This is an injective monoid homomorphism (respects multiplication and identity). By commutativity of $\widehat{M}$, $\widehat{x}\widehat{y} = \widehat{y}\widehat{x}$. Hence, $\widehat{yx} = \widehat{xy}$ so by injectivity, $xy = yx$ and $M$ is commutative.

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.

 We can therefore see that $f \in \widehat{M}$ is invertible iff $f(a)$ is invertible for all $a \in A$. Concisely, if we let $G \subseteq M$ be the invertible elements (which form a monoid, in fact a group), then this is nothing more than $\widehat{G}$ under your notation.

