# Computing index of a subgroup of SL_2 in sage

Suppose I have a subgroup of $\textrm{SL}_2(\mathbb Z)$ given by 3 generators, and it happens to be of finite index in $\textrm{SL}_2$. Is there a way (on Sage, since that is what I have access to) to figure out its index? I tried defining a matrix group via the generators and using index(), but this gave me an error. Perhaps if I define the group via permutations it would work? I am new to Sage, so any help would be appreciated.

-
Have you tried asking your question in the askSAGE forum? –  J.C. Ottem Apr 28 '11 at 17:14
No, I wasn't aware of it -- I'll try it there. –  Elena Apr 28 '11 at 17:18

To add to my comments on @Emmanuel's answer: first, compute the intersection with $\Gamma(2).$ This is quite easy, since $SL(2, 2)$ is not a very large group, and computing matrices mod 2 is not difficult either. Express the generators in words in a generating set of $\Gamma(2)$ (the usual parabolic generators corresponding to $z\rightarrow z + 2$ and $z\rightarrow \dfrac{z}{z+2}$ are always good). Then use

www.gap-system.org/Manuals/pkg/fga/doc/manual.pdf (if @Emmanuel is correct, you can use this from sage. If not, gap is free also...)

Alternatively, you can post your three generators...

-
I thought you meant that one could use the Schreier index formula for subgroups of free groups. I could post the generators but I think it will be useful for me to work this out for myself! –  Elena Apr 29 '11 at 15:43
I did mean that also, but notice that there are plenty of two-generator subgroups of $F_2$ of infinite index, so that works only when the group is of finite index... –  Igor Rivin Apr 29 '11 at 16:10
Exactly! Which is why I made the comment that I thought to do what you said requires you to know that your group is finite index :) But the gap thing is something I should try. –  Elena Apr 29 '11 at 16:14
Todd-Coxeter attempts to solve an undecidable problem, so is not going to be fast. $\Gamma(2)$ is a free subgroup of finite index; computing generators of intersection of your subgroup with $\Gamma_2$ is easy, then you just count how many there are, and that will give you the index. –  Igor Rivin Apr 28 '11 at 17:32