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

I don't know about Sage (which presumably would use Gap for such a thing?) but according to its documentation (I haven't tried), Magma has an algorithm due to Coxeter-Todd to (attempt to) find coset representatives for a subgroup of a finitely presented group. Assuming you can represent your generators in terms of some standard generators of SL_2(Z), that might give you the index. See here:

http://magma.maths.usyd.edu.au/magma/handbook/text/739#8205

-
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
Igor -- but then I guess I would really have to be sure the group is finite index (in this case I just think it should be but haven't really confirmed it). That's why I was hoping to use some computer program to confirm it first. By the way, do you have any experience with the Todd-Coxeter algorithm wrt its slowness? Emmanuel -- I am aware of the Magma algorithm, but I don't have access to Magma at the moment. Thanks for the suggestion, though. –  Elena Apr 28 '11 at 18:14
@Elena: you don't need to be sure the subgroup is of finite index. Whether or not it is, you will compute a finite index free subgroup of it, which will be a finitely generated subgroup of a free group. Computing its index is easy (whether or not its finite). –  Igor Rivin Apr 28 '11 at 18:22