Path: blob/main/foundations/01-modular-arithmetic-groups/sage/01f-group-visualization.ipynb
483 views
Visualizing Group Structure
Module 01f | Modular Arithmetic and Groups
A single picture can reveal structure that tables of numbers hide.
Question: You've computed orders, generators, subgroups, and cosets with numbers and equations. But can you see them? What does a cyclic group actually look like?
Objectives
By the end of this notebook you will be able to:
Draw Cayley graphs for small groups and interpret their structure
Construct and read a subgroup lattice diagram
Use multiplication table heatmaps to spot symmetry and subgroup boundaries
Cayley Graphs
A Cayley graph represents a group as a picture:
Nodes = group elements (one node per element)
Edges = the action of a chosen element : draw an arrow from to (additive) or (multiplicative) for every element
If is a generator, following the arrows visits every node before returning to the start. If is not a generator, the arrows break into disconnected loops. Let's see both cases in .
One connected cycle. Following the arrows from any node, you visit all 6 elements and return to the start. That is what "generator" looks like as a picture.
Now let's try element 2. Since , element 2 is NOT a generator (01d). What does the Cayley graph look like?
Common mistake: "A Cayley graph shows the group." More precisely, a Cayley graph depends on the choice of generator, not just the group. The same group looks like a hexagon with generator 1, but decomposes into two triangles with generator 2.
Subgroup Lattice Diagrams
In 01e we found every subgroup of a group and verified that their sizes divide the group size. A subgroup lattice arranges all those subgroups in a diagram:
Each node is a subgroup
A line going up from to means (every element of is also in )
The bottom is always the trivial subgroup , the top is the whole group
For cyclic groups, the subgroup structure mirrors the divisor lattice of . Let's build this step by step for .
The lattice mirrors the divisor lattice of 12. This is no coincidence: for cyclic groups, subgroups of correspond exactly to divisors of . The subgroup of size is .
Notice how the lattice captures containment at a glance. For example, (size 2) sits inside (size 4), which sits inside (size 12). Each step up means "the smaller subgroup is entirely contained in the larger one."
Checkpoint. has divisors . Predict what its subgroup lattice looks like before trying Exercise 2.
Multiplication Table Heatmaps
A color-coded multiplication table can reveal structure that raw numbers hide. Let's start by looking at the actual table, then color it.
Does this pattern hold for other primes? Let's compare with a smaller group to see what changes and what stays the same.
Exercises
Exercise 1 (Worked)
Draw the Cayley graph of with generator 3. Since , it should visit all 8 elements. Then change to generator 2 and observe the difference.
Exercise 2 (Guided)
Compare the subgroup lattice of and . Which has more subgroups? Why?
Exercise 3 (Independent)
Create a multiplication table heatmap for . The group has elements. Can you identify visual "blocks" in the heatmap? What subgroup do they correspond to?
Summary
| Concept | Key idea |
|---|---|
| Cayley graphs | Nodes are elements, edges show the action of a generator. Full connection means generator, disconnected components mean non-generator |
| Subgroup lattices | For cyclic groups, the subgroup structure mirrors the divisor lattice of |
| Heatmaps | Color-coded multiplication tables make commutativity and subgroup boundaries visible as symmetry patterns |
Visualization turns abstract algebraic properties into spatial intuition. Generators that reach everything look connected, subgroups that nest look hierarchical, and commutativity shows up as symmetry about the diagonal.
Crypto teaser: In elliptic curve cryptography, the "group" is a set of points on a curve, not numbers mod . Visualizing EC group structure, and how it differs from , will be the subject of Module 06.
This concludes the Explore phase of Module 01. Next steps:
Implement: Open
rust/src/lib.rsand build these functions from scratch in Rust:mod_exp(guided, loop structure provided)gcd(guided, algorithm outline provided)is_generator(scaffolded, signature + hints)element_order(scaffolded, signature + hints)find_all_generators(independent, just the signature)
Each function has
todo!()stubs to fill in. When you finish one, remove#[ignore]from its tests and run:Break: Attack smooth-order groups and weak generators
Connect: See these concepts in RSA and Diffie-Hellman