# Order of subgroup generated by two elements

Given two elements a and b such that $a = a^{-1}$ and $aba = b^{-1}$, what's the order of the subgroup generated by $<a, b>$? I'm having trouble coming up with any relevant theorems that could help me with this.

In the one extreme, if there are no further relations, i.e. you're looking at the quotient of the free group on $\{a,b\}$ by the normal subgroup generated by those relations, this is an infinite group with elements of the form $b^n$, $ab^n$ and $b^na$. In the other extreme, if $b=b^{-1}$, this is the Klein four-group.
Note that $ab=b^{-1}a^{-1}=(ab)^{-1}$ and that $b=a(ab)$, so the group is also generated by the two elements $a$ and $ab$ of order two, so that all elements can be written as alternating products of $a$ and $ab$ and all products $a(ab)$ can be replaced by $b$, leading to the above characterization.