TITLE: When can a homomorphism be determined entirely by its generators
QUESTION [24 upvotes]: I read a text which says that:
Just because a homomorphism $ϕ :G  →  H$  is determined by the image of its generators does not mean that any such image will work. 
e.g.: Suppose we try to define homomorphism $ϕ :Z_3  →  Z_4$  by $ϕ(1)=1$  , then we get $ϕ(0)=ϕ(1+1+1)=3$  which isn't possible as $ϕ(0)=0$.
Does there exist some case in which a homomorphism is entirely determined by its generators?

REPLY [25 votes]: I will expand my comment into an answer: 

Theorem: Given a group with presentation 
  $$G = \langle \, g_i \bigm| r_j \, \rangle
$$
  given another group $H$, and given a function $f$ which
  assigns to each $g_i$ a value $f(g_i) \in H$, the function $f$ extends
  to a homomorphism $F:G \to H$ if and only if each $f(r_j)$ is the identity.

Proof: Let $\langle g_i \rangle$ denote the free group with free basis $\{g_i\}$. Let $N$ be the smallest normal subgroup of $\langle g_i \rangle$ containing $\{r_j\}$. By definition of presentation,
$$G = \langle g_i \rangle \, / \, N
$$
Let $q : \langle g_i \rangle \to G$ be the quotient homomorphism.
By the universal property for free groups, the function $f$ extends to a homomorphism $\widetilde F : \langle g_i \rangle \to H$. Let $K = \text{kernel}(\widetilde F)$. Then we have the following chain of equivalences: $\{r_j\} \subset K$ $\iff$ $N < K$ $\iff$ there is a homomorphism $F : G \to H$ such that $F \circ q = \widetilde F$ $\iff$ there is a homomorphism $F : G \to H$ that extends $f$.