Groups (Group Theory Basics)
- •
What it is
- •
A group is a set of elements paired with a single binary operation (often written as multiplication or addition) satisfying four properties: closure (combining two elements stays in the set), associativity, an identity element, and every element having an inverse. Cryptography almost always works inside a specific, well-understood group — most commonly (the nonzero integers mod a prime , under multiplication) or an elliptic curve's point set (under a geometrically-defined "addition"). A group is cyclic if some single element (a generator) can produce every element of the group by repeated application of the operation — for a multiplicative group. The order of an element is the smallest positive integer such that applying the operation to with itself times returns the identity ( in multiplicative notation); the order of the whole group is simply the number of elements it contains. Lagrange's theorem guarantees the order of any element always divides the order of the group — this single fact underlies an enormous amount of cryptographic reasoning (Fermat's little theorem, Euler's theorem, and Pohlig-Hellman's whole strategy all follow from it).
- •
- •
When to apply
- •
Whenever a scheme is described as operating "in a group" — anytime you see modular exponentiation, elliptic curve point multiplication, or language like "generator," "order," "subgroup" — this is the vocabulary and structural intuition everything else in that scheme builds on.
- •
- •
Symbols and assumptions
- •
is a set with one operation; counts its elements. The identity is 1 in multiplicative notation or 0 in additive notation. is the number of repetitions needed to return to the identity.
- •
- •
Math — step by step
- •
- Check closure, associativity, an identity, and inverses. Commutativity is an extra property (abelian); it is not required of every group.
- •
- The subgroup generated by is . If its size equals , then generates the whole group; otherwise it only generates a subgroup.
- •
- Powers repeat modulo the element order: if , then . A discrete log therefore identifies modulo , not necessarily modulo the ambient group size.
- •
- Lagrange’s theorem gives . In , . Distinguish the prime modulus from this group order .
- •
- •
Worked example
- •
Python
- •
def order(g, p): n = 1 x = g % p while x != 1: x = (x * g) % p n += 1 return n
- •
- •
SageMath
- •
F = GF(p) F(g).multiplicative_order() # order of g in F_p^* F.multiplicative_generator() # a generator of the whole group
- •
- •
- •
Cards
- •
What four properties define a group?
- •
Closure, associativity, an identity element, and inverses for every element.
- •
- •
What does Lagrange's theorem guarantee about the order of an element?
- •
The order of any element always divides the order of the whole group.
- •
- •
What's the difference between an element's order and the group's order?
- •
An element's order is the smallest n making g^n the identity; the group's order is the total number of elements — Lagrange's theorem says the former always divides the latter.
- •
- •