Lesson 3 of 15
Subgroups
Subgroups
A subgroup of a group is a subset that is itself a group under the same operation.
Subgroup Test
A non-empty subset of is a subgroup if and only if for all :
This single condition captures closure, identity, and inverses simultaneously.
Example: Subgroups of
The group under addition mod 6 has these subgroups:
- — trivial subgroup
- — order 2
- — order 3
- — the whole group
Notice that the subgroup orders (1, 2, 3, 6) all divide . This is Lagrange's theorem, which we will prove later.
Finding Subgroups Computationally
For under addition, a subset is a subgroup if:
- (identity)
- For each , (inverses)
- For each , (closure)
Generated Subgroups
The subgroup generated by an element , written , is the smallest subgroup containing :
In , .
Your Task
Implement generated_subgroup(a, n) that returns the sorted list of elements in within , and find_all_subgroups(n) that returns all subgroups of (each as a sorted list), sorted by size then lexicographically.
Pyodide loading...
Loading...
Click "Run" to execute your code.