Strange question about free abelian group I was given the following question for homework, but it makes no sense to me.

Let $F$ be a free abelian group over a set $S$ with respect to the function $\varphi \colon S \to F$. Identify the set $S$ with the set $\varphi(S) \subset F$. The set $\varphi(S)$ is called a basis for $F$. Prove that every element $g \in F$ can be expressed uniquely as a product of elements of $\varphi(S)$.

Since when are free abelian groups constructed w.r.t maps? Isn't the set $S$ all that matters? I don't understand what I need to do...
 A: It's not that the free abelian group $F$ is constructed "with respect to" $\varphi$, even though the wording in your quote could lead one to think that.
If you construct a free group, the input the construction is $S$ alone, and (in the formalism assumed here) the output of the construction is $F$ together with the map $\varphi$.
The definition of "free abelian group" being assumed must be something like

A free abelian group over $S$ is an abelian group $F$ together with a map $\varphi: S\to F$, such that

*

*For every abelian group $G$ and every map $f:S\to G$, there exists exactly one homomorphism $h:F\to G$ such that $f = h\circ \varphi$.


(and we can then easily prove that $\varphi$ must be injective, and that all free abelian groups over $S$ are isomorphic, through isomorphisms that commute with the $\varphi$s).
In this view, whenever someone comes to you and says "I have here a free group over $S$", he's also obliged to offer you a $\varphi$ that shows how the generators of his groups are supposed to relate to your $S$.
By suitable renaming of the group elements, we can always make a free group into one where $S\subseteq F$ and $\varphi$ does nothing -- and indeed that's what your quote, in the next breath, asks you to imagine has happened.
But being allowed to choose a different $\varphi$ makes it easier to construct a free group in the first place -- otherwise you'd need to spend a lot of unnecessary ink on dealing with special cases, such as if one of the elements of $S$ happens to be a map from a subset of other elements of $S$ to $\mathbb Z$. (Or however you choose to represent non-generator elements of the free group.)
A: A free abelian group on a set $S$ is determined by a pair $(F,\varphi)$, where $F$ is an abelian group and $\varphi\colon S\to F$ such that the following property is satisfied:

for every map $f\colon S\to G$, where $G$ is an abelian group, there exists a unique group homomorphism $g\colon F\to G$ with $g\circ\varphi=f$.

Note that such $\varphi$ must be injective. Indeed, suppose $\varphi(x)=\varphi(y)$, with $x\ne y$. Define the map $f\colon S\to\{1,-1\}$ by
$$
f(s)=\begin{cases}
1 & \text{if $s\ne y$}\\
-1 & \text{if $s=y$}
\end{cases}
$$
Then no group homomorphism $g\colon F\to\{1,-1\}$ can exist such that $g\circ\varphi=f$.
Therefore the identification of $s\in S$ with $\varphi(s)\in F$ can be done, but it's not really necessary.
What the exercise wants you to show (albeit asked in a sloppy way) is that for every $x\in F$ there exist $s_1,s_2,\dots,s_n$ (pairwise distinct and determined up to the order) and unique integers $k_1,k_2,\dots,k_n$, such that $x=\varphi(s_1)^{k_1}\varphi(s_2)^{k_2}\dots\varphi(s_n)^{k_n}$. More precisely,


*

*for every $x\in F$ there exist $n\in\mathbb{N}$, $s_1,\dots,s_n\in S$ and integers $k_1,\dots,k_n$ with $x=\varphi(s_1)^{k_1}\dots\varphi(s_n)^{k_n}$;

*if $x\in F$ and $x=\varphi(s_1)^{k_1}\dots\varphi(s_n)^{k_n}=
\varphi(t_1)^{h_1}\dots\varphi(t_m)^{h_m}$, with $s_1,\dots,s_n\in S$ pairwise distinct and $t_1,\dots,t_m\in S$ pairwise distinct, then $m=n$ and there exists a permutation $\sigma$ of $\{1,2,\dots,n\}$ such that $t_{\sigma(i)}=s_i$ and $k_i=h_i$ (for $i=1,2,\dots,n$).
It's handier to write $s$ instead of $\varphi(s)$, so in most cases the identification is done.
A: Here is yet another, more abstract point of view: if $S$ is a set, then the free group $F_S$ by itself is not quite yet a representative of the functor $\mathsf{Ab} \to \mathsf{Set}$, $G \mapsto \operatorname{Map}_{\mathsf{Set}}(S, U(G))$ (recall that we're looking for a left adjoint of the forgetful functor).
Indeed, the existence of a free group is equivalent to this functor being representable. For this functor to be represented, you need both an abelian group $F_S$ and a natural isomorphism $\operatorname{Hom}_{\mathsf{Ab}}(F_S,-) \cong \operatorname{Map}_{\mathsf{Set}}(S, U(-))$.
Part of the data of this natural isomorphism is a map of sets $S \to U(F_S)$ corresponding to $\operatorname{id}_{F_S}$. This is your map $\varphi$, and by the Yoneda lemma it determines the natural isomorphism. If you do not specify this $\varphi$, you may know that there exists some natural isomorphism, but you do not know what it is precisely. If you choose a different $\varphi$ that corresponds to some automorphism of $F_S$ other than the identity of $F_S$, you will still have represented your functor, but it won't be the same representation.
For more info see Representable functors at Wikipedia, in particular the section "Universal elements". Representing a functor isn't just giving an object; you also have to say how this object represents the functor. Typically we omit the map because it's rather obvious, but formally one shouldn't forget it. This isn't really anything special to do with abelian groups, but actually something that's always in the background as soon as you are dealing with representable functors.
For example, the product of two objects $X$ and $Y$ isn't just some object $X \times Y$; it's this object equipped with two projections $X \gets X \times Y \to Y$. Why? Because it's a representative of the functor $P_{X,Y} : Z \mapsto \hom(Z,X) \times \hom(Z,Y)$, and to specify a universal element you need to specify an object $X \times Y$ and an element in $P_{X,Y}(X \times Y)$. If you choose different projections then you may have a different, albeit isomorphic, product, or you may not even have a product at all anymore if you choose random maps (e.g. constant ones). Usually the projections are obvious so we forget them, but they're there and they're an integral part of the definition.
