Given a group $G$ and $H\leq G$ is there a homomorphism $f: G \rightarrow G$ s.t $f(H) = id$ and $f(x) \neq id$ if  $x\notin H$? The motivation for this question is that I am trying to Read Basic Algebra 2 (despite a somewhat weak background for the book) and if this is true then it is fairly easy to show that monics in Grp are injective and epics are surjective.
In linear algebra/functional analysis you can project an element onto the subspace orthogonal to a given subspace. I wonder if something like this holds in group theory. 
Another Question: Does this hold for modules? Given a $R$-module $M$ and a $R$-submodule $N$ is there a homomorphism $f: M \rightarrow M$ s.t $f(N) = \operatorname{id}$?
edit: also wanted $f(x) \neq \operatorname{id}$ if $x$  is not in $H$.
 A: No, groups and modules can be much more shy than vector spaces.  The type of modules that behave as you probably want are called semisimple modules.  Most groups are very far from this.
The weaker property described by lhf: that $f:G \to G$ is non-trivial with $H \leq \ker(f)$ as long as $H^G < G$ has an easy description for finite length groups and modules: every top composition factor must also occur as a subgroup.  In ring theory, a similar property is called Kasch I believe, and makes some appearance in the ring theoretic versions of functional analysis.
Groups such as $\operatorname{SL}(2,q)$ for odd prime powers $q \geq 5$ have only a single composition series with the only non-identity proper term being the center.  The quotient by the center, $\operatorname{PSL}(2,q)$ is not isomorphic to a subgroup of $\operatorname{SL}(2,q)$ and so every homomorphism $f:\operatorname{SL}(2,q)\to \operatorname{SL}(2,q)$ is either an isomorphism (no kernel) or trivial (whole group is kernel).
In terms of modules, even the regular $\mathbb{Z}$-module does not have this property you want: If $f:\mathbb{Z} \to \mathbb{Z}$ then $\ker(f)$ is either zero or $\mathbb{Z}$, even though $\mathbb{Z}$ has lots of submodules.
