Recall that a group $G$ is called **residually finite** if for any nontrivial element $g\in G$ there exists a finite group $H$ and a homomorphism $f$ from $G$ to $H$ such that $f(g)\neq1$.


My question is



> 
> for which kind of finitely presented group $G=\{x\_1, \cdots, x\_n|r\_1, \cdots, r\_m\}$, there exists a finite group $H$ and a homomorphism $f$ from $G$ to $H$, such that $f(x\_i)\neq 1$ $(1\leq i\leq n)$. 
> 
> 
> 


Finite groups and free groups are naive examples. 



Mapping a group to a finite group s.t. the image of each generator is nontrivial
I'm a bit unclear on what you're asking, but I'll assume that 
you mean that given $G$, is there a presentation $G=\{x\_1, \ldots, x\_n|r\_1, \ldots, r\_m\}$ for which the property holds (note that your
question only concerns the generators $x\_1,\ldots x\_n$, so the
relators $r\_j$ are irrelevant)? Otherwise, if 
the presentation is given, then the property will hold iff
none of the $x\_i$ lie in the kernel of the map $G\to \hat{G}$,
the profinite completion. 


Given this interpretation, then the answer is that as long has
$G$ has a non-trivial homomorphism to a finite group $H$, then you
can always find a generating set with this property. Starting
with some generators $G=\langle x\_1, \ldots, x\_n\rangle$,
and a non-trivial homomorphism $f:G\to H$, then $f$ must
be non-trivial on some generator, say $f(x\_1)\neq 1$. Now,
consider all the generators $x\_i, \ldots, x\_n$ (by relabeling) such that 
$f(x\_j)=1$, $i\leq j\leq n$. We obtain a different generating set $G=\langle x\_1,\ldots, x\_{i-1}, x\_ix\_1^{-1}, \ldots, x\_nx\_1^{-1}\rangle$. Clearly now $f$ is non-trivial on each one of these generators. 


