Solution (source code)

= Solution

Let $K=\ker\theta$. The <subgroup correspondence for a surjective group homomorphism> sends a <subgroup> $B\leq H$ to $\theta^{-1}(B)$ and a <subgroup> $A\leq G$ containing $K$ to $\theta(A)$. Inverse images are <subgroups> containing $K$, and images are <subgroups>. Surjectivity gives $\theta(\theta^{-1}(B))=B$. Conversely, if $K\leq A$ and $\theta(g)\in\theta(A)$, choose $a\in A$ with $\theta(g)=\theta(a)$. Then $ga^{-1}\in K\leq A$, so $g\in A$. Thus $\theta^{-1}(\theta(A))=A$. These two assignments are inverse bijections.

For $C=\theta^{-1}(B)$, the map of left <coset> sets
$$
G/C\longrightarrow H/B,\qquad gC\longmapsto\theta(g)B
$$
is well defined and onto. If $\theta(g_1)B=\theta(g_2)B$, then $\theta(g_2^{-1}g_1)\in B$, so $g_2^{-1}g_1\in C$ and $g_1C=g_2C$. Hence it is injective, proving
$$
\boxed{[G:\theta^{-1}(B)]=[H:B].}
$$
No normality of $B$ is required; these are <coset> sets, not necessarily <quotient groups>.

The <abelianization> is $\overline G=G/[G,G]$, where the <commutator subgroup> is generated by the commutators $[x,y]=x^{-1}y^{-1}xy$. Conjugating a commutator gives another commutator, so this <subgroup> is normal. In the quotient all commutators are trivial, and therefore the quotient is abelian. If $N\lhd G$ and $G/N$ is abelian, every commutator lies in $N$, so $[G,G]\leq N$. Hence
$$
\widetilde\pi:\overline G\to G/N,\qquad g[G,G]\mapsto gN
$$
is well defined and satisfies $\pi=\widetilde\pi\circ q$, where $q:G\to\overline G$ is the natural map. It is uniquely determined because $q$ is onto. This is the universal factorization property of <abelianization>.

Now write $S_i$ for the unique index-$i$ <subgroup> of $S$. Since conjugation preserves index, as shown in part (ii), $gS_ig^{-1}=S_i$ for every $g\in S$. Thus every $S_i$ is normal. For each prime $p$ the quotient $S/S_p$ has order $p$ and is cyclic, so there is a surjection $S\to C_p$. Being an abelian quotient, it factors through $\overline S$.

The <abelianization> is finitely generated because $S$ is. By the <Fundamental theorem of finitely generated abelian groups>,
$$
\overline S\cong\mathbb Z^r\oplus T,
$$
where $T$ is finite. If $r=0$, choose a prime $p>|T|$. The finite <group> $T$ could not surject onto the order-$p$ <group> $C_p$, contradicting the preceding surjections. Hence $r\geq1$, and projection from a free coordinate supplies
$$
\boxed{\overline S\twoheadrightarrow\mathbb Z.}
$$

Every <subgroup> of finite index in $\overline S$ has an inverse image of the same index in $S$, so there cannot be two different <subgroups> of any given finite index in $\overline S$. If $r\geq2$, reduction modulo a prime $p$ in the first and second free coordinates gives two distinct surjective maps to $C_p$ with different kernels: the first basis vector lies in one kernel but not the other. Both kernels have index $p$, a contradiction. Therefore $r=1$.

If $T\ne1$, choose a prime $p$ dividing its order. The decomposition of a finite <abelian group> into cyclic factors gives a surjection $\chi:T\to C_p$. In $\mathbb Z\oplus T$, the maps
$$
(n,t)\longmapsto n\bmod p,\qquad
(n,t)\longmapsto\chi(t)
$$
have distinct index-$p$ kernels, again distinguished by $(1,0)$. This is another contradiction, so $T=1$. We have proved <uniqueness of finite-index subgroups forces infinite cyclic abelianization>:
$$
\boxed{\overline S\cong\mathbb Z.}
$$

A <residually finite group> is one in which every nonidentity element has nonidentity image under some <homomorphism> to a finite <group>. Equivalently, the intersection of all finite-index <normal subgroups> is trivial: a finite separating map has such a kernel, and conversely quotienting by such a <normal subgroup> gives a finite separating map.

Choose the surjection $\sigma:S\to\overline S\cong\mathbb Z$. For each positive integer $i$, the <subgroup> $\sigma^{-1}(i\mathbb Z)$ has index $i$ and hence equals $S_i$. Its kernel $[S,S]$ is therefore contained in every finite-index <subgroup>. Indeed,
$$
\bigcap_{i\geq1}S_i
=\sigma^{-1}\left(\bigcap_{i\geq1}i\mathbb Z\right)
=\ker\sigma=[S,S].
$$
If $S$ is residually finite, this intersection is trivial. Thus $[S,S]=1$ and $\sigma$ is an <isomorphism>. The <residually finite group with one subgroup of each finite index is infinite cyclic> conclusion is
$$
\boxed{S\cong\mathbb Z.}
$$
Residual finiteness is used exactly to eliminate the <commutator subgroup> that all finite quotients would otherwise fail to detect.