logo

Roots of Congruence Equations 📂Number Theory

Roots of Congruence Equations

Algorithm 1

The solution xx to the congruence equation xkb(modm)x^{k} \equiv b \pmod{ m }, given that natural number b,k,mb,k,m satisfies gcd(b,m)=gcd(k,ϕ(m))=1\gcd (b , m) = \gcd ( k , \phi (m) ) = 1, can be calculated as follows:


Step 1.

Calculate ϕ(m)\phi (m).


Step 2.

Find u,vu, v that satisfies kuϕ(m)v=1ku - \phi (m) v =1, and obtain xkubu(modm)x^{ku} \equiv b^{u} \pmod{m} by raising both sides to the power of uu.


Step 3.

Calculate bu(modm)b^{u} \pmod{ m } using the Exponentiation by Squaring method.

Explanation

ϕ\phi is the Euler’s Totient function which has a multiplicative property, making the factorization of mm critical.

As is known, factorization has no royal road and is extremely difficult, especially when a enormously large prime number p,qp,q exists, such that if m=pqm=pq, then starting from finding x:=ϕ(m)x := \phi (m) becomes challenging. At first glance, this seems like a disadvantage, but on the contrary, this can be used to treat xx as if it were a code. Even if kk and mm are publicly known, it is extremely difficult to calculate xx without knowing the factorization of mm. Therefore, xx can be a great encryption system if only those who are eligible to know it have information on the factorization of mm. Such an encryption system is known as the RSA encryption.

This algorithm suggests that finding very large prime numbers has practical significance.

Proof

The existence of integer solution u,vu,v satisfying kuϕ(m)v=1ku - \phi (m) v =1 is guaranteed, and since ku=ϕ(m)v+1ku = \phi (m) v + 1, xkuxϕ(m)v+1(modm) x^{ku} \equiv x^{ \phi (m) v + 1 } \pmod{m}

Euler’s Totient Theorem: gcd(x,m)=1    xϕ(m)1(modm)\gcd(x,m) = 1 \implies x^{ \phi (m) } \equiv 1 \pmod{m}

Since xϕ(m)v+1x1=bu(modm)x^{ \phi (m) v + 1 } \equiv x^{ 1 } = b^{u} \pmod{m}, simply calculate bub^{u}. Although condition gcd(x,m)=1\gcd (x, m) = 1 was not satisfied, the xx obtained in this way poses no problem as a solution to the given congruence equation.

xk=(bu)k=buk=b1+ϕ(m)v=bbϕ(m)v x^{k} = \left( b^{u} \right)^{k} = b^{uk} = b^{ 1+ \phi (m ) v} = b \cdot b^{ \phi (m ) v} Since we assumed gcd(b,m)=1\gcd (b , m) = 1, the following holds: xkb(modm) x^{k} \equiv b \pmod{ m }


  1. Silverman. (2012). A Friendly Introduction to Number Theory (4th Edition): p119. ↩︎