<jupyter_start><jupyter_text>Lesson 8 - Subgroups of the modular groupLearning OutcomesThe student will:- consolidate their skill working with iterators- Learn about the modular group learn different ways of working with matrix groups in SageMathIt is possible to work with both finite and infinite groups in SageMath. In number theory we are mainly interested either in matrix groups over finite fields or arithmetic groups like the modular group $SL(2,\mathbb{Z})$ and its subgroups.<jupyter_code>SL(2,RR)
SL(2,ZZ)
# Another version of the modular group that is more convenient for number theory. 
SL2Z
SL2Z.cardinality()<jupyter_output><empty_output><jupyter_text>Subgroups of the modular groupRecall that the modular group $\Gamma = PSL(2,\mathbb{Z})=SL(2,\mathbb{Z})/\{\pm I_2 \}$ (we work with the projective group for simplicity) has an infinite number of subgroups given by congruences, so-called congruence subgroups, determined by the fact that they contain the kernel of a reduction map:$$\varphi_N : PSL(2,\mathbb{Z}) \to PSL(2,\mathbb{Z}/N\mathbb{Z})$$this group is called $\Gamma(N)$ - the principal congruence subgroup. Another important type of congruence subgroup is $$\Gamma_{0}(N) = \left\{ \left(\begin{array}{cc}a & b\\c & d\end{array}\right)\in \Gamma \mid c \equiv 0 \pmod{N} \right\}$$It is well-known that the modular group has a presentation as $$\Gamma = \langle S, R \mid S^2=R^3=1 \rangle$$where $$ S = \left(\begin{array}{rr}0 & -1 \\1 & 0\end{array}\right) \quad \text{and}\quadR = \left(\begin{array}{rr}0 & -1 \\1 & 1\end{array}\right)$$If $G \leqslant \Gamma$ then the subgroup $G$ can be described through the action of $S$ and $R$ on the right cosets of $G$ in $\Gamma$. Let $n$ be a positive integer and let $\sigma_S, \sigma_R \in S_n$ such that $\sigma_S^2 = \sigma_R^3 = id$ (the identity in $S_n$ and such that the subgroup $\langle \sigma_S,\sigma_R \rangle$ acts transitively on the set \{1,2,\ldots,n\}.If we now define  a homomorphism $$ h : \Gamma \to S_n$$by $h(S)=\sigma_S$, $h(R)=\sigma_R$ then $$G = \{ A \in \Gamma \mid h_G(A)(1)=1 \}$$is a subgroup of $\Gamma$, and there is in fact a 1-to-1 corresopndence between subgroups of index $n$ and conjugacy classes of such pairs by permutations that fixes $1$, i.e. $\sigma \sim \rho \Leftrightarrow \sigma = \pi \rho \pi^{-1}$ for some $\pi$ with $\pi(1)=1$.Givena subgroup $G$ corresponding to  a pair $(\sigma_S,\sigma_R)$ in $S_n$ it is possible to obtain a lot of geoemtric information about $G$ (or rather the orbifold $\mathcal{M}=G\backslash \mathbb{H}$) from the permutations:1. The index of $G$ in $\Gamma$ is $n$ (so the volume of $\mathcal{M}$ is $\frac{n\pi}{3}$.2. The number of fixed points of $\sigma_S$ is $e_2$, the number of elliptic points of order $2$.3. The number of fixed points of $\sigma_R$ is $e_3$, the number of elliptic points of order $3$.4. The number of fixed points of $\sigma_T = \sigma_S \sigma_R$ is $e_{\infty}$, the number of cusps. 5. The genus is then given by $$ g = 1 + \frac{1}{2}\left( \frac{n}{6} - e_{\infty} - \frac{1}{2}e_2 - \frac{2}{3} e_3 \right)\tag{*}$$It can in fact be shown that the if a tuple $(n;g,e_2,e_3,e_{\infty})$ (we will refer to this as a **signature** although this is not what geometers do) with $n,e_{\infty}>0$ and $e_2,e_3,g\ge0$ satisfies (*) then there exists a subgroup with these properties. For historical reasons Arithmetic groups (here only subgroups of the modular group) are differnetly represented in Sage than general algebraic groups SL(n) and GL(n). The reason is the origin of Sage as a tool to compute with modular symbols and forms.The classes<jupyter_code># One way to use this is to use permutation representation of a given group 
G=Gamma0(3).as_permutation_group()
print(G.permutation_action(S))
print(G.permutation_action(R))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13237971391417425, 'fraction_numerical': 0.016644993498049414, 'mean_word_length': 4.486447931526391, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '66709', 'license': 'CC0-1.0', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1206, 'n_words': 515, 'path': 'Lesson8-Modular-group.ipynb', 'repo_name': 'slel/sage-lesson-nt', 'size': '3845'}