I know that we have to prove in both the directions. First assume that $B$ is a subgroup of $G$, then show that $f(B)$ is a subgroup of $H$. I know that we have to verify the three conditions for being a subgroup. First one is $e$ is in $f(B)$, second is for all $k$ in $f(B)$ we have to show that $k^-1$ is in $f(B)$. How do we show the first two steps as I am really confused.
Is there a counter example for this question.
To make this a lot easier, let's use the one-step subgroup test.
To prove the "if" part, assume $B \leq G$. This means $B$ is non-empty, so obviously, $f(B)$ is non-empty. Also, it means that $$a, b \in B \implies a \circ b^{-1} \in B$$ Now, using the homomorphism: $$f(a), f(b) \in f(B) \implies f(a \circ b^{-1}) \in f(B)$$ $$f(a), f(b) \in f(B) \implies f(a) \circ f(b)^{-1} \in f(B)$$ Thus, using the one-step subgroup test, $f(B)$ must be a subgroup of $H$.
However, the "only if" part is not actually true. Here's a counter example: Let $G=\Bbb{Z}_2$ and $H=\{e_H\}$ (the group with one element). Obviously, there is only one possible homomorphism from $G$ to $H$: $$f(g)=e_H$$ Now, take $B=\{1\} \subset G$. Clearly, $B$ is not a subgroup of $G$, yet $f(B)=\{e_H\}$ is a subgroup of $H$, which contradicts the statement that $f(B)$ is a subgroup of $H$ only if $B$ is a subgroup of $G$.