AnyLearn
All lessons
Mathintermediate

Subgroups, Cosets, and Lagrange's Theorem

Cosets cut a group into equal-sized blocks, and one counting argument then forces every subgroup's size to divide the group's. This lesson proves that, derives Fermat's little theorem from it as a corollary, and introduces the maps that let you compare two groups and say precisely when they are the same object.

Updated · AI-authored, review-gated · how lessons are made

Not signed in: your progress and quiz score won't be saved.
Progress1 / 10

Groups inside groups

A subgroup is a subset that is itself a group under the same operation. The rotations of a square, {e,r,r2,r3}\{e, r, r^2, r^3\}, form a subgroup of D4D_4: compose two rotations and you get a rotation, and each undoes. The reflections do not, since composing two reflections gives a rotation and leaves the set.

Checking all four axioms is unnecessary. Associativity is inherited, so for a non-empty finite subset only closure needs testing.

Definition: HGH \leq G means HH is a subgroup of GG. Every group has two trivial subgroups, {e}\{e\} and GG itself. The interesting question is always what sits between them, because that is where a group's internal structure lives.

Even integers are a subgroup of the integers under addition. Multiples of 3 are another. Odd integers are not, for the same reason the reflections were not.

Full lesson text

All 10 steps on one page, for reading, reference, and search.

Show

1. Groups inside groups

A subgroup is a subset that is itself a group under the same operation. The rotations of a square, {e,r,r2,r3}\{e, r, r^2, r^3\}, form a subgroup of D4D_4: compose two rotations and you get a rotation, and each undoes. The reflections do not, since composing two reflections gives a rotation and leaves the set.

Checking all four axioms is unnecessary. Associativity is inherited, so for a non-empty finite subset only closure needs testing.

Definition: HGH \leq G means HH is a subgroup of GG. Every group has two trivial subgroups, {e}\{e\} and GG itself. The interesting question is always what sits between them, because that is where a group's internal structure lives.

Even integers are a subgroup of the integers under addition. Multiples of 3 are another. Odd integers are not, for the same reason the reflections were not.

2. Cosets: sliding a subgroup around

Take a subgroup HH and an element gg. The left coset is the whole subgroup shifted by gg:

gH={gh:hH}gH = \{gh : h \in H\}

In D4D_4, let HH be the four rotations. Then eH=HeH = H, and sH={s,sr,sr2,sr3}sH = \{s, sr, sr^2, sr^3\}, which is the four reflections. Two cosets, four elements each, eight elements total, no overlap.

That is not luck. Two facts do all the work:

  • Every coset has exactly H|H| elements. The map hghh \mapsto gh is a bijection, since multiplying by g1g^{-1} undoes it.
  • Two cosets are identical or disjoint. If they share one element, multiplying through by inverses shows every element is shared.

So the cosets of HH tile GG completely, in equal-sized pieces, with none left over.

3. Lagrange's theorem, in two lines

Put the two facts together and the theorem is immediate.

Theorem (Lagrange). If HH is a subgroup of a finite group GG, then H|H| divides G|G|.

Proof. The cosets of HH partition GG, and each has exactly H|H| elements. If there are kk of them, then G=kH|G| = k \cdot |H|. \blacksquare

The number kk is called the index of HH in GG, written [G:H][G : H].

G=[G:H]H|G| = [G : H] \cdot |H|

Key idea: This is counting one set two ways, the same technique that gave the handshake lemma for graphs. No structure was needed beyond "equal-sized pieces that do not overlap", which is why the conclusion is so strong for so little input.

A group of order 12 can only have subgroups of order 1, 2, 3, 4, 6 or 12. Nothing else is possible, in any group of that size, ever.

4. What that rules out

Predict first

A group has exactly 7 elements. What are its subgroups, and what does the group look like?

The pattern generalises. The order of any element divides G|G|, because the element generates a cyclic subgroup whose size is that order.

gG=efor every gGg^{|G|} = e \quad \text{for every } g \in G

Raise any element to the size of the group and you land on the identity. Do it in a group of card shuffles and you have proved that repeating any shuffle enough times restores the deck.

5. Fermat's little theorem, for free

Take pp prime and let GG be the non-zero residues mod pp under multiplication. Every element has an inverse, because gcd(a,p)=1\gcd(a, p) = 1 for all aa from 1 to p1p-1, so GG is a group of order p1p - 1.

Now apply gG=eg^{|G|} = e directly:

ap11(modp)a^{p-1} \equiv 1 \pmod{p}

That is Fermat's little theorem, the result that collapsed a million-digit exponent to four multiplications in the discrete mathematics course. Here it arrives as a special case of a statement about abstract groups, proved by counting cosets, with no number theory involved at all.

Key idea: This is what the bare axioms buy. Fermat proved his theorem in 1640 and Lagrange's coset argument came later and independently, yet the general result contains the specific one entirely. Prove something once about groups and it is true everywhere a group turns up, including places nobody was looking.

6. Maps that preserve structure

To compare two groups you need maps that respect the operation. A homomorphism φ:GH\varphi : G \to H satisfies

φ(ab)=φ(a)φ(b)\varphi(ab) = \varphi(a)\,\varphi(b)

Combine first and then map, or map first and then combine: same answer.

MapFromToPreserves
det\detinvertible matricesnon-zero realsdet(AB)=detAdetB\det(AB) = \det A \det B
sign of a permutationpermutations{+1,1}\{+1, -1\}even and odd composition
xexx \mapsto e^xreals under ++positive reals under ×\timesea+b=eaebe^{a+b} = e^a e^b
xxmodnx \mapsto x \bmod nintegers under ++Zn\mathbb{Z}_naddition survives reduction

The exponential row is the reason logarithms were useful for three centuries: it converts a hard operation into an easy one by moving between two groups that have the same structure.

7. Kernel and image

Every homomorphism comes with two subgroups that describe exactly how much information it loses.

Definition: The kernel is everything mapped to the identity, kerφ={g:φ(g)=e}\ker \varphi = \{g : \varphi(g) = e\}. The image is everything reached in HH.

The kernel measures collapse. If it contains only ee, nothing is conflated and the map is injective. The determinant's kernel is the matrices of determinant 1, an enormous set, which is precisely how much the determinant forgets about a matrix.

The first isomorphism theorem ties them together: GG modulo the kernel is isomorphic to the image. Informally, quotient out exactly what the map throws away and what remains is a faithful copy of what it produced.

In practice: This is the same idea as a hash's collision structure or a lossy encoding's equivalence classes. "What does this transformation destroy?" has a precise answer, and it is a subgroup.

8. Same size, different group

An isomorphism is a homomorphism that is also a bijection, and two groups related by one are the same group wearing different labels. Order alone does not decide it.

There are exactly two groups of order 4, and they are genuinely different:

Z4\mathbb{Z}_4Klein four-group VV
Concretelyrotations of a square by 90 degreesreflections of a rectangle
Element orders1, 4, 2, 41, 2, 2, 2
Cyclic?yes, generated by one elementno
x2=ex^2 = e for all xx?noyes

No relabelling turns one into the other, because Z4\mathbb{Z}_4 contains an element of order 4 and VV does not, and element orders survive any isomorphism.

Gotcha: "Same number of elements" tells you nothing about structure. Finding an invariant that differs, element orders, abelian or not, number of subgroups, is how you prove two groups are distinct, and it is far easier than exhaustively checking that no bijection works.

9. How many groups are there of each size?

Lagrange constrains structure but does not determine it, and the count of distinct groups of a given order is wildly irregular.

Groups of order n, counted up to isomorphism
distinct groups05101552215121148910111213141516
Source: OEIS A000001, number of groups of order n up to isomorphism

Order 15 has exactly one group; order 16, one larger, has fourteen. Primes always give exactly one, by the argument two steps back. Powers of 2 explode: there are 49,487,365,422 groups of order 1024.

That explosion is why classification became the central problem of the field. The building blocks are the finite simple groups, those with no non-trivial normal subgroup, and their complete list was assembled over decades: several infinite families, plus exactly 26 sporadic groups belonging to no family at all, the largest of which has about 8×10538 \times 10^{53} elements.

10. Working with a group in code

Small groups are concrete enough to inspect directly, and building the multiplication table is usually the fastest way to answer a structural question.

from itertools import product

# Z_4 under addition mod 4, and the Klein four-group as pairs under XOR
Z4 = list(range(4))
add4 = lambda a, b: (a + b) % 4

V = list(product([0, 1], repeat=2))
xor = lambda a, b: (a[0] ^ b[0], a[1] ^ b[1])

def element_orders(elems, op, identity):
    orders = []
    for g in elems:
        x, k = g, 1
        while x != identity:
            x, k = op(x, g), k + 1
        orders.append(k)
    return sorted(orders)

element_orders(Z4, add4, 0)          # [1, 2, 4, 4]
element_orders(V, xor, (0, 0))       # [1, 2, 2, 2]

The two multisets differ, so no isomorphism exists. That is a complete proof, and it took nine lines. For anything larger, computational algebra systems such as GAP hold the classified groups and answer these questions directly.

Check your understanding

The lesson ends with a 5-question quiz. Take it in the player above to see your score.

  1. A group has 20 elements. Which of these cannot be the size of one of its subgroups?
    • 6
    • 4
    • 10
    • 5
  2. Why does Lagrange's theorem follow from cosets?
    • Because every coset is itself a subgroup
    • Because cosets partition the group into pieces all of size |H|, so |G| is a multiple of |H|
    • Because the number of cosets always equals |H|
    • Because cosets are closed under the group operation
  3. How does Fermat's little theorem follow from group theory?
    • It requires the unique factorisation theorem, not group theory
    • It follows from Euclid's algorithm applied to the residues
    • The non-zero residues mod p form a group of order p-1, and g^|G| = e in any finite group
    • It is a corollary of the first isomorphism theorem
  4. Z_4 and the Klein four-group both have 4 elements. Why are they not isomorphic?
    • One is abelian and the other is not
    • The Klein group has more subgroups, and subgroup counts must match
    • One is finite and the other is infinite in disguise
    • Z_4 has an element of order 4 and the Klein group does not, and element orders are preserved by isomorphism
  5. What does the kernel of a homomorphism measure?
    • Exactly what the map collapses: a trivial kernel means the map is injective
    • The size of the target group
    • Whether the map is surjective
    • The number of generators the source group needs

Related lessons

Math
advanced

Why There Is No Quintic Formula

Quadratics, cubics and quartics all have formulas in radicals. The general fifth-degree equation has none, and not because nobody clever enough has tried. This lesson explains how permuting the roots turns an algebra question into a group question, and why the answer changes at degree five when a group of order 60 refuses to break down.

10 steps·~15 min
Math
intermediate

What a Group Is, and Why the Axioms Are So Bare

A group is a set with one operation obeying four rules, and that deliberate poverty is the point: anything proved about groups holds for rotations, permutations, integers, XOR and Rubik's cube at once. This lesson builds the definition from symmetry, works through the symmetries of a square, and shows where groups already sit in code.

10 steps·~15 min
Math
intermediate

Symmetry Groups: Crystals, Conservation Laws, and Neural Networks

Group theory earns its keep when a symmetry argument settles a physical question no calculation was going to answer. This lesson covers group actions and counting up to symmetry, why crystals cannot have five-fold rotation and what happened when one did, Noether's link between symmetry and conservation, and how the same idea is built into modern networks.

10 steps·~15 min
Math
advanced

Newton's method and the interior point revolution

Second derivatives buy something gradients cannot: a step shaped by curvature, immune to conditioning, converging quadratically. This lesson builds Newton's method, then layers it on a log barrier to get interior point methods, the machinery that made large constrained problems solvable with a certificate rather than a hope.

13 steps·~20 min