MathAlgebraGroups

Multiplicative groups modulo m

19 minutes read

We know how to do arithmetic operations -- addition and multiplication -- modulo some fixed positive integer. If this integer is a prime number, modular multiplication shows some non-obvious properties, having very practical applications -- in fact, secure communications today heavily rely on these properties. Let's see what they are.

Modular arithmetic: a brief recap

Firstly, let's recall that when doing arithmetic operations modulo mm, we replace all integers with their residues (in other words, the remainders obtained when we divide these integers by mm). The set Zm\mathbb{Z}_m of these residues is, in fact, a range {0,1,m1}\{0, 1, \ldots m − 1\}. But, to avoid confusion between usual operations and modular ones, we write the residues with a line over them:

Zm={0,1,,m1}\mathbb{Z}_m = \{\overline{0},\overline{1}, \ldots, \overline{m-1}\}Now, if we fix some mm (let m=7m = 7), we can write simply

3+6=236=4\overline{3} + \overline{6} = \overline{2}\\ \overline{3} \cdot \overline{6} = \overline{4}\\instead of 3+62(mod7)364(mod7)3 + 6 \equiv 2 \pmod 7 \\ 3 \cdot 6 \equiv 4 \pmod 7 \\Of course, the "overlined" notation works only if we explicitly indicate mm.

We have already seen that Zm\mathbb{Z}_m is a group with respect to modular addition. The addition operation is associative, 0\overline{0} is a neutral element, and mx\overline{m - x} is an additive inverse for x\overline{x}. Note that the group properties hold for any positive mm -- even for m=1m = 1, although in this case Zm\mathbb{Z}_m is a trivial group containing only one element 0\overline{0}.

The group of units modulo m

But do the group properties hold when we consider Zm\mathbb{Z}_m with the operation of modular multiplication? Let's check! From now on, we will talk about m2m \geq 2.

We start with a promising observation that modular multiplication is associative. The next property to check is the existence of a neutral element. And here it is: 1x=x1=x for any xZm\overline{1} \cdot \overline{x} = \overline{x} \cdot \overline{1} = \overline{x} \text{ for any } \overline{x} \in \mathbb{Z}_{m}But with the third property -- the existence of inverse for any element -- we encounter a problem. For example, 0\overline{0} has no inverse, because x0=0\overline{x} \cdot \overline{0} = \overline{0} for any xZm\overline{x} \in \mathbb{Z}_{m}. In general, the residues that are relatively prime to mm -- and only them -- have inverses (which can be found using Euclid's algorithm).

So let's consider not the whole set Zm\mathbb{Z}_m, but only its invertible elements, the residues relatively prime to mm. Such residues are also called units modulo mm. The set of units will be denoted as Zm\mathbb{Z}^{*}_m. Note that a product of two units aZm\overline{a} \in \mathbb{Z}^{*}_{m} and bZm\overline{b} \in \mathbb{Z}^{*}_{m} will also be a unit (check that the product of inverses for a\overline{a} and b\overline{b} will be an inverse for their product!)

For m=8m = 8, there are 4 units modulo mm :

Z8={1,3,5,7}\mathbb{Z}^{*}_{8} = \{\overline{1}, \overline{3}, \overline{5}, \overline{7} \}and there is the same number of units modulo m=12m = 12:

Z12={1,5,7,11}\mathbb{Z}^{*}_{12} = \{\overline{1}, \overline{5}, \overline{7}, \overline{11} \}

In fact, Zm\mathbb{Z}^{*}_m is a group with respect to modular multiplication -- the operation is associative, 1\overline{1} is a neutral element, and every unit has an inverse. For instance, in Z8\mathbb{Z}^{*}_{8} every element is its own inverse: 11=1, since 111(mod8),33=1, since 3391(mod8),55=1, since 55251(mod8),77=1, since 77491(mod8),\overline{1} \cdot \overline{1} = \overline{1}, \text { since } 1 \cdot 1 \equiv 1 \pmod{8},\\ \overline{3} \cdot \overline{3} = \overline{1}, \text { since } 3 \cdot 3 \equiv 9 \equiv 1 \pmod{8},\\ \overline{5} \cdot \overline{5} = \overline{1}, \text { since } 5 \cdot 5 \equiv 25 \equiv 1 \pmod{8},\\ \overline{7} \cdot \overline{7} = \overline{1}, \text { since } 7 \cdot 7 \equiv 49 \equiv 1 \pmod{8},\\But this is not a property shared by all groups of units -- you can check that in Z9\mathbb{Z}^{*}_{9},

25=1, since 25101(mod9)\overline{2} \cdot \overline{5} = \overline{1}, \text{ since } 2 \cdot 5 \equiv 10 \equiv 1 \pmod{9}

The group of units modulo a prime

How many elements are there in the group of units Zm\mathbb{Z}^{*}_m? Of course, the answer depends on mm. There is a special name and notation for this dependency.

Definition. Euler's phi function (also sometimes known as Euler's totient function) is defined as

ϕ(m)=Zm\phi(m) = \vert \mathbb{Z}^{*}_{m}\vertThat is, ϕ(m)\phi(m) is the number of units modulo mm (or, equivalently, the number of integers in the range {0,1,m1}\{0, 1, \ldots m − 1\} relatively prime to mm).

There exists a simple general formula for ϕ(m)\phi(m) , but for now, we'll only say that

ϕ(p)=p1 for any prime p\phi(p) = p - 1 \text{ for any prime } pIndeed, every integer in the range {0,1,p1}\{0, 1, \ldots p − 1\}, except zero, is relatively prime to pp:

Zp={1,,p1}\mathbb{Z}^{*}_{p} = \{\overline{1},\ldots, \overline{p - 1}\}But in fact, Zp\mathbb{Z}^{*}_{p} possesses another more interesting property. It is not only a group but a cyclic group.

Definition. A group (G,)(G, \cdot) is called cyclic if there exists an element gGg \in G such that every element hGh \in G is a power of gg:

h=gx for some integer xh = g^{x} \text{ for some integer } xThe element gg is called a generator of the cyclic group.

It turns out that for any pp, the group Zp\mathbb{Z}^{*}_{p} possesses a generator. Let's look at Z11\mathbb{Z}^{*}_{11}, for example. The residue 2\overline{2} will be a generator, since

20=1,21=2,22=4,23=8,24=5,25=10,26=9,27=7,28=3,29=6\overline{2}^{0} = \overline{1}, \quad \overline{2}^{1} = \overline{2}, \\ \overline{2}^{2} = \overline{4}, \quad \overline{2}^{3} = \overline{8}, \\ \overline{2}^{4} = \overline{5}, \quad \overline{2}^{5} = \overline{10}, \\ \overline{2}^{6} = \overline{9}, \quad \overline{2}^{7} = \overline{7},\\ \overline{2}^{8} = \overline{3}, \quad \overline{2}^{9} = \overline{6}Computing the powers of 2\overline{2}, we obtain each of the 10 elements of Z11\mathbb{Z}^{*}_{11}.

Note that such a generator isn't necessarily unique -- for instance, 6\overline{6} is also a generator in Z11\mathbb{Z}^{*}_{11}.

Generators in Zp\mathbb{Z}^{*}_{p} also have a special name -- they are called primitive roots modulo pp. 2\overline{2} and 6\overline{6} are primitive roots modulo 11. If you know some programming language or just have enough patience, you can try to find all primitive roots modulo 11 (or modulo some larger prime).

Conclusion

In this topic, we went through the basics of Modular arithmetics, here are some of the main points:

  • Modular arithmetic operations on the set Zm\mathbb{Z}_m are addition and multiplication but of residues modulo mm.
  • We showed that the set Zm\mathbb{Z}^{*}_m of invertible residues (units modulo mm), is a group with respect to modular multiplication that consists of only those elements of Zm\mathbb{Z}_m that are prime relative to mm.
  • We noted that (Zp,)(\mathbb{Z}^{*}_p, \cdot) is a cyclic group containing p1p-1 elements. Such that h=gxh = g^{x} where gg is called a generator of the cyclic group and we can obtain all elements of the group by only changing the power xx.
How did you like the theory?
Report a typo