0% found this document useful (0 votes)
90 views

A Python Code For Generating All Proper Subgroups of Dihedral Group

Uploaded by

Ary Wijaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

A Python Code For Generating All Proper Subgroups of Dihedral Group

Uploaded by

Ary Wijaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

JOURNAL OF FUNDAMENTAL MATHEMATICS

AND APPLICATIONS (JFMA) VOL. 6 NO. 1 (JUN 2023)


Available online at www.jfma.math.fsm.undip.ac.id

A PYTHON CODE FOR GENERATING ALL PROPER


SUBGROUPS OF DIHEDRAL GROUP
Abdul Gazir Syarifudin1, Verrel Rievaldo Wijaya2
1,2
Institut Teknologi Bandung, Bandung, Indonesia
Email: [email protected], [email protected]
1

Abstract. The dihedral group of order 2𝑛 denoted by 𝐷2𝑛 is the symmetry group of a
regular 𝑛-polygon consisting of rotation and reflection elements and the composition of
both elements. Like any other group, the dihedral group also has a subgroup whose
numbers differ depending on the value of 𝑛. This research explores and develop all the
forms of proper subgroups of 𝐷2𝑛 and all of these proper subgroups of 𝐷2𝑛 are generated
and counted with the help of Python program.

Keywords: dihedral group, prime numbers, python, object-oriented programming.

I. INTRODUCTION
At the end of the 17th century Joseph-Louis Lagrange tried to study the method of solving
polynomial equations which became the initial foundation of group theory. A few years later
in 1830, Evariste Galois used the term group to describe a set of one-on-one functions of a
finite set that can be grouped to form a set closed to the composition operation [1]. Furthermore,
the modern definition of group that is known today is the result of the accumulation of a long
process of several subsequent studies.

In general, a group is a set equipped with a binary operation such that it is closed to this
operation, associative, has an identity element, and every element has an inverse. Every group
has subgroups, which are subsets of the group that form a group with respect to the same binary
operations as the group. A proper subgroup is a subgroup that is distinct from the group itself.
Many author previously have consider such variety of proper subgroup as can be seen in [2, 3,
4, 5, 6, 7].

One type of group which is interesting to discuss is the dihedral group denoted by 𝐷2𝑛 ,
which is a polygon symmetry group consisting of rotation and reflection elements [8]. The
dihedral group is widely utilized in the art world and is closely related to various objects in
nature. Dihedral groups are applied by mineralogists and chemists to study molecular structures
or crystal structures based on symmetry. Syarifudin and Wardhana have classify many types
of subgroups in the dihedral group 𝐷2𝑛 [9].

In this paper, we develop a code in Python language to help generating and counting all the
proper subgroups of dihedral group; the basic theories for dihedral groups are based on studies
in [10]. Python is one of the most popular object-oriented high-level programming languages
today and is widely used as a tool for mathematical computing and data analysis [11]. Python

https://doi.org/10.14710/jfma.v6i1.15939 10 p-ISSN: 2621-6019 e-ISSN: 2621-6035


JOURNAL OF FUNDAMENTAL MATHEMATICS
AND APPLICATIONS (JFMA) VOL. 6 NO. 1 (JUN 2023)
Available online at www.jfma.math.fsm.undip.ac.id

is one of the easiest programming languages to learn because it has a compact and simple
syntax. Previously, Python has been used to generate all subgroups of a particular group, for
example 𝑍𝑛 [12].

II. METHODOLOGY

The following is the overview of steps used to finding and generating all proper subgroups
of dihedral group:
1. Studying the literature related to the concept of dihedral group.
2. Determine the subgroups of the dihedral group.
3. Create an algorithm to generate these subgroups of the dihedral group.
4. Convert the algorithm into Python programming language.

III. RESULTS AND DISCUSSIONS

First, we provide some theoretical foundation including definitions and theorems used this
research. Then, we provide the algorithm to generate all the proper subgroups of dihedral
group. This algorithm then is written in Python language, and finally, we provide some
examples of the results.

3.1 Theoretical Foundation and Results

Definition 1 (Dihedral Group) [9]. Group 𝐺 is called a dihedral group of order 2𝑛, 𝑛 ≥ 3 if
𝐺 is generated by two elements 𝑎, 𝑏 ∈ 𝐺with the following properties
𝐺 = 〈𝑎, 𝑏 | 𝑎𝑛 = 𝑒, 𝑏2 = 𝑒, 𝑏𝑎𝑏−1 = 𝑎−1 〉
The dihedral group of order 2𝑛 is hereafter symbolized by 𝐷2𝑛 .

From the definition it is easy to see that |𝐷2𝑛 | = 2𝑛 and 𝐷2𝑛 can be written as the set 𝐷2𝑛 =
{𝑒, 𝑎, 𝑎2 , 𝑎3 , … , 𝑎𝑛−1 , 𝑏, 𝑎𝑏, 𝑎2 𝑏, 𝑎3 𝑏, … , 𝑎𝑛−1 𝑏}. Element 𝑎 is commonly referred to as the
rotation element and 𝑏 is referred to as the reflection element. For example, if we take 𝑛 = 4,
we get 𝐷8 = {𝑒, 𝑎, 𝑎2 , 𝑎3 , 𝑏, 𝑎𝑏, 𝑎2 𝑏, 𝑎3 𝑏}.

Definition 2 (Subgroup) [13]. Suppose 𝐺 is a group. A subset 𝐻 of 𝐺 is a subgroup of 𝐺 if 𝐻


is nonempty, closed with respect to the same binary operation as 𝐺, has the same identity
element as 𝐺, and every element has an inverse in 𝐻. If 𝐻 is a subgroup of 𝐺, then it is denoted
𝐻 ≤ 𝐺. Proper subgroups are all 𝐻 such that 𝐻 ≤ 𝐺 but 𝐻 ≠ 𝐺.

For example, one of the subgroups of 𝐷8 is 𝐻 = {𝑒, 𝑎, 𝑎2 , 𝑎3 }. Next, to determine the subgroups
of 𝐷2𝑛 , all the factors of 𝑛 must first be known. Many factors of 𝑛 can be determined by
utilizing the following theorem.

Theorem 1 (The Fundamental Theorem of Arithmetic) [14]. Every integer 𝑛 ≥ 2 is prime


or can be expressed as a product of primes. The factorization into primes is unique except for
the order of the factors.

From the previous theorem, we are be able to infer the number of positive factors of n from its
prime factorization as the following proposition shows.

https://doi.org/10.14710/jfma.v6i1.15939 11 p-ISSN: 2621-6019 e-ISSN: 2621-6035


JOURNAL OF FUNDAMENTAL MATHEMATICS
AND APPLICATIONS (JFMA) VOL. 6 NO. 1 (JUN 2023)
Available online at www.jfma.math.fsm.undip.ac.id

𝑎 𝑎 𝑎
Proposition 1. Suppose the prime factorization of 𝑛 is 𝑛 = 𝑝1 1 𝑝2 2 … 𝑝𝑘 𝑘 where 𝑝1 , … , 𝑝𝑘 are
distinct primes with 𝑝1 < ⋯ < 𝑝𝑘 and each 𝑎𝑖 is a positive integer. The number of positive
factors of 𝑛, denoted by 𝑙(𝑛) is 𝑙 (𝑛) = (𝑎1 + 1)(𝑎2 + 1) … (𝑎𝑘 + 1).
𝑎 𝑎 𝑎
Proof. Since the prime factorization of 𝑛 is 𝑛 = 𝑝1 1 𝑝2 2 … 𝑝𝑘 𝑘 , the positive factors of n can be
represented as
𝑏 𝑏 𝑏
𝒅 = 𝑝1 1 𝑝2 2 … 𝑝𝑘 𝑘
where 𝑏𝑖 ∈ {0,1, … , 𝑎𝑖 }. It follows by combinatorial argument that because each 𝑏𝑖 can be
chosen from a set with order 𝑎𝑖 + 1 and each 𝑏𝑖 is chosen independent from each other, then
all possible value of 𝒅 are as many as (𝑎1 + 1)(𝑎2 + 1) … (𝑎𝑘 + 1). (QED)

To simplify the determination of the subgroups of the dihedral group, the subgroups will
be divided into three categories: reflexive subgroups, rotational subgroups, and mixed
subgroups. A reflexive subgroup is a subgroup built by 𝑎𝑏 elements. Rotational subgroups are
subgroups built by rotation elements of order more than equal to two. While the mixed
subgroup is a subgroup built by rotation and reflection elements [9].

Suppose a dihedral group 𝑫𝟐𝒏 = {𝒆, 𝒂, … , 𝒂𝒏−𝟏 , 𝒃, 𝒂𝒃, … , 𝒂𝒏−𝟏 𝒃} is given. Then suppose
the number 𝑛 have positive factors denoted by 𝒅𝒏 = {𝟏, 𝒌𝟏 , … , 𝒌𝒊 , 𝒏}. The subgroups of the
dihedral group are of the following form [15]:
1. 𝑆1 = {𝑒, 𝑎𝑘 𝑏}, with 𝑘 = 0, 1, … , 𝑛 − 1
2. 𝑆2 = {𝑒, 𝑎𝑘 , 𝑎2𝑘 , … , 𝑎𝑛−𝑘 }, with 𝑘 = 1, 𝑘1 , … , 𝑘𝑖
3. 𝑆3 = {𝑒, 𝑎𝑘 , 𝑎2𝑘 , … , 𝑎𝑛−𝑘 , 𝑎𝑙𝑘 𝑏, 𝑎𝑙𝑘+𝑘 𝑏, 𝑎𝑙𝑘+2𝑘 𝑏, … , 𝑎 𝑙𝑘+𝑛−𝑘 𝑏}, with 𝑘 = 𝑘1 , … , 𝑘𝑖 and
𝑙𝑘 = 0, 1, … , 𝑘 − 1
Subgroup 𝑆1 is referred to as a reflexive subgroup, subgroup 𝑆2 is referred to as a rotational
subgroup, while subgroup 𝑆3 is referred to as a mixed subgroup.

Subgroup 𝑆1 comes from the fact that (𝑎𝑘 𝑏)(𝑎𝑘 𝑏) = (𝑎𝑘 𝑏𝑎𝑘 )𝑏 = 𝑏𝑏 = 𝑒. The proper
subgroup 𝑆2 is the group that’s generated by the element 𝑎𝑘 or can be written as 𝑆2 = 〈𝑎𝑘 〉.
The next subgroup, 𝑆3 , is the combined version of 𝑆1 and 𝑆2 . Other proper subgroups that are
not included in the three categories is just the trivial one i.e., {𝑒}. From the previous explanation
we can compute the total number of proper subgroups of dihedral group, that is

|𝑆1 | + |𝑆2 | + |𝑆3 | = 𝑛 + (𝑖 + 1) + (𝑘1 + ⋯ + 𝑘𝑖 ).

Example. Let 𝑛 = 4 so that 𝐷2⋅4 = 𝐷8 = {𝑒, 𝑎, 𝑎2 , 𝑎3 , 𝑏, 𝑎𝑏, 𝑎2 𝑏, 𝑎3 𝑏}. There are 4 proper
subgroups of the form 𝑆1 as follows {𝑒, 𝑏}, {𝑒, 𝑎𝑏}, {𝑒, 𝑎2 𝑏}, {𝑒, 𝑎3 𝑏}. On the other hand, the
positive factors of 4 are {1,2,4}. This means there are 2 proper subgroups of the form 𝑆2 as
follows {𝑒, 𝑎, 𝑎2 , 𝑎3 }, {𝑒, 𝑎2 }. Furthermore, the proper subgroups of the form 𝑆3 are as follows
{𝑒, 𝑎2 , 𝑏, 𝑎2 𝑏}, {𝑒, 𝑎2 , 𝑎𝑏, 𝑎3 𝑏}. In total there are 8 proper subgroups of 𝐷8 .

3.2 Code and Implementation

A code/program is a collection of consecutive statements in a computer. The recipe for


what the computer is supposed to do in a program is called algorithm. We will attempt to set
up the algorithm first and then implement it in a program. This is useful when the algorithm

https://doi.org/10.14710/jfma.v6i1.15939 12 p-ISSN: 2621-6019 e-ISSN: 2621-6035


JOURNAL OF FUNDAMENTAL MATHEMATICS
AND APPLICATIONS (JFMA) VOL. 6 NO. 1 (JUN 2023)
Available online at www.jfma.math.fsm.undip.ac.id

is much more compact than the resulting program code [11]. The use of program will help to
generate all proper subgroups of dihedral groups when 𝑛 is large.

The previous section is the basis for the following algorithm. Note that the subgroups of a
dihedral group can be easily generated by utilizing the factors of 𝑛. In general, the algorithm
for generating such subgroups is as follows:

1. Initially given a value of 𝑛, form the group 𝐷2𝑛 .


2. Determine all the positive factors of 𝑛.
3. Loop through each factor of 𝑛 that is not equal to 𝑛 to first generate a subgroup 𝑆2 .
4. For each existing subgroup 𝑆2 , use looping again to extend it to create subgroup 𝑆3 .
5. Finally, use separate looping for 𝑘 from 1 to 𝑛 − 1 to generate subgroup 𝑆1 .

The described algorithm is then applied to the Python programming language. The final
Python code is as following.

from math import *

# Initialization
print("============================================")
print("Generating all the proper subgroups of D_2n")
print("============================================")
n = int(input("Input n: "))
print("D_%d = " %(2*n), end="")

# Showing the contents of group D_2n


keys = []
for i in range(2*n):
if i==0:
keys.append("e")
elif i<n:
keys.append("a^" + str(i))
else: keys.append("a^" + str(i-n) +"b")
print(keys, "\n")

# Creating dictionary to pair each element of group to the number 0 to n-1


dict = {}
for i in range(2*n):
dict[i] = keys[i]

# Determining the factors of 2n


factor = []
i = 1
while (i * i < n):
if (n % i == 0):
factor.append(i)
i += 1

https://doi.org/10.14710/jfma.v6i1.15939 13 p-ISSN: 2621-6019 e-ISSN: 2621-6035


JOURNAL OF FUNDAMENTAL MATHEMATICS
AND APPLICATIONS (JFMA) VOL. 6 NO. 1 (JUN 2023)
Available online at www.jfma.math.fsm.undip.ac.id

for i in range(int(sqrt(n)), 0, -1):


if (n % i == 0):
factor.append(n // i)

# Generating all the proper subgroups and print it


print("Proper Subgroups")
print("--------------")
total = 0
for i in factor:
start = 0
subgroup = []
while start < n:
subgroup.append(dict[start])
start = start + i
print(subgroup, "--> orde", len(subgroup))
total = total + 1

if i != 1:
for j in range(i):
subgroup2 = []
start2 = n + j
while start2 < 2*n:
subgroup2.append(dict[start2])
start2 = start2 + i
print(subgroup + subgroup2, "--> orde", len(subgroup+subgroup2))
total = total + 1
print()
print("In total there are %d proper subgroups" %total)

The algorithm can be represented as a flowchart depicted in Fig. 1.

https://doi.org/10.14710/jfma.v6i1.15939 14 p-ISSN: 2621-6019 e-ISSN: 2621-6035


JOURNAL OF FUNDAMENTAL MATHEMATICS
AND APPLICATIONS (JFMA) VOL. 6 NO. 1 (JUN 2023)
Available online at www.jfma.math.fsm.undip.ac.id

Input 𝑛 from user Forming the group 𝐷2𝑛

Create a list of the factor of 𝑛


𝒇𝒂𝒄𝒕𝒐𝒓 = [𝟏, 𝒌𝟏 , … , 𝒌𝒊 , 𝒏]

for 𝑖 ∈ 𝑖 ∈ 𝑓𝑎𝑐𝑡𝑜𝑟 generate and


𝑓𝑎𝑐𝑡𝑜𝑟 print subgroup 𝑆2
with 𝑖 ≠ 𝑛

end loop 𝑗>𝑖

for 𝑘 = for 𝑗 = 0 𝑡𝑜 𝑖
1 𝑡𝑜 𝑛 − 1

𝑘≥𝑛
0≤𝑗≤𝑖
1 ≤𝑘 ≤𝑛−1

generate and
generate and print subgroup 𝑆3
print subgroup 𝑆1

End

Figure 1. Flowchart of Algorithm

https://doi.org/10.14710/jfma.v6i1.15939 15 p-ISSN: 2621-6019 e-ISSN: 2621-6035


JOURNAL OF FUNDAMENTAL MATHEMATICS
AND APPLICATIONS (JFMA) VOL. 6 NO. 1 (JUN 2023)
Available online at www.jfma.math.fsm.undip.ac.id

Outputs depicted in Fig. 2 and Fig. 3 are examples for 𝑛 = 6 and 𝑛 = 29.

Figure 2. All proper Subgroups of 𝑫𝟏𝟐

Figure 3. All proper Subgroups of 𝑫𝟓𝟖

IV. CONCLUSIONS

The conclusions that can be drawn from this research are as follows. All subgroups of a dihedral
group 𝐷2𝑛 can be classified as either a rotation, reflection, or mixed subgroup. All subgroups
of a dihedral group 𝐷2𝑛 is able to be generated with Python program. The algorithm to generate
all the subgroups of group 𝐷2𝑛 utilizes the factors of 𝑛.

https://doi.org/10.14710/jfma.v6i1.15939 16 p-ISSN: 2621-6019 e-ISSN: 2621-6035


JOURNAL OF FUNDAMENTAL MATHEMATICS
AND APPLICATIONS (JFMA) VOL. 6 NO. 1 (JUN 2023)
Available online at www.jfma.math.fsm.undip.ac.id

REFERENCES

[1] J. A. Gallian, Contemporary Abstract Algebra 7th Edition, Belmont: Cengage Learning,
2009.
[2] A. Asar, "On infinitely generated groups whose proper subgroups are solvable,"
Journal of Algebra, vol. 399, pp. 870-886, 2014.
[3] A. Arıkan and A. Arıkan, "On Fitting p-groups with all proper subgroups satisfying an
outer commutator law," Journal of Algebra, vol. 352, pp. 341-346, 2012.
[4] A. Arikan, G. Cutolo and D. J. Robinson, "On groups that are dominated by countably
many proper subgroups," Journal of Algebra, vol. 509, pp. 445-466, 2018.
[5] M. J. Evans and B. G. Sandor, "Groups of class 2n in which all proper subgroups have
class at most n," Journal of Algebra, vol. 498, pp. 165-177, 2018.
[6] F. d. Giovanni, M. Trombetti and B. Wehrfritz, "Groups whose proper subgroups are
linear," Journal of Algebra, vol. 592, pp. 153-168, 2022.
[7] H. Zhou, L. Xu, Y. Cui, R. Feng and Q. Ding, "On hamilton decompositions of Cayley
graphs on dihedral groups," Applied Mathematics and Computation, vol. 372, p.
124967, 2020.
[8] S. R. Cavior, "The Subgroups of the Dihedral Groups," Math. Mag. , vol. 48, 1975.
[9] A. G. Syarifudin and I. Wardhana, "Subgrup Non Trivial dari Grup Dihedral," Eigen
Mathematics Journal, pp. 73-76, 2019.
[10] W. C. Calhoun, "Counting the Subgroups of some Finite Groups," Amer. Math.
Monthly, vol. 94, no. 1, pp. 54-59, 1987.
[11] H. P. Langtangen, A Primer on Scientific Programming with Python 5th Edition,
Springer Nature, 2016.
[12] I. B. Muktyas and S. Arifin, "Semua Subgrup Siklik dari Grup (Zn,+)," Jurnal
Teorema: Teori dan Riset Matematika, pp. 177-186, 2018.
[13] D. S. Dummit and R. M. Foote, Abstract Algebra 3th Edition, Wiley, 2004.
[14] T. Koshy, Elementary Number Theory with Applications 2nd Edition, Academic Press,
2007.
[15] A. G. Syarifudin, "Karakteristik Graf Koprimda dari Grup Dihedral dan Setiap
Subgrupnya," 2020.

https://doi.org/10.14710/jfma.v6i1.15939 17 p-ISSN: 2621-6019 e-ISSN: 2621-6035

You might also like