Group Theory Order Calculator

Element Order · Subgroup Order · Lagrange's Theorem

Compute the order of elements in Zₙ (cyclic), Sₙ (permutation), and Zₙ* (multiplicative) groups. Generate subgroups and verify Lagrange's theorem.

Group Type

Quick Examples

Group Zₙ = {0, 1, 2, ..., n−1} under addition mod n. Element a ∈ {0, ..., n−1}. Identity = 0.

What Is Group Theory?

Group theory is a branch of abstract algebra that studies the algebraic structure called a group — a set equipped with a binary operation satisfying four axioms: closure, associativity, the existence of an identity element, and the existence of inverses. Developed in the 19th century by mathematicians including Galois, Cauchy, and Lagrange, group theory has become a unifying framework across mathematics, physics, chemistry, and computer science.

Groups appear naturally whenever we study symmetry. The symmetries of a regular polygon, the set of permutations of n objects, the integers under addition, and the non-zero residues modulo a prime under multiplication are all examples of groups.

Order of an Element

Given a group G with identity element e, the order of an element a, written ord(a) or |a|, is the smallest positive integer k such that ak = e. If no such k exists, a has infinite order. For finite groups, every element has finite order, and ord(a) always divides the order of G by Lagrange's theorem.

Intuitively, the order measures how many times you must "apply" the element to itself before returning to the starting point (the identity).

Cyclic Groups Zₙ

The cyclic group Zₙ (integers mod n under addition) is the simplest group of order n. Its elements are {0, 1, 2, ..., n−1} and the operation is addition modulo n. The identity is 0.

For element a in Zₙ, the order is given by the formula:

FormulaWhere
ord(a) = n / gcd(a, n)gcd = greatest common divisor
a is a generator ⇔ gcd(a, n) = 1generates all of Zₙ
❬a❭ = {0, a, 2a, ..., (k−1)a} mod nk = ord(a)

For example, in Zₙ₁₂: ord(3) = 12/gcd(3,12) = 12/3 = 4, and the subgroup ❬3❭ = {0, 3, 6, 9}. Meanwhile, ord(5) = 12/gcd(5,12) = 12/1 = 12, so 5 generates all of Z₁₂.

Lagrange's Theorem

Lagrange's theorem is one of the most fundamental results in group theory. It states: if G is a finite group and H is a subgroup of G, then |H| divides |G|. The quotient |G|/|H| = [G:H] is called the index of H in G.

As an immediate corollary, for any element a in a finite group G, ord(a) divides |G|. This is because the cyclic subgroup ❬a❭ generated by a has order exactly ord(a), and by Lagrange's theorem |❬a❭| divides |G|.

Lagrange's theorem also implies that groups of prime order are always cyclic, and every non-identity element is a generator.

Permutation Groups Sₙ

The symmetric group Sₙ consists of all permutations (bijections) of n elements, with function composition as the operation. |Sₙ| = n!. Every permutation can be written uniquely (up to order) as a product of disjoint cycles.

The order of a permutation equals the LCM of its cycle lengths. For instance, (1 2 3)(4 5) has cycle lengths 3 and 2, so its order is LCM(3, 2) = 6. This follows because each cycle individually returns to the identity after exactly its length number of applications, and disjoint cycles commute.

The cycle type of a permutation (its list of cycle lengths in non-increasing order) completely determines its order.

Multiplicative Groups Zₙ*

The multiplicative group Zₙ* consists of all integers from 1 to n−1 that are coprime to n, under multiplication mod n. Its order is Euler's totient φ(n).

A primitive root modulo n is an element a whose order equals φ(n), meaning it generates all of Zₙ*. Primitive roots exist if and only if n = 1, 2, 4, pk, or 2pk for odd primes p. For example, 3 is a primitive root mod 7 since 3 has order 6 = φ(7), generating {1, 2, 3, 4, 5, 6}.

Applications in Cryptography

Group theory underpins much of modern cryptography. The discrete logarithm problem — finding k such that gk ≡ h (mod p) — is believed to be computationally hard in certain groups, which forms the security basis of:

  • Diffie-Hellman key exchange: Uses a generator g of Zₙ* to share a secret exponent.
  • ElGamal encryption: Based on the same discrete log problem in Zₙ*.
  • Elliptic Curve Cryptography (ECC): Operates in the group of points on an elliptic curve over a finite field — substantially more efficient per bit of security.
  • RSA: Although not directly a discrete log problem, RSA's security relies on the structure of Zₙ* and the difficulty of factoring n = pq to compute φ(n).

Reference Table: Common Group Orders

GroupElementord(element)Group OrderGenerator?
Z₁₂3412No
Z₁₂51212Yes
Z₆236No
S₅(1 2 3)(4 5)6120No
S₄(1 2 3 4)424No
Z₇*366Yes (primitive root)
Z₈*224 (φ(8)=4)No

Frequently Asked Questions

What is the order of an element in a group?
The order of an element a in a group G is the smallest positive integer k such that ak = e (the identity). For finite groups, this is always a finite number, and by Lagrange's theorem, ord(a) must divide |G|. The element a generates a cyclic subgroup ❬a❭ of size ord(a).
How do you find the order of an element in Zₙ?
In the cyclic group Zₙ (integers mod n under addition), the order of element a is n / gcd(a, n). This is because we need the smallest k > 0 such that k · a ≡ 0 (mod n), which equals n / gcd(a, n). For example, in Z₁₂: ord(3) = 12/gcd(3,12) = 12/3 = 4, and ord(5) = 12/gcd(5,12) = 12/1 = 12.
What is Lagrange's theorem in group theory?
Lagrange's theorem states that for any finite group G and subgroup H, |H| divides |G|. The quotient |G|/|H| = [G:H] is the index — the number of distinct left cosets of H. As a corollary, the order of every element divides the group order, since the cyclic subgroup it generates is itself a subgroup.
How is the order of a permutation calculated?
The order of a permutation equals the LCM of its disjoint cycle lengths. Decompose the permutation into disjoint cycles (including fixed points as 1-cycles), find the length of each cycle, then compute their LCM. For example, (1 2 3)(4 5) has cycle lengths 3 and 2, so its order is LCM(3, 2) = 6.
What is a cyclic group?
A cyclic group is a group generated by a single element — every element can be written as a power of the generator. The group Zₙ of integers mod n is cyclic of order n. An element a in Zₙ generates the whole group if and only if gcd(a, n) = 1. The number of generators of Zₙ is φ(n) — Euler's totient.
What is a primitive root?
A primitive root modulo n is an element a in Zₙ* with ord(a) = φ(n), meaning it generates the entire multiplicative group. They exist only for n = 1, 2, 4, pk, or 2pk (odd prime p). Primitive roots are essential in discrete logarithm-based cryptography: systems like Diffie-Hellman require selecting a primitive root g of Zp* for prime p.
What are the applications of group theory?
Group theory has broad applications: Cryptography (Diffie-Hellman, ElGamal, ECC all rely on group hardness assumptions); Physics (Lie groups describe particle physics symmetries — the Standard Model uses SU(3)×SU(2)×U(1)); Chemistry (point groups classify molecular symmetry for spectroscopy); Combinatorics (Burnside's lemma counts colorings under symmetry); and Coding theory (error-correcting codes use group structure of finite fields).