I was trying to prove that if $G, G'$ are groups and $S$ a set of generators for $G$. If $f: S \rightarrow G'$ is a map then there exists at most one extension to $f': G \rightarrow G'$ where $f'$ is a homomorphism.
I was examining any two functions $p, q: G \rightarrow G'$ and was trying to make use of the homomorphism property to write $p(x)=p(x_1)^{a_1}p(x_2)^{a_2}...p(x_n)^{a_n}$, and since $p$ and $q$ agree on $S$, we're done. But my question is, what if we express $x$ in two different ways, not just $x = x_1^{a_1}...x_n^{a_n}$? How do we deal with that question? I have a rough idea of what a free group is, and I think it has something to do with this.
Let $G$ be a group, $S \subseteq G$. Define the subgroup "generated by S" to be $\{x \in G : $ for every subgroup $S'$ of $G$ such that $S \subseteq S'$, $x \in S'\}$.
Note that this is the smallest subgroup of $G$ which contains $S$; that is, the subgroup generated by $S$ is a subgroup of every subgroup of $G$ which is a superset of $S$.
Then $S$ generates $G$ iff the group generated by $S$ is $G$.
Now suppose that $S$ generates $G$ and that $f : S \to G'$ as sets. Suppose now that we have $g, g' : G \to G'$ as groups such that $g \circ f = g' \circ f$. We can consider the equaliser of these maps $E = \{x \in G : g(x) = g'(x)\}$, which is a subgroup of $G$. This equaliser contains $S$. Therefore, the subgroup generated by $S$ is a subgroup of $E$. Then $G$ is a subgroup of $E$, which is a subgroup of $G$. Then $E = G$.
Clearly, the equaliser of two maps can only be $G$ when the two maps are equal.
Edit:
Alternately, we can express the subgroup generated by $S$ as the set of $x$ which can be written in the form $y_1^{s_1} ... y_n^{s_n}$ where $y_i \in S$, $s_i = \pm 1$. Suppose we have $p, q : G \to G'$ group maps which extend $f : S \to G'$. Consider $x \in G$, and write it in the above form. Then $p(x) = p(y_1)^{s_1} ... p(y_n)^{s_n} = q(y_1)^{s_1} ... q(y_n)^{s_n} = q(x)$. Note that it doesn't matter that $x$ could possibly be written in multiple ways; we only need one such way to show that $p(x) = q(x)$.
Finally, there is a third proof. Let $F_S$ be the free group on $S$, and let $\eta_S : S \to F_S$ be the universal map. We say that the subgroup generated by $S$ is the image of the group map $g : F_S \to G$ such that $g \circ \eta_S$ is the inclusion map $i : S \subseteq G$. Now suppose that we have $p, q : G \to G'$ such that $p$ and $q$ agree on $S$; that is, such that $p \circ i = q \circ i$. Then $p \circ g \circ \eta_S = q \circ g \circ \eta_S$; then $p \circ g = q \circ g$. The fact that $p = q$ follows from the fact that $g$ is surjective.