Consider the function $$f:\mathbb{N}\rightarrow\mathbb{N} ;n\mapsto n3^r+s$$ And the set M of functions such that, $$M=\{f:n\mapsto n3^r+s :r,s\in\mathbb{N}\}$$ Show that M is a monoid of functions on the base set $\mathbb{N}$.
My Attempt: We must show that $(f\circ g)(n)$ is also an element of M thus making M closed under composition. $$(f \circ g)(x)=f(g(x))=(n3^r+s)3^r+s$$ $$=n3^{2r}+s3^r+s$$ $$=n3^{2r}+s(3^r+1)$$ From here I am unsure how to write it in a form that shows that this is an element of M. I also know we must show that there exists an identity element such that $$(f \circ h)={id}_X$$ Any help is appreciated, thanks!