Ex 2.5 in Rotman's introduction to group theory Let $G, H$  be groups and   $f,g:G \rightarrow H$ and let
$$K = \left\{ a \in G | f ( a ) = g(a) \right\}$$
must $K$ be a subgroup of $G$?

I tried to define a new map $h:G \rightarrow H$ as $h(a)=f(a)g(a)^{-1}$ and by according to this construction, if $h$ is a homomorphism we get $K=\ker H$ thus a subgroup of $G$.
I can't see how to show that $h(ab)=h(a)h(b)$, which makes me wonder if I'm on the right direction at all.
 A: I think that the straight forward method for showing that $K$ is a subgroup of $G$ should work quite nicely.
Note that $e_{G} \in K$, as $f(e_{G}) = e_{H} = g(e_G)$
On the other side if $a,b \in K$, then we have: $f(ab) = f(a)f(b) = g(a)g(b) = g(ab) \implies ab \in K$
Also if $a \in K$, then we have that $f(a^{-1}) = (f(a))^{-1} = (g(a))^{-1} = g(a^{-1}) \implies a^{-1} \in K$ 
Therefore as $K$ is a subset of $G$ containing the identity, inverse of every element and it's closed wrt the associative operation we have that it's subgroup.
A: One could also solve this by proving the following:

*

*If ${f,g}\colon G\to H$ are homomorphisms, then $h\colon G\to H\times H$ given by $$h(a)=(f(a),g(a))$$ is a homomorphism. (The notation $H\times H$ stands for the direct product of the group $H$ with itself. I.e., on $H\times H$ we take the operation defined coordinatewise.)

*The set $\Delta=\{(x,x); x\in H\}$ is a subgroup of $H\times H$.

*Now we have $$K=\{a\in G; f(a)=g(a)\} = h^{-1}[\Delta].$$

*An inverse image of a subgroup under a homomorphism is a subgroup - so we get that $K$ is subgroup.

There is no doubt that this is more complicated then the more direct solution which was already posted in the other answer. On the other hand, the facts that we have shown along the way might be useful on their own. Also, similar approach can be used also for some other algebraic structures.

After posting this I've noticed that the same argument is given also in this answer: Let $f$ and $g$ be two group homomorphisms from $G$ to $G′$. Is $H$ a subgroup of $G$? (current revision). The same answer contains one additional solution - however, that one works only if $H$ is commutative.
