This is a multipart question. I will post both parts here. I've only attempted the first part. I think if I can get help on the first part, I will be able to figure out the second. I will restate the question below and show my attempt at the first part below that.
Let $M$ be a monoid and let $M^*$ be the group of invertible elements of $M$. Prove the following:
For each $m \in M$ there is exactly one monoid homomorphism $f:\mathbb N \rightarrow M$ such that $f(1)=m$.
For each $m\in M^*$ there is exactly one monoid homomorphism $f:\mathbb Z \rightarrow M$ such that $f(1)=m$.
I copy and pasted the question. In the second part, my professor wrote "there is exactly one monoid homomorphism $f:\mathbb Z \rightarrow M$". Does he mean "there is exactly one monoid homomorphism $f:\mathbb Z \rightarrow M^*$"?
Anyway here is my attempt at the first part:
Let $M$ be a monoid. Next suppose that for each $m \in M$, there are more than one monoid homomorphisms $f: \mathbb N \rightarrow M$ and $g: \mathbb N \rightarrow M$ such that $f(1)=m$ and $g(1)=m$. Then $f(1)=m=g(1)$ and $f(1)=g(1)$. Therefore there is only one monoid homomorphism such that $f(1)=m$.
As always, thank you all for any help.
[EDIT: In the next section (not posted here), there are similar questions related to rings. Again, I think if I can complete these proofs, I should be able to figure out the questions related to rings.]
This is incorrect. You've shown that $f(1) = g(1)$ but you haven't shown that $f = g$. That is, you haven't shown that $f(n) = g(n)$ for all $n \in \mathbb{N}$. Notice that your proof works just the same if you replace $\mathbb{N}$ with any monoid $N$ and $1$ with any element $n \in N$:
But it would be too good to be true if there was a unique monoid homomorphism $f : N \to M$ with $f(n) = m$.
Instead, you need to use some special property of $\mathbb{N}$ and $1$ that isn't shared between all monoids. That property is the so called "principal of induction" which says that every element of $\mathbb{N}$ can be written as a sum of $1$'s:
$$ 1 + 1 + \dots + 1. $$
I'll leave it to you to figure out what this has to do with the principal of induction as it is usually stated and to formally prove (by induction) that if $f(1) = g(1) = m$ then $f(n) = g(n)$ for all $n \in \mathbb{N}$.