Is the free product of residually finite groups always residually finite?

Suppose groups $$G$$ and $$H$$ are residually finite. Does that imply, that $$G \ast H$$ is residually finite?

What have I tried to prove this:

Suppose, $$a = g_1h_1g_2h_2…g_nh_n \in G \ast H$$, $$g_1, .. g_n \in G$$, $$h_1, … , h_n \in H$$ and $$b = g_1g_2…g_n \neq e$$, then the natural homomorphism $$\alpha: G \ast H \to \frac{G \ast H}{\langle \langle H \rangle \rangle} \cong G$$ maps $$a$$ to $$b$$. Now suppose, that $$\beta$$ is the homomorphism from $$G$$ to a finite group $$K$$, such that $$\beta(b)$$ is non-trivial (such homomorphism exists as $$G$$ is residually finite). Then $$\beta \alpha$$ is the homomorphism that maps $$a$$ to a non-trivial element of a finite group.

The same arguments can be applied in case, when $$h_1h_2 … h_n \neq e$$. However, I do not know, what to do in case, when $$g_1g_2…g_n = h_1h_2 … h_n = e$$.

To see this, take your alternating product $$a = g_1 h_1 \cdots g_n h_n\neq 1$$ in $$G\ast H$$, and choose normal subgroups $$N$$ and $$K$$, of finite index in $$G$$ and $$H$$, respectively, such that $$a_1 , a_2 ,\ldots , a_n\not\in N$$ and $$b_1, b_2, \ldots, b_n \not\in K$$. (This can be done since, by definition, there are normal subgroups of $$G$$ excluding each of the $$a_i$$, and then their intersection excludes all of them and still has finite index in $$G$$. Likewise for the $$b_i$$ in $$H$$.) Then the natural homomorphisms $$G\to \overline{G} = G/N$$ and $$H\to\overline{H}=H/K$$ extend to a homomorphism $$\phi : G\ast H \to \overline{G}\ast\overline{H}$$ for which $$\overline{a} = \phi(a)\neq 1$$. (Indeed, $$\overline{a} = \overline{g_1}\overline{h_1}\cdots\overline{g_n}\overline{h_n}$$ is a reduced alternating product in $$\overline{G}\ast\overline{H}$$ as all of the $$\overline{a_i}$$ and $$\overline{b_j}$$ are non-trivial in their respective finite factors.) Since $$\overline{G}\ast\overline{H}$$ is a free product of the finite groups $$\overline{G}$$ and $$\overline{H}$$, it is free-by-finite, so it is residually finite. Hence, there is a homomorphism $$\psi : \overline{G}\ast\overline{H} \to Q$$, where $$Q$$ is finite, such that $$\psi(\overline{a})\neq 1$$. Then $$\psi(\phi(a))\neq 1$$, and $$\psi\circ\phi$$ is a homomorphism from $$G\ast H$$ to the finite group $$Q$$ for which $$(\psi\circ\phi)(a)\neq 1$$.
(There is a tiny corner case to tidy up, where $$a\in G\cup H$$ but, as $$G$$ and $$H$$ are each homomorphic images of $$G\ast H$$, this is easy to handle.)
• A Bass-Serre proof the fact that a free product of finite groups $H_i$ is free-by-finite: let $H$ be the kernel of the homomorphism onto the direct product of the $H_i$, then $H$ has finite index and the action of $H$ on the Bass-Serre tree of the free product is free, so $H$ is free. – YCor Mar 12 at 23:12