2013-06-01 08:19:49 +0100 received badge ● Teacher (source) 2013-06-01 08:19:49 +0100 received badge ● Self-Learner (source) 2013-06-01 08:04:57 +0100 answered a question Lifting matrices to $SL_2(\mathbb{Z})$ OK I found the solution. In the code I mentioned the error was that smith_form doesn't return matrices in $SL_2(\mathbb{Z})$. It's quite easy to correct by the following snippet that you have to add just after you use smith_form :  D, U, V = A.smith_form() if det(U) == -1 : U = matrix(2,2,[-1,0,0,1])* U if det(V) == -1 : V = V *matrix(2,2,[-1,0,0,1]) D = U*A*V  2013-06-01 03:25:58 +0100 received badge ● Editor (source) 2013-05-31 19:29:39 +0100 asked a question Lifting matrices to $SL_2(\mathbb{Z})$ Is there a way to lift a matrix in $Sl_2(\mathbb{Z}/N\mathbb{Z})$ to $SL_2(\mathbb{Z})$ for an arbitrary N ? I found this algorithm : here But it seems to work only when $N$ is prime. I think that the algorithm described in Shimura (which the implementation cited above is base on) works for arbitrary N. But I don't know how to modify the one above to make it work. Does anyone know how to do it. Ultimately my goal is to iterate through a list of representatives of $SL_2(\mathbb{Z}/24\mathbb{Z})$ in $SL_2(\mathbb{Z})$ so if anyone knows how to it without the above I would be equally (in fact probably more) grateful. edit : Ok now I see at least one reason why the code mentionned above fails and in fact it isn't because of the arbitrary ring but because the smith normal form function doesn't return elements in $SL_2(\mathbb{Z})$ but only invertible matrices. Anyone knows how to bypass this ?