A group $G$ is finitely generated iff if there is a surjective homomorphism $F(\{1,...,n \}) \to G$ This is taken for granted in Algebra: Chapter 0 by Paolo Aluffi.
Here is a definition of subgroup generated by a subset from the book:

Let $A \subseteq G$. We have a ujnique group homomorphism $\phi_A: F(A) \to G$ be the universal property of the free groups($\phi_A(a)=a$). The image of this homomorphism is a subgroup of $G$, the subgroup generated by $A$ in $G$.

Now, I know how to prove the ''only if'' part:
If $G$ is finitely generated, then there is a surjective homomorphism $\phi_A: F(A) \to G$ for some finite subset $A$ of $G$. Assume $|A|=n$. then there is an isomorphism $f:F(\{1,...,n \}) \to F(A)$ We compose homomorphism and get a surjective homomorphism $\phi: F(\{1,...,n \}) \to G$
But I have no idea how to prove the ''if'' part. I know there is a similiar question somewhere, but the answers in there didn't help me, unfortunately.

Putting $\;A=\{a_1,...,a_n\}\subset G\;$ , oberve that
$$G\stackrel{\text{surjective}}=\phi(F(A))=\left\langle \phi(a_1),\,\ldots,\,\phi(a_n)\right\rangle$$
so that $\;G\;$ is finitely generated indeed.
