On Number Theory from First Principle

Recently, I was reading Number theory explained from first principles. It’s a great article that covers many aspects of number theory that are useful in cryptography. This blog serves the purpose to additionally prove/clarify some aspects that I think could have been explained better in the original article.

Even number of generators in cyclic group with more than 2 elements

Cyclic groups, Even number of generators, pdf 11/92

Prove: Every cyclic group with more than two elements has an even number of generators.


To prove this, we first prove the following lemma.

For a cyclic group with more two elements, all of its generators are not self-inverse.

Consider a generator gg for this group. If it’s self inverse, then gg=egg = e. But, by assumption, the group has more than two elements. So, gg is not a generator, which means we have reached a contradiction.


Now, let’s consider the set SS of all generators of a cyclic group. We want to show that it has even number of elements.

Because of the lemma above, we know we can group elements in this set into pairs like (g1,g2)(g_1, g_2) where g1g_1 is the inverse of g2g_2.

  • Here, we utilize the fact that the inverse of generator is also a generator. To prove this, it suffices to show that every element in the group can be expressed as a multiple/exponent of the inverse of the generator.

Thus, the number of elements in the group is a multiple of 2, which is an even number.

Even order element in Zm+Z_m^+

Repetition table, pdf 17/92

Prove: Whenever an element has an even order (which can be the case only if mm is even), you reach m2\frac{m}{2} halfway to the identity element.


Before proving this, it’s important to identify the following lemma discussed in the text:

An element aa has an order of 2 iff a=m2a = \frac{m}{2}.

This can be proved by exhaustion: every element except m2\frac{m}{2} has an order different from 2.


Now, let’s consider an element aa with even order qq. Let’s denote b=aq2b = a^\frac{q}{2}.

Then, it’s easy to see b2=aq=eb^2 = a^q = e. Therefore, bb has an order of 2. By the lemma, b=m2b = \frac{m}{2}.

Difference between adjacent elements of the subgroup aZm+\langle a \rangle \leq Z_m^+

Subgroup cosets, Visualization of cosets, pdf 18/92

Prove: Difference between adjacent elements of the subgroup aZm+\langle a \rangle \leq Z_m^+ equals gcd(a,m).\text{gcd}(a, m).


Let’s first prove the following lemma:

The differences between every adjacent pair (a,b)a(a, b) \in \langle a \rangle are the same.

Proof by contradiction. Consider two pairs of adjacent elements (a,b)(a, b) and (c,d)(c, d) such that d+c<b+ad + -c < b + -a. Then, we can construct a new element m=a+d+cm = a + d + -c. By closure, mam \in \langle a \rangle.

By construction, m+a=d+c<b+am + -a = d + -c < b + -a. Therefore, mm, instead of bb, should be the adjacent element of aa, which results in a contradiction.


Now, let’s complete the original proof.

Since the identity element 0a0 \in \langle a \rangle, with the above lemma, it suffices to prove that the smallest positive element in a\langle a \rangle is gcd(a,m)\text{gcd}(a, m).

Note that

  • By definition, the smallest positive element in a\langle a \rangle can be written as ka+qmka + qm for some k>0,q<0k > 0, q < 0.
  • By Bézout’s identity, there exists x,yx, y such that xa+ym=gcd(a,m)xa + ym = \text{gcd}(a, m) and gcd(a,m)\text{gcd}(a, m) is the smallest positive integer that can be derived from the linear combination of a,ma, m.

So, it suffices for us to show that there exists x,yx', y' such that x>0,y<0,xa+ym=gcd(a,m)x' > 0, y' < 0, x'a + y'm = \text{gcd}(a, m).

Note that ma+(a)m=0ma + (-a)m = 0. So, there exists some natural number zz such that x=x+zm>0x' = x+zm > 0 and y=yza<0y' = y - za < 0 such that (x+zm)a+(yza)m=xa+ym+zmazam=xa+ym=gcd(a,m)(x+zm)a + (y-za)m = xa + ym + zma - zam = xa + ym = \text{gcd}(a, m).

Latin square + associativity = group

Identity row and column, Latin square + associativity = group, pdf 20/92

ABCABACBACBCCBA\begin{array}{c|ccc} \circ & A & B & C \\ \hline A & B & A & C \\ B & A & C & B \\ C & C & B & A \end{array}

A 3x3 latin square.

Prove: Associative operation with unique solutions implies that the identity element is the same for all elements. Another equivalent expression is: latin square + associative operation implies a group.

Note:

  • The proof in the article is already very good. Here, I aim at simplifying it a bit.
  • The uniqueness of solution results in a latin square is proven previously in the article.

Without loss of generality, we prove that the left identity element is the same for all elements.


Let’s first prove the following lemma:

The left identity element of each element is idempotent.

Consider a left arbitrary element DD. By definition of latin square, E,ED=D\exists E, E \cdot D = D. By applying EE on both side, we get E(ED)=EDE \cdot (E \cdot D) = E \cdot D. By associativity, E(ED)=(EE)D=ED=DE \cdot (E \cdot D) = (E \cdot E) \cdot D = E \cdot D = D. By uniqueness of the solution for XD=DX \cdot D = D, EE=EE \cdot E = E.


Now, let’s prove the left identity element of all elements is the same.

Consider a left identity element EE of DD, and another arbitrary element FF. By assumption, EX=FE \cdot X = F has a unique solution. By idempotency, it follows that EX=(EE)XE \cdot X = (E \cdot E) \cdot X. By associativity, (EE)X=E(EX)=F(E \cdot E) \cdot X = E \cdot (E \cdot X) = F. Plug in the value of EXE \cdot X, we get EF=FE \cdot F = F. So, EE is a left identity of FF.

To be continued.