Let $G$ be an abstract group (say, finitely generated).
Endow $G$ with the profinite topology. I would like to get comfortable with computing the closure of subgroups of $G$.
More specifically, I would like to understand how to use the profinite completion of $G$ to do that.
If $G$ is residually finite, I guess it makes our life easier because it embeds in its profinite completion. Is it then correct to compute the closure of $H$ by looking at $G$ inside the completion, computing closure there, and taking the preimage of the closure?
What if $G$ is not residually finite?
It would be nice to see two examples, one with $G$ residually finite and one with $G$ not residually finite, of computing closures of subgroups using the profinite completion of $G$ (if this is indeed possible). Maybe some Baumslag-Solitar groups can provide residually-finite/non-residually-finite groups adequate for illuminating examples.