Skip to content

Modular Arithmetic

by claude-opus-4-6
Learning objectives
  • Modular Arithmetic

Entry conditions

You should know divisibility and be comfortable with groups and rings.

Definitions

Two integers aa and bb are congruent modulo nn (written ab(modn)a \equiv b \pmod{n}) if nn divides aba - b.

Congruence modulo nn is an equivalence relation that partitions Z\mathbb{Z} into nn residue classes. These classes form the quotient group Z/nZ\mathbb{Z}/n\mathbb{Z} under addition, and a ring under addition and multiplication.

Z/nZ\mathbb{Z}/n\mathbb{Z} is a field if and only if nn is prime. When nn is prime, every nonzero residue class has a multiplicative inverse.

Vocabulary (plain language)

  • Congruent modulo nn: two numbers that leave the same remainder when divided by nn.
  • Residue class: the set of all integers congruent to a given number modulo nn.

Symbols used

  • ab(modn)a \equiv b \pmod{n}: aa is congruent to bb modulo nn.
  • Z/nZ\mathbb{Z}/n\mathbb{Z}: the integers modulo nn.

Intuition

Modular arithmetic is “clock arithmetic.” On a 12-hour clock, 8+7=38 + 7 = 3 because 153(mod12)15 \equiv 3 \pmod{12}. The residue classes are the positions on the clock face, and arithmetic wraps around.

The algebraic significance is that Z/nZ\mathbb{Z}/n\mathbb{Z} is the simplest example of a quotient group — and when nn is prime, the simplest example of a finite field.

Worked example

In Z/7Z\mathbb{Z}/7\mathbb{Z}: 3+5=13 + 5 = 1 (since 81(mod7)8 \equiv 1 \pmod{7}), and 35=13 \cdot 5 = 1 (since 151(mod7)15 \equiv 1 \pmod{7}). So 33 and 55 are multiplicative inverses modulo 77.

Common mistakes

  • Confusing Z/nZ\mathbb{Z}/n\mathbb{Z} as a ring with Z/nZ\mathbb{Z}/n\mathbb{Z} as a field. It is always a ring; it is a field only when nn is prime.
  • Forgetting that congruence is an equivalence relation, not just a computational shortcut.

Relations

Authors
Date created

Cite

@misc{claude-opus-4-62026-modular-arithmetic,
  author    = {claude-opus-4-6},
  title     = {Modular Arithmetic},
  year      = {2026},
  url       = {https://emsenn.net/library/math/domains/number-theory/texts/modular-arithmetic/},
  publisher = {emsenn.net},
  license   = {CC BY-SA 4.0}
}