Now Consider the Alternating Group $A_4$:
A4=AlternatingGroup(4)
A4.cayley_table()
* a b c d e f g h i j k l +------------------------ a| a b c d e f g h i j k l b| b f d h g a i c e k l j c| c e g f k j a l h d b i d| d g i a l k b j c h f e e| e j f l a c h g k b i d f| f a h c i b e d g l j k g| g k a j b d c i l f e h h| h i e b j l f k d c a g i| i l b k f h d e j a g c j| j c l g h e k f a i d b k| k d j i c g l a b e h f l| l h k e d i j b f g c a
SageMath arbitrarily names the elements a,b,c,... so we'll need to ask it what each letter represents. We use the command .cayley_table().column_keys()
. This returns the elements ordered by their names a,b,c,...
A4.cayley_table().column_keys()
((), (1,2,3), (2,3,4), (1,3)(2,4), (1,2)(3,4), (1,3,2), (2,4,3), (1,4,2), (1,4,3), (1,3,4), (1,2,4), (1,4)(2,3))
We can tell Sage what names we want it to use for the elements. First we give it a list of the elements in the order we want it to use them in the Cayley table (we called our list A4list
, but you can use any name you want for this list), then we give it the corresponding names we want Sage to use (we put them in a list we call A4names
).
We use the optional arguments names
and elements
of .cayley_table
to pass the order and names we want it to use for the elements.
A4=AlternatingGroup(4)
A4list=["()", "(1,2)(3,4)", "(1,3)(2,4)", "(1,4)(2,3)", "(1,2,3)", "(1,3,2)",
"(1,2,4)","(1,4,2)", "(1,3,4)", "(1,4,3)", "(2,3,4)", "(2,4,3)"]
A4names=["1", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "s11"]
A4.cayley_table(names=A4names,elements=A4list)
* 1 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 +------------------------------------------------ 1| 1 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s1| s1 1 s3 s2 s8 s10 s9 s11 s4 s6 s5 s7 s2| s2 s3 1 s1 s11 s6 s5 s8 s7 s10 s9 s4 s3| s3 s2 s1 1 s7 s9 s10 s4 s11 s5 s6 s8 s4| s4 s11 s7 s8 s5 1 s3 s10 s6 s1 s2 s9 s5| s5 s9 s10 s6 1 s4 s8 s2 s3 s11 s7 s1 s6| s6 s10 s9 s5 s2 s11 s7 1 s1 s4 s8 s3 s7| s7 s8 s4 s11 s9 s3 1 s6 s10 s2 s1 s5 s8| s8 s7 s11 s4 s10 s1 s2 s5 s9 1 s3 s6 s9| s9 s5 s6 s10 s3 s7 s11 s1 1 s8 s4 s2 s10| s10 s6 s5 s9 s1 s8 s4 s3 s2 s7 s11 1 s11| s11 s4 s8 s7 s6 s2 s1 s9 s5 s3 1 s10
And there we have it! A multiplication table for $A_4$ with the elements named and ordered how we wanted them.
Sage has the dihedral group built it. Here we construct the dihedral group of the square.
D4=DihedralGroup(4)
D4.list()
[(), (1,4)(2,3), (1,2,3,4), (1,3)(2,4), (1,3), (2,4), (1,4,3,2), (1,2)(3,4)]
This shows that Sage represents the dihedral group using permuatations.
We can name these elements using R90
, etc.
R90=D4("(1,2,3,4)")
R180=D4("(1,3)(2,4)")
R270=D4("(1,4,3,2)")
H=D4("(1,4)(2,3)")
V=D4("(1,2)(3,4)")
D=D4("(2,4)")
Dp=D4("(1,3)")
R90*D # compute the product of R90 and D
(1,4)(2,3)
Just like we did with the alternating group above we can construct the Cayley Table for the Dihedral group.
D4=DihedralGroup(4)
D4list=["()","(1,2,3,4)","(1,3)(2,4)","(1,4,3,2)","(1,4)(2,3)","(1,2)(3,4)","(2,4)","(1,3)"]
D4names=["R0","R1","R2","R3","H","V","D","D'"]
D4.cayley_table(names=D4names,elements=D4list)
* R0 R1 R2 R3 H V D D' +------------------------ R0| R0 R1 R2 R3 H V D D' R1| R1 R2 R3 R0 D' D H V R2| R2 R3 R0 R1 V H D' D R3| R3 R0 R1 R2 D D' V H H| H D V D' R0 R2 R1 R3 V| V D' H D R2 R0 R3 R1 D| D V D' H R3 R1 R0 R2 D'| D' H D V R1 R3 R2 R0
$Z_n = \{0,1,2, \ldots, n-1\}$
The best way to compute with elements in $Z_n$ is to just use the remainder operator %
.
(5+8)%3 # this finds the remainder of 5+8=13 when you divide 3 into it
1
$U(n) = \{ m \ |\ 1\le m \le n-1 \text{ and } \gcd(m,n)=1 \}$ under multiplication modulo $n$.
Listing the elements of the U group U(28):
U28=[]
for x in range(1,28):
if gcd(x,28)==1:
U28.append(x)
U28
[1, 3, 5, 9, 11, 13, 15, 17, 19, 23, 25, 27]
Another way, using list comprehensions:
U28=[x for x in range(1,28) if gcd(x,28)==1]
U28
[1, 3, 5, 9, 11, 13, 15, 17, 19, 23, 25, 27]
Let's find the inverse of 9 in U(28) by running through all possibilities:
for x in U28:
if 9*x%28==1:
print x
25
check:
9*25%28
1
We could also use the command inverse_mod()
command:
inverse_mod(9,28)
25
This command uses the extended euclidean algorthim to determine the inverse. (See Appendix B in the notes for a description of the extended euclidean algorthim.)
xgcd(9,28)
(1, -3, 1)
The number -3 that is returned by the xgcd
algorithm is the inverse of 9 modulo 28. Note that -3 is equal to 25 modulo 28.