Index of certain subgroups of the free group $F_2$ Suppose that $F = \langle a,b \rangle$ is the free group on two generators and let $H=\langle X,Y\rangle$  be the subgroup of $F$ generated by $X = (ab)^k$, $k$ non-zero integer, and $Y = a$.
What is the index of $H$ in $F$ ?
We know that $H$ is a free group on two generators. When $k = \pm 1$, it is easy to see that 
$F = H$. But what about when $k \neq \pm 1$ ?
 A: I would do this computation by thinking about covering spaces of graphs and applying Stallings's folding algorithm.
We realise $F_2$ as the fundamental group of a graph $X$ with one vertex $v$ and two edges---this is sometimes called the rose with two petals.  We orient the edges, and label one by $a$ and the other by $b$. This fixes an identification $\langle a,b\rangle\equiv\pi_1(X,v)$.
Your subgroup $H$ can be thought of similarly.  It is the fundamental group of a graph $Y$, which we construct as follows:


*

*Fix a base vertex $*$.

*Attach both ends of an oriented edge labelled $a$ to $*$ .

*Attach both ends of an oriented interval, consisting of $2k$ edges labelled $a$ and $b$ alternately, to $*$.


The orientations and labels define a natural map $Y\to X$, and the image of $Y$ is your subgroup $H$.
(For more on this sort of construction see, for instance, this blog post.)
Stallings' folding algorithm is a way of turning this map into an immersion---that is, a local embedding.  The algorithm is easy:


*

*If two edges with the same label are both oriented into the same vertex, identify them.

*If two edges with the same label are both oriented away from the same vertex, identify them.

*Repeat.


At the end of this procedure, we have a new oriented, labelled graph $Y'$, and the map $Y'\to X$ is an immersion.  There are essentially two possibilites:


*

*Every vertex of $Y'$ has valence four.  If so, then $Y'\to X$ is a covering map and $H$ is a finite-index subgroup of $F_2$.  The index of $H$ is equal to the degree of the covering map, which is equal to the number of vertices of $Y'$.

*Some vertex of $Y'$ has valence less than four.  If so, then $H$ is of infinite index.  (To see this, note that you can complete it to an infinite-sheeted covering space.)
In your case, you can quickly see that you need to perform exactly one fold to turn $Y$ into $Y'$.  If $k=1$ then $Y'$ is isomorphic to $X$ and your subgroup $H$ is equal to $F_2$.  Otherwise, $Y'$ has a vertex of valence two and $H$ is of infinite index.
A: Further to Jim Belk's comment, Thereom 2.10 of Magnus, Karrass and Solitar states,
Let $F$ be the free group on $a_1, \ldots, a_n$, and let $j$ be the index of the subgroup $H$ in $F$. If both $n$ and $j$ are finite, then $H$ is a free group on $j(n-1)+1$ generators. If $n$ is infinite and $j$ is finite, then $H$ is a free group on infinitely many generators. Finally, if $j$ is infinite, then $H$ may be finitely or infinitely generated; however, if $H$ contains a normal subgroup $N$ of $F$, $N\neq 1$, then $H$ is a free group on infinitely many generators.
For the example given, plugging in the values we see that your subgroup must have index $1$ if it is of finite index.
