Group Theory

It's Just Shuffling

Why do a square, a clock, and a cup shuffle all obey the same four rules?

Here is a square.

Rotate it 90 degrees. It looks exactly the same.

This seems like the most boring observation in mathematics. A square looks the same after a quarter turn — of course it does. You have known this since you were five.

But something strange happens if you take this boring observation seriously. If you track what happens when you combine rotations — do one, then another — you discover a hidden arithmetic. An arithmetic that has a structure that keeps showing up in places you would never expect, in systems that have nothing to do with geometry.

A square. A clock. A set of cups. Same hidden structure.

Why? What forces completely unrelated systems to behave the same way? And once you see the pattern, can you find it elsewhere — in card shuffles, in wallpaper designs, in the structure of molecules?

Let's find out. And let's start with the most boring observation in mathematics.


1

Eight Moves and a Table #

A square is sitting on the table in front of you. Its corners are labeled 1, 2, 3, 4 so you can track what happens when it moves. Right now, corner 1 is at the top-left.

Rotate it 90 degrees clockwise.

The square looks the same — it is still a square — but the corners have shuffled. Corner 4 is now where corner 1 used to be. Corner 1 moved to where corner 2 was. Everything cycled one position clockwise. That rotation is a rearrangement — a shuffle — of four things.

How many distinct rotations can you do before you end up back where you started?

How many distinct rotations bring the square back to its starting position? (Count "doing nothing" as one of them.)

Four. You can rotate by 0 degrees (do nothing), 90 degrees, 180 degrees, or 270 degrees. A 360-degree rotation brings every corner back to its starting position — it is the same as doing nothing. You have looped.

Here is where it gets interesting. What happens if you do two rotations in a row?

Rotate 90 degrees, then rotate 90 degrees again. Where do the corners end up? In the same positions as a single 180-degree rotation. Two quarter-turns equal one half-turn. That probably feels obvious. But keep going.

Rotate 90 degrees, then rotate 180 degrees. That is a 270-degree rotation. Rotate 180 degrees, then rotate 180 degrees. That is 360 degrees — which is the same as 0, doing nothing.

Every time you combine two rotations, you get another rotation from the same set of four. You never land on something new. You never escape the system.

Try it yourself. In the interactive below, pick any two rotations and combine them. Watch where the corners end up. Then find which single rotation matches the result.

Click a row header (first rotation) and a column header (second rotation) to combine them. Watch the square animate, then click the matching answer.

But rotations are not the only moves that leave the square looking the same. There is another kind of move hiding in plain sight.

Pick up your square and flip it over — reflect it across the vertical line running through the middle. The square still looks like a square. The corners have rearranged, but the shape is unchanged. That is a symmetry too.

If reflections feel "unfair" — you cannot reflect a physical tile without lifting it off the table — think of it this way: we are tracking what happens to corner positions, not to physical objects. A reflection is a rearrangement of corners that preserves all the distances between them. It is as legitimate a symmetry move as any rotation.

How many reflection symmetries does a square have?

A square has four rotational symmetries (including doing nothing). How many reflections leave a square looking the same?

Four. You can reflect across the vertical axis, the horizontal axis, or either of the two diagonals. Each one shuffles the corners into a new arrangement, and the square still looks the same.

There are four. You can reflect across the vertical axis, the horizontal axis, or either of the two diagonals. Each one shuffles the corners into a new arrangement, and the square still looks the same.

That gives us eight symmetry moves in total: four rotations (R0, R90, R180, R270) and four reflections (call them V, H, D1, D2 for vertical, horizontal, and the two diagonals).

Now here is something that was not true for rotations alone. Try combining a rotation with a reflection.

Rotate 90 degrees, then reflect across the vertical axis. Track the corners. Now try the reverse: reflect across the vertical axis, then rotate 90 degrees. Track the corners again.

Do you get the same result both ways?

Different results. The order matters. Rotation followed by reflection gives a different corner arrangement than reflection followed by rotation.

You do not. The order matters. Rotation followed by reflection gives a different corner arrangement than reflection followed by rotation.

This is your first encounter with something genuinely new. The four rotations by themselves were well-behaved — you could do them in either order and land on the same result. But the moment reflections enter the picture, order starts to matter. The combination table for all eight moves is not symmetric across the diagonal.

The full 8-element dihedral group D4. Notice: the table is not symmetric across the diagonal. Order matters when reflections are involved.

You have built two combination tables for the same square. The first, using only rotations, was small and well-behaved — every combination gave the same result regardless of order. The second, with reflections added, was larger and wilder — order mattered.

The eight symmetries of a square form the dihedral group D4. The "D" stands for dihedral (two-faced — rotations and reflections). The subscript 4 indicates a square (4 sides). A regular triangle has D3 (6 symmetries), a regular pentagon has D5 (10 symmetries), and so on. The pattern: a regular $n$-gon has $2n$ symmetries — $n$ rotations and $n$ reflections.

And notice what the corners did every time you applied a symmetry move: they shuffled. A rotation cycled them around. A reflection swapped some of them. Every symmetry of the square is a rearrangement of its corners. Keep that thought.

Now here is a question. That first table — the 4x4 table of rotations — has a structure to it. A cyclic, wrapping-around structure. Is there anything else in the world, something that has nothing to do with squares, that wraps around in exactly the same way?


2

Same Table, Different Costume #

Imagine a clock with only four hours: 0, 1, 2, 3. When you get past 3, you wrap back to 0. This is clock arithmetic — addition where the numbers cycle.

This is arithmetic modulo 4, written $\mathbb{Z}_4$. If you have seen modular arithmetic before, you know exactly what this is. If you haven't, just think "a clock that wraps at 4 instead of 12."

What is 1 + 1 on this clock? That is 2. What is 2 + 3? That is 5, which wraps to 1. What is 3 + 3? That is 6, which wraps to 2.

Here is an invitation. Build the full combination table for addition on this four-hour clock — all sixteen entries, every pair of numbers from 0 to 3.

Build the clock addition table, then discover the hidden connection to the rotation table.

You have two tables in front of you. Look at them. Do you notice anything?

They are the same table. Once you find the right relabeling, every entry matches.

Two tables. Two completely different systems. One is about rotating a physical object. The other is about adding numbers that wrap around. And once you find the right relabeling, they are the same table.

Different objects. Same structure.

When two systems have combination tables that match perfectly under some relabeling — when you can translate every move in one system to a move in the other and all the combinations still work — we say the two systems are isomorphic. Literally: "same shape." Not the same things, but the same pattern of relationships.

Formally, an isomorphism between two groups is a bijection (one-to-one correspondence) $\phi: G \to H$ that preserves the operation: $\phi(a \cdot b) = \phi(a) \cdot \phi(b)$ for all $a, b \in G$. The rotation-clock correspondence is one such mapping: $\phi(R0) = 0$, $\phi(R90) = 1$, $\phi(R180) = 2$, $\phi(R270) = 3$.

This is not a coincidence. Something deeper is going on — some shared pattern that both systems obey, independent of what the "moves" actually are. The rotations do not know about clock arithmetic, and the clock does not know about squares. But they are playing the same game.

Here is a test: could you predict whether a new system — one you have never seen — would produce this same table? You could, if you knew what to look for. And it turns out there are only four things to check.


3

Four Rules You Already Know #

Look back at the two tables you built. Without being told any rules, you have already discovered four things about how these systems work. Let me point them out — not as new information, but as an inventory of what you already noticed.

The system is closed. Every time you combined two rotations, you got a rotation. Every time you added two clock numbers, you got a clock number. You never left the system. You never landed on some fifth thing that was not in your original set.

There is a move that does nothing. The 0-degree rotation leaves the square alone. Adding 0 on the clock leaves the number unchanged. Both systems have an element that, when combined with anything, gives back that same anything.

Every move can be undone. Rotate 90 degrees, and you can undo it by rotating 270 degrees — because 90 + 270 = 360 = 0. On the clock, adding 1 can be undone by adding 3, because 1 + 3 = 4 = 0. Every element has a partner that brings you back to the do-nothing state.

Grouping does not matter. If you chain three rotations together — say 90, then 180, then 90 — it does not matter whether you combine the first two first or the last two first. (90 + 180) + 90 gives the same result as 90 + (180 + 90). The final position is the same either way.

Associativity is the axiom that gets the least love, and honestly, it earns that neglect in most concrete examples — it is hard to find a natural operation where it fails. But it is quietly essential. Without it, an expression like "do A, then B, then C" would be ambiguous — you would need parentheses everywhere, and the whole structure would collapse. It is the rule that makes sequences of moves well-defined.

These four observations — closure, an identity element, inverses, and associativity — are not axioms I am imposing from the outside. They are things you saw. You built tables, and both tables had these properties. That is why the tables worked.

Here is the key idea: any system that satisfies these four rules is called a group. That is the whole definition. Not "a group of things" in the everyday sense — a group in the mathematical sense. A set of moves, a way to combine them, and these four properties.

If you ever open a textbook, you will see these four rules written as: a set $G$ with a binary operation, satisfying closure, identity, inverses, and associativity. The notation looks heavier than the idea — you already understand everything it says. (Some texts fold closure into the definition of "binary operation," making it three axioms rather than four. The content is the same either way.)

Now let me show you why each rule earns its place — not by arguing for it, but by showing you what breaks when you remove it.

Take your four rotations and throw one away. Remove the 90-degree rotation. Keep only R0, R180, and R270.

Can this smaller set of three rotations still form a group? Try to build the combination table. What goes wrong?

Something breaks. Combine R270 with R180 and you get R90 — which is not in the set. Closure fails.

Try combining R270 with R270. That is a 540-degree rotation, which is the same as 180 degrees. Fine — R180 is still in the set. But combine R270 with R180. That is 450 degrees, which is 90 degrees. And R90 is not in your set anymore. You have been kicked out of the system. Closure fails.

Without closure, the table cannot even be built. The system leaks. That is why closure is not a bureaucratic requirement — it is the condition that makes the combination table possible.

What about {R0, R180}? That set does form a group — it is closed, has an identity, every element has an inverse, and associativity holds. It is a group with just two elements. If you are wondering about systems that fail the other rules: the natural numbers under addition have no inverses (you cannot subtract your way back to 0 from 5). Rock-paper-scissors has closure but no identity. Each rule, when removed, breaks the structure in its own way.

A 3-element set that fails to be a group. When R270 + R180 = R90 (not in the set), the table breaks.

Take a breath. Look at what you own.

You built combination tables for two different systems and saw they were isomorphic — same structure, different costume. You extracted four rules that made those tables work. You gave the structure a name: a group. And you saw what happens when a rule is violated — the table breaks.

That is the core of the idea. Everything from here forward is about exploring what groups can do — and discovering just how wild they can get.

Here is the first surprise: every group we have seen so far has a peculiar feature. The order in which you combine two moves does not matter. R90 then R180 is the same as R180 then R90. On the clock, 1 + 3 is the same as 3 + 1.

You already saw a hint that this is not always true — reflections of the square broke the symmetry of the table. But let me show you the starkest example. It involves three cups and a shuffle.


4

When Order Matters #

Three cups on a table, upside down, in a row. Call them A, B, C from left to right.

Here is a move: swap the left two cups. Now the order is B, A, C.

Here is another move: swap the right two cups. Applied to the starting position ABC, that would give A, C, B.

But what if you do both, one after the other? Start at ABC. Swap the left two: you get BAC. Now swap the right two in the result: swap the second and third cups of BAC, giving BCA.

A note on convention, because this matters: "do X, then do Y" always means apply X first, look at the result, then apply Y to that result. We are composing moves left to right, like reading a sentence. This is important — the whole point of this section is that order matters, so we need to be precise about what "order" means.

The net effect: the cups went from ABC to BCA. A single rearrangement.

Here is the question: how many total rearrangements of three cups are there?

How many different orders can three cups be in? List as many as you can before scrolling.

Six. ABC, ACB, BAC, BCA, CAB, CBA.

There are six.

The number of rearrangements of $n$ objects is $n! = n \times (n-1) \times \cdots \times 1$. For three objects, $3! = 6$. For a deck of 52 cards, $52!$ is a number so large it exceeds the number of atoms in the observable universe. Every time you shuffle a deck, you are navigating a group of that size.

$$\text{ABC} \quad \text{ACB} \quad \text{BAC} \quad \text{BCA} \quad \text{CAB} \quad \text{CBA}$$

And here is the key observation: if you do one rearrangement and then another, the result is always some rearrangement of the same three cups. You never end up with four cups, or two cups, or cups that have merged into a quantum superposition. The system is closed.

There is a rearrangement that does nothing (leave the cups where they are). Every rearrangement can be undone (just put the cups back). And chaining three rearrangements is associative — grouping does not matter.

Closure. Identity. Inverses. Associativity. This is a group. It has six elements instead of four, but it satisfies the same four rules.

Build the 6x6 combination table. Notice: it is NOT symmetric across the diagonal. Order matters.

Try combining two rearrangements in both orders using the table above. Do you always get the same result?

Sometimes different. This is the smallest non-commutative group — the simplest system where order matters.

Here is a concrete example. Start at ABC. Swap the left pair (positions 1 and 2) to get BAC. Now swap the right pair (positions 2 and 3) in the result to get BCA.

Now reverse the order. Start at ABC. Swap the right pair first to get ACB. Now swap the left pair in the result to get CAB.

BCA is not CAB. The order mattered.

In the language of permutations, we just computed two compositions of transpositions: $(1\;2)$ followed by $(2\;3)$ sends ABC to BCA. But $(2\;3)$ followed by $(1\;2)$ sends ABC to CAB. These transpositions do not commute.

This is genuinely different from anything you saw with the four rotations of the square. Those rotations were commutative — you could combine moves in either order and get the same result. The cup-shuffling group is not. The order in which you perform the moves changes the outcome.

A group where every pair of elements commutes ($a \cdot b = b \cdot a$ for all $a, b$) is called abelian, after the Norwegian mathematician Niels Henrik Abel. The rotation-only group of the square is abelian. The full symmetry group of the square (with reflections) is not. And the group of all rearrangements of three objects is not. Whether a group is abelian is a structural property — a personality trait of the system.

This is not a curiosity. It is a dividing line in the landscape of groups. Some groups care about order. Some do not. And you can see which is which just by looking at the combination table: if it is symmetric across the diagonal, order does not matter. If it is not, order matters.

The rotation-only table was symmetric. The full square-symmetry table was not. The cup-shuffle table is not. Same four rules, but profoundly different character.

Where Shuffling Hides

Here are three places where this same structure quietly runs the world.

Music. Transpose a melody up three half-steps. Then transpose it up another five. That is the same as transposing up eight half-steps. But twelve half-steps brings you back where you started — the octave wraps around. Transposition on the twelve-note scale is clock arithmetic modulo 12.

The group of transpositions modulo the octave is isomorphic to $\mathbb{Z}_{12}$, the integers modulo 12. If you read the scaling essay, you may also notice: matrix multiplication does not commute, which means invertible matrices form a non-abelian group. The non-commutativity you just saw with cups is the same phenomenon that makes matrix multiplication order-dependent.

Molecules. A water molecule has a specific shape — two hydrogen atoms and an oxygen atom forming a V. The symmetries of that shape (the rotations and reflections that leave it looking the same) form a group. Chemists use these symmetry groups to predict which molecular vibrations absorb infrared light — which is how infrared spectroscopy identifies unknown chemicals.

Cryptography. When your browser establishes a secure connection, it relies on arithmetic in very large groups — multiplication modulo enormous prime numbers. The security depends on an asymmetry: computing $g^n$ modulo a large prime is fast (just multiply repeatedly), but figuring out $n$ from the result is essentially impossible with current technology. The operation is a one-way door.

Clock arithmetic modulo a prime number is not just a group — it is a field, meaning you can also multiply and divide. This richer structure is precisely why it is useful in cryptography. Fields are groups with more structure, and they are stories for another time.

Three wildly different domains. Same underlying idea: a set of moves, a way to combine them, and the four rules.

But here is what should nag at you: we have now seen groups with 4 elements, groups with 6 elements, groups with 8 elements, groups that commute and groups that do not. Are these all truly different structures, or are some of them the same thing in disguise? You already saw the square rotations and the clock produce identical tables. Could something like that happen at a deeper level — could every group, no matter how exotic, be a group of rearrangements?


5

Every Group Is a Shuffling Group #

Every group you have seen — the rotations of a square, clock arithmetic, the eight symmetries of a square, the cup shuffles — is a group of moves. Things you can do. Actions you can perform on some object that rearrange it and leave it in a valid state.

Is that always true? Could you cook up some abstract group — defined by pure logic, with elements that are not "moves" in any obvious sense — that is not a rearrangement group?

In 1854, Arthur Cayley proved that you cannot. Every group, no matter how it is defined, no matter what its elements "are," is isomorphic to a group of rearrangements. Every group is a shuffling group.

Cayley's theorem: every group $G$ is isomorphic to a subgroup of $\text{Sym}(G)$, the group of all bijections from $G$ to itself. The proof is elegant — for each element $g \in G$, define the function "multiply everything by $g$ on the left." This function is a rearrangement of the elements of $G$, and the mapping $g \mapsto$ "multiply by $g$" preserves the group operation. Every group element is a shuffle of the group itself.

Here is what that means concretely. Take the four-element clock group. Its elements are 0, 1, 2, 3. Now look at what "adding 1" does to every element:

$$0 \to 1, \quad 1 \to 2, \quad 2 \to 3, \quad 3 \to 0$$

That is a rearrangement. The element 1 shuffles the entire group by cycling everything forward one step. And the element 2 shuffles everything forward two steps. Every element of the group corresponds to a specific rearrangement of the group's own elements.

The clock group did not look like a shuffling group. It looked like addition. But underneath the surface, it was rearrangements all along.

Every element of the clock group IS a rearrangement. Select "add 1" and watch every element shuffle forward one step. The Cayley table was encoding permutations all along.

This is the punchline, and I want to make sure it lands.

You started with a square on a table. You shuffled its corners through rotations and reflections. You saw the same shuffling structure in clock arithmetic. You extracted four rules, gave the structure a name, and discovered that some groups care about order and some do not.

And now Cayley's theorem says: every single one of these groups, no matter how exotic, is a group of rearrangements. Every group is a shuffling group. The title of this essay is not a metaphor. It is a theorem.

Seventeen Kinds of Wallpaper

So what is the mathematics of groups really about? It is this: pick up an object, move it, ask what stayed the same. The collection of all such moves, with its rules for combining them, is a group. And every group, by Cayley's theorem, is a system of rearrangements.

Which means: the mathematics of groups is the mathematics of symmetry. And symmetry is everywhere.

Here is my favorite example of what that means.

If you have ever stared at tilework in a mosque, or a tessellation by M.C. Escher, or the pattern on a piece of wrapping paper, you have looked at a wallpaper pattern — a design that repeats in two directions to fill the plane.

How many fundamentally different ways are there to build such a pattern? Not how many designs — there are infinitely many of those. How many different symmetry types? How many structurally distinct ways can a pattern repeat?

How many fundamentally different types of wallpaper symmetry exist? The answer has been known since 1891.

Exactly 17. Not approximately, not "for most practical purposes" — exactly 17. Every wallpaper pattern that has ever been created or ever will be created has one of exactly 17 symmetry types.

The answer is 17. Exactly 17. Not approximately, not "for most practical purposes" — exactly 17. Every wallpaper pattern that has ever been created or ever will be created has one of exactly 17 symmetry types.

The classification of the 17 wallpaper groups (also called plane crystallographic groups) was completed by Evgraf Fedorov in 1891. Each group describes a different combination of translations, rotations, reflections, and glide reflections that can tile the plane. The proof that there are exactly 17 is a beautiful application of group theory to geometry. In three dimensions, the analogous classification gives 230 space groups — and those are how crystallographers determine molecular structures from X-ray diffraction data.

This is what group theory does. Each of those 17 types is a group — a specific collection of symmetry moves that satisfy the four rules. The classification theorem says: that is all there is. Seventeen groups, and the plane is fully cataloged.

All 17 wallpaper symmetry groups. Click any pattern to expand it. Every repeating pattern ever created falls into one of these 17 types.

Every pattern that has ever been tiled on a wall — in every mosque and cathedral and kitchen — obeys one of exactly 17 symmetries. Group theory is the reason we know this.

And it all started with a square on a table.

There is a name for the broader field that studies groups and their relatives: abstract algebra. But by now, you know there is nothing abstract about it. It is the most concrete thing in the world: pick up an object, move it, and ask what stayed the same.

Groups are just the beginning. There are richer structures with two operations (addition and multiplication) called rings, and richer still are fields, where you can also divide. The integers form a ring. The real numbers form a field. Clock arithmetic modulo a prime is a field — which is precisely why it powers cryptography. Each level adds structure, and each has its own version of the same question: what patterns are forced by the rules?

Every time you pick up a coaster and rotate it, you are inside a group. Every time you shuffle a deck of cards, you are navigating a group so vast its elements outnumber the atoms in the universe. Every time you notice that a snowflake looks the same from six angles, you are seeing a group announce itself.

The mathematics was always there, hiding in the symmetry. All you had to do was shuffle.