The free group $F_X$ generated by the set $X$ is characterized by a map $i:X\longrightarrow F_X$ which has the universal property that for any group $G$ and any map $f:X\longrightarrow G$, there is exactly one homomorphism $\tilde f:F_X\longrightarrow G$ such that $f=\tilde f\circ g$. I want to show that $X$ can indeed be considered the generating set of $F_X$ by showing that $i$ is automatically injective and that the image of $i$ is a generating set of $F_X$.
Injectivity was easy: just let $f$ be injective, then $i$ must also be injective for $f=\tilde f\circ i$ to be injective.
But I struggle with the image of $i$ (let's call it $E$) being a generating set. My intuition is that if the subgroup generated by $E$ isn't $F_X$ itself, we can choose an element that isn't generated by $E$ and map it to some arbitrary element of $G$ so $\tilde f$ wouldn't be unique. But it can't actually be arbitrary. For instance, the homomorphisms $S_3\to A_3$ are fully determined by where the $3$-cycles are mapped, and the transpositions, which aren't generated by $3$-cycles, must be mapped to the identity without any arbitrary choice. How do I get around this?
Edit: I just noticed that $S_3\to A_3$ is a bad example since there are no non-trivial homomorphisms here. But the point still stands that I'm not sure how to show that the homomorphism $f$ isn't unique if $E$ isn't a generating set.
Say that a free group on a set $X$ is a pair $(F, \iota)$ with the universal property you have stated.
Now prove that $(\langle \iota(X) \rangle, \iota')$ is also a free group on $X$ (here $\iota' : X \to \langle \iota(X) \rangle$ is given by $\iota'(x) = \iota(x)$ for $x \in X$).
Then use the universal property for these two free groups, using the other one for $G$, and $\iota$ resp. $\iota'$ for your $f$.