Understanding a theorem about homomorphisms The theorem states,

There is a homomorphism $f: Q_{4n} \rightarrow G$ with f(a)=x and f(b)=y $\iff$
1) $x^4=e$ (where e is the identity element)
2) $y^{2n}=e$
3)$x^{-1}yx=y^{-1}$
4) $x^2=y^n$

This is what I don't understand...
For $f:Q_8 \rightarrow H$ where H is a subgroup of $Gl_2(Z_3)$, our professor said that if we showed that two elements (of order 4) from H satisfied the above conditions; then f was a homomorphism. What I don't get is...why is it enough to show that only two elements (of order 4) satisfy the above conditions? Aren't we supposed to show that all elements satisfty the conditions?
Thanks in advance.
 A: I'm not sure what $Q_{4n}$ is, but it must be generated by the elements $a$ and $b$.  If we already know that $f$ is a homomorphism then as soon as we know $f(a)$ and $f(b)$ we know all of $f$.  For example, to compute $f(aba^{-3})$ we would do:
$$f(aba^{-3}) = f(a)f(b)f(a)^{-3}$$
Given that we might say: To write down a homomorphism we just need to pick two elements to be $f(a)$ and $f(b)$!
This is not quite right though.  The problem is that there may be relations between $a$ and $b$.  For example if $a^4 = e$ then
$$e = f(e) = f(a^4) = f(a)^4$$
but it's not always true that $x^4 = e$ so we can't choose any arbitrary $x$ to be $f(a)$.
Now comes the answer to your question.  Given a relation, like $a^4 = e$, there are other obvious relations that follow from it, for instance $a^4b = b$ or $a^{-4} = e$.  For some groups it's possible to come up with a finite set of relations such that every relation in the group is generated by this finite set.  If we know all of the relations between $a$ and $b$ then we just need to make sure that the $x$ and $y$ we choose for $f(a)$ and $f(b)$ satisfy all of these relations.  Then the problem of $a^4 = e$ but $f(a)^4 \neq e$ can't happen and the $f$ we get is a well defined homomorphism.
Now, what I've written above is just the idea, not a rigorous proof.  For a proof of why you only have to check conditions (1) - (4) you have to first prove that $Q_{4n}$ has a finite presentation as the quotient of a free group on $2$ generators by the relations (1) - (4).  The universal property of a free group says that you can specify a homomorphism by just specifying the image of the generators and then the universal property of quotients says that as long as those generators respect the relations the map passes to the quotient and so you get a homomorphism out of $Q_{4n}$.
A: To show that $f:G\to H$ is a homomorphism, you need to show that $f(gh) = f(g)f(h)$ for all $g,h\in G$. 
I presume that $a$ and $b$ are specific elements of $Q_{4n}$ and $\{a,b\}$ is a generating set for $Q_{4n}$?  If so, then every element of $Q_{4n}$ can be expressed as a word consisting of $a$'s and $b$'s.  So it's enough to know about the images of $a$ and $b$ under $f$ (i.e. $x$ and $y$).
NOTE:  This is only supposed to be a slight clarification and a hint, and I see another answer has been submitted while I was writing this, so this may be superfluous now.
