Cosets and Lagrange's Theorem

You already know that a group can hide smaller groups inside it — its subgroups. The obvious next question is how big those hidden groups are allowed to be. Could a group of 12 elements contain a subgroup of 5? Of 7? The astonishing answer, discovered by Lagrange, is that a subgroup's size is never free to be anything it likes: it must divide the size of the whole group, exactly, with no remainder.

The reason is one of the most satisfying pictures in all of algebra. A subgroup H doesn't just sit somewhere inside G — it tiles the entire group into identical, non-overlapping blocks called cosets. Every block is a perfect copy of H, the same size down to the last element, and together they cover G without gaps or overlaps. Count the blocks, multiply by the block size, and you've counted the group. That single counting argument is Lagrange's theorem, and it pays out corollary after corollary — including, remarkably, Fermat's little theorem.

What is a coset?

Let H \le G be a subgroup. Pick any element g \in G and slide the whole of H along by multiplying every one of its members by g on the left. The resulting set is the left coset of H by g:

gH = \{\, g \ast h : h \in H \,\}.

Multiplying on the right instead gives the right coset Hg = \{\, h \ast g : h \in H \,\}. In an abelian group the two are always the same set, but in a non-abelian group gH and Hg can genuinely differ — a subtlety we return to in the "Watch out!" box.

One coset is special: taking g = e (the identity) gives eH = H itself. So H is always one of its own cosets — the block that happens to contain the identity.

The key fact: cosets partition the group into equal blocks

For a subgroup H \le G, the left cosets of H:

Why equal size? The map h \mapsto g \ast h sends H onto gH, and it is reversible (multiply by g^{-1} to undo it). A reversible map can't merge two elements into one or conjure new ones, so gH has precisely as many elements as H.

Why disjoint-or-identical? Suppose two cosets gH and g'H share even a single element x. Then x = g \ast h_1 = g' \ast h_2 for some h_1, h_2 \in H, which rearranges to g^{-1} \ast g' = h_1 \ast h_2^{-1} \in H. Once g^{-1}g' lands in the subgroup, every element of one coset is dragged into the other — they coincide completely. So the cosets slice G into equal-sized tiles that never overlap: a genuine partition.

Worked example: the cosets of \{0, 3\} in \mathbb{Z}_6

Take G = \mathbb{Z}_6 = \{0,1,2,3,4,5\} under addition mod 6, and the subgroup H = \{0, 3\} (it is closed: 3 + 3 = 6 \equiv 0). Because the operation is written +, the coset gH is written g + H. Slide H along by each element in turn:

0 + H = \{0, 3\}, \quad 1 + H = \{1, 4\}, \quad 2 + H = \{2, 5\}, 3 + H = \{3, 0\} = 0 + H, \quad 4 + H = \{4, 1\} = 1 + H, \quad 5 + H = \{5, 2\} = 2 + H.

After three distinct blocks, everything starts repeating — the later cosets are just the earlier ones relabelled. So there are exactly three different cosets, \{0,3\}, \{1,4\}, \{2,5\}, each of size 2 = |H|, and together they partition all six elements: 3 \times 2 = 6. The subgroup of size 2 has cut \mathbb{Z}_6 into three tidy pieces.

See the partition

Here are the n residues of \mathbb{Z}_n laid out on a ring, coloured by which coset of H = \langle d \rangle (the multiples of d) they fall into. Every colour is one coset: they all hold the same number of dots, |H| = n/d, and there are exactly d of them. Press Refresh to roll a fresh n and d and watch the group break into equal blocks every single time.

Notice there is never a leftover dot and never a block that is a different size from the rest. That visual regularity — equal blocks, cleanly tiling the whole ring — is Lagrange's theorem staring back at you.

The index [G:H]

The number of distinct cosets of H in G has a name: the index of H in G, written [G : H]. In the \{0,3\} \le \mathbb{Z}_6 example there were three cosets, so [\mathbb{Z}_6 : \{0,3\}] = 3. The index simply counts the tiles.

And that is all the machinery Lagrange needs. If H chops G into [G:H] blocks, each holding |H| elements, then counting G a block at a time gives the headline formula.

Lagrange's theorem

Let G be a finite group and H \le G a subgroup. Then:

The proof is exactly the picture above. The cosets of H partition G into [G:H] disjoint blocks, each of size |H|. Adding up the sizes of the blocks recovers the whole group:

|G| = \underbrace{|H| + |H| + \dots + |H|}_{[G:H]\ \text{blocks}} = [G:H] \cdot |H|.

Since |G| is [G:H] whole copies of |H|, the size of H divides the size of G with nothing left over. A subgroup of a group of order 12 can only have order 1, 2, 3, 4, 6, or 12 — never 5, 7, or 8, because those don't divide 12.

Worked example: rotations inside D_3

Now a non-abelian group, to see cosets do their work where the two sides could differ. The dihedral group D_3 is the six symmetries of an equilateral triangle: the three rotations \{e, r, r^2\} and three reflections \{s, rs, r^2 s\}, so |D_3| = 6. The rotations form a subgroup H = \{e, r, r^2\} of order 3.

There are only two left cosets. The identity coset is eH = \{e, r, r^2\} — all the rotations. Take any reflection, say s, and its coset sweeps up all three reflections:

sH = \{s,\ s r,\ s r^2\} = \{s, r^2 s, r s\} = \{\text{all three reflections}\}.

Two cosets, each of size 3: [D_3 : H] = 2 and |D_3| = 2 \cdot 3 = 6. Lagrange checks out — 3 divides 6 — and the group splits cleanly into "the rotations" and "the reflections". (Here H has index 2, and a subgroup of index 2 always has gH = Hg; the split into rotations-vs-reflections looks the same from either side.)

The corollaries roll out

Lagrange is a factory for facts. Three fall out almost immediately.

That first corollary is why "the order of an element" is always so well-behaved: it can never be some random number, only a divisor of |G|. The whole arithmetic of a finite group is quietly policed by a single divisibility rule.

Here is a small miracle. Fermat's little theorem — a cornerstone of number theory — is really just Lagrange's theorem wearing a disguise. Take a prime p and the group G = (\mathbb{Z}/p\mathbb{Z})^{\times} of nonzero residues under multiplication mod p. This group has |G| = p - 1 elements (every residue from 1 to p-1 is invertible).

Now apply the corollary g^{|G|} = e to any element a of this group. The identity here is 1 and |G| = p-1, so

a^{p-1} \equiv 1 \pmod{p} \qquad \text{for every } a \not\equiv 0.

That is Fermat's little theorem, proved without a single line of number theory — just "the order of an element divides the size of the group". Euler's theorem a^{\varphi(n)} \equiv 1 \pmod n is the same argument for the group of units mod n, whose size is \varphi(n). One counting picture, two famous theorems.

Lagrange says every subgroup's order divides |G|. It is tempting — and wrong — to read this backwards and assume that for every divisor d of |G| there must be a subgroup of order d. Lagrange guarantees no such thing; it only rules divisors out, it does not rule them in.

The classic counterexample is the alternating group A_4, the even permutations of four objects, with |A_4| = 12. The number 6 divides 12 perfectly — yet A_4 has no subgroup of order 6 at all. A divisor of the group's order can simply fail to be realised as a subgroup. So Lagrange is a one-way street: divisibility is necessary for a subgroup to exist, but not sufficient.

A second trap: in a non-abelian group the left coset gH and the right coset Hg need not be equal. They always have the same size (Lagrange only cares about sizes, so the theorem is unaffected), but they can be different sets. Subgroups for which gH = Hg for all g are special enough to earn their own name — normal subgroups — and they are the gateway to quotient groups.