Skip to content
Tutorials Center
My learning

Topics

Lesson 37 of 37 ยท Projects and Practice

Project: A Group Explorer

Build a small program that takes any finite group, finds its subgroups, center and normal subgroups, forms quotient groups and compares groups.

In this project you assemble everything from the track into one tool: a group explorer. Give it a finite group and it reports its order, element orders, center, subgroups and normal subgroups, and it builds quotient groups. You will then use it to compare groups and to see Lagrange's theorem and the isomorphism theorem in action.

Design

A finite group needs only a list of elements and a multiplication function. Everything else can be computed:

Feature How
identity and inverses search for e with e ยท a = a; for each a search b with a ยท b = e
element order multiply repeatedly until you reach e
center elements that commute with everything
subgroups the group generated by one or two elements (enough for the small groups here)
normal subgroups check g h gโปยน stays in H
quotient G/N cosets as elements; product of coset representatives
fingerprint sorted list of element orders, used to tell groups apart

The code uses frozensets of elements so subgroups can be stored in sets.

Step 1: the Group class

Python The group explorer

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

You should find that โ„คโ‚† is abelian with all 4 subgroups normal, Sโ‚ƒ has 6 subgroups with 3 normal, Dโ‚„ has 10 subgroups with 6 normal and Sโ‚„ has 30 subgroups with 4 normal.

Step 2: quotient groups and comparisons

Add a method that builds G/N for a normal subgroup N. Elements of G/N are cosets; the product of cosets is the coset of the product of representatives. Then use the fingerprint to check which groups can be isomorphic: isomorphic groups have the same sorted list of element orders (the converse is false in general, but it is a quick filter).

Python Quotients, fingerprints and the isomorphism theorem

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Step 3: look at a Cayley table

A Cayley table lists every product. Plotting it as a coloured grid is a quick way to see structure: a cyclic group gives a "shifted diagonals" pattern, while a nonabelian group's table is not symmetric about the diagonal.

Python Plot the Cayley tables of Z6 and S3

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Extensions to try

  • Add a method that tests whether two groups have the same fingerprint and the same number of subgroups of each order, a stronger filter.
  • Build the unit groups โ„คโ‚…ร— and โ„คโ‚ˆร— with multiplication mod n. Both have order 4; the explorer should show that one is cyclic and the other (the Klein four-group) is not.
  • Test the claim that a group of prime order has only two subgroups.
  • Write a function that finds all homomorphisms from โ„คโ‚˜ to a group you have built, by trying every image of 1.
  • Extend the explorer to rings: take elements, + and ยท, then list units, zero divisors and ideals.

Good testing practice: verify your explorer on groups you already understand. If it reports that โ„คโ‚† has a subgroup of order 4, your code has a bug, because 4 does not divide 6.

You have now taken the full tour: homomorphisms, quotients, rings, fields, codes and cryptography. Whenever you meet a new algebraic structure, ask the same questions this track taught you: what are its substructures, what maps respect it, and what do you get when you collapse part of it away?

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. Which quick invariant can show that two finite groups are NOT isomorphic?

    An isomorphism preserves orders of elements, so different order lists rule out an isomorphism.
  2. 2. Why is a Cayley table of a nonabelian group not symmetric?

    The entry in row a and column b is ab, and in row b column a it is ba.
  3. 3. The explorer reports a subgroup of order 4 inside a group of order 6. What does that tell you?

    By Lagrange's theorem a subgroup order must divide the group order.

Summary

  • A finite group needs only elements and a multiplication function; identity, inverses, orders, center and subgroups can all be computed.
  • Normal subgroups are found by testing conjugation, and quotient groups are built from cosets.
  • Sorted element orders form a quick isomorphism test in one direction: different lists mean non-isomorphic.
  • Cayley tables make symmetry and structure visible.
  • Use known theorems (Lagrange, first isomorphism theorem) as sanity checks for your code.

Back to the Abstract Algebra track page.