Number Theory: Modular Arithmetic

17 Dec 2021


§ Motivation

Modular arithmetic will be used in topics like Diffie-Hellman and RSA.

§ Modular Arithmetic

Modular Arithmetic

For an integer pp, we can define x(modp)=z(modp)x \pmod{p} = z \pmod{p} to mean p(xz)p \vert (x - z). Often, for any number xx we represent it with the unique remainder xx' where 0x<p0 \leq x' \lt p. So,

x(modp)x.x \pmod{p} \equiv x'.

We say that xy(modm)x \equiv y \pmod{m} to say that the remainder of xx and yy after division by mm is the same, not that xx equals yy.

I use the notation anba \equiv_n b interchangably with the tradtional ab(modn)a \equiv b \pmod{n}.

§ Properties

  • x(modp)+y(modp)(x+y)(modp)x \pmod{p} + y \pmod{p} \equiv (x + y) \pmod{p}.
  • (x(modp))(y(modp))xy(modp)(x \pmod{p})(y \pmod{p}) \equiv xy \pmod{p}.