Euler's Totient Function




One of the most important function in number theory is the Euler's function ϕ(n), which gives the number of congruence classes [a]Zn which have an inverse under multiplication.

Fermat's Little Theorem states  that if p is prime then ap11(modp) for all integers a0(modp). We would like a similar result for composite moduli, but if we simply replace p with a composite integer n, then the resulting congruence an11(modn) is not generally true: if gcd(a,n)=d>1 then any positive power of a is divisible by d, so it cannot be congruent to 1(modn). This suggests that we should restrict attention to those integers a coprime to n, but even then the congruence can fail: if n=4 and a=3 then a41=33=271(mod4), for example. We need a different exponent e(n) such that ae(n)1(modn) for all a coprime to n. The simplest function with this property turns out to be Euler's  function ϕ(n).

Units
A multiplicative inverse for a class [a]Zn, is a class [b]Zn, such that [e][b]=[1]. A class [a]Zn, is a unit if it has a multiplicative inverse in Zn.(In this case, we sometimes say that the integer a is a unit (modn), meaning that ab1(modn) for some integer b.

Lemma: [a] is a unit in Zn, if and only if gcd(a,n)=1.

Proof: If [a] is a unit then ab=1+qn for some integers b and q; any common factor of  a and n would therefore divide 1, so gcd(a,n)=1. Conversely, if gcd(a,n)=1 then 1=au+nv for some u and v , so [u] is a multiplicative inverse of [a] in (modn)

Example:
We let Un, denote the set of units in Zn, Thus U8={[1],[3],[5],[7]} and U9={[1],[2],[4],[5],[7],[8]}

Theorem:For each integer n>1, the set Un, forms a group under multiplication (modn), with identity element [1].

Euler's Function
We define ϕ(n)=|Un|, the number of units in Zn; by the above Lemma  this is the number of integers a=1,2,,n such that gcd(a,n)=1. This function ϕ is called Euler's function(Euler's totient function).

For small n, its values are as follows:
n=1,2,3,4,5,6,7,8,9,10,11,12,
ϕ(n)=1,1,2,2,4,2,6,4,6,4,10,4,

We define a subset R of Z to be a reduced set of residues (modn) if it contains one element from each of the ϕ(n) congruence classes in Un; For instance, {1,3,5,7} and {±1,±3} are both reduced sets of residues (mod8).

In 1760. Euler proved the following generalisation of Fermat's Little Theorem, often called Euler's Theorem.

Theorem:

If gcd(a,n)=1 then aϕ(n)=1(modn).

Proof: 
The above Equation is true if n is prime, because in that case,ϕ(n)=n1 and Fermat’s theorem holds. However, it also holds for any integer n. Recall that ϕ(n) is the number of positive integers less than n that are relatively prime to n .Consider the set of such integers, labeled as

R={x1,x2,,xϕ(n)}
That is, each element  xi of R is a unique positive integer less than n with gcd(xi,n)=1.Now multiply each element by a modulo n:
S={ax1(modn),ax2(modn),,axϕ(n)(modn)}

The set S is a permutation of  R, by the following line of reasoning:
1. Because a is relatively prime to n and xi is relatively prime to n , axi must also be relatively prime to n. Thus, all the members of S are integers that are less than n and that are relatively prime to n.
2.There are no duplicates in S.If axi(modn)=axj(modn), then xi=xj

Note:Fermat's little theorem is a special case of this result.if n is a prime p, then the units in Zp are the classes [1],[2],,[p1], so ϕ(p)=p1 and hence ap11(modp)

Example: Lets consider n=12,U12={1,5,7,11} and ϕ(12)=4.
141(mod12)
541(mod12)
74(5)41(mod12)
114(1)41(mod12)

So a41(mod12) for each a coprime to 12.

We aim now to find a general formula for ϕ(n). We have just seen that ϕ(p)=p1 for all primes p, and a simple extension of this deals with the case where n is a prime-power:

Lemma 

If n=pe  where p is prime, then
Example:
ϕ(8)=ϕ(23)=8(11/2)=4
The set U8={1,3,5,7}

Theorem:
 If m and n are coprime ϕ(mn)=ϕ(m).ϕ(n)

Proof:
To see that ϕ(n)=ϕ(p)×ϕ(q), consider that the set of positive integers less than n is the set [1,2,,(pq1)]. The integers in this set that are not relatively prime to n are the set 

{p,2p,,(q1)p} and the set {q,2q,,(p1)q}. Accordingly
ϕ(n)=(pq1)[(q1)+(p1)]
ϕ(n)=pqpq+1
ϕ(n)=(p1)×(q1)
ϕ(n)=ϕ(p)×ϕ(q)

An alternate Proof


Example:
ϕ(12)=ϕ(4)ϕ(3)=22=4
The set U12={1,5,7,11}

Corollary



Example:
ϕ(60)=ϕ(22×3×5)=ϕ(22).ϕ(3).ϕ(5)=4.(11/2).2.4=16
ϕ(60)=60(11/2)(11/3)(11/5)=(6024)/(235)=16
The units  U60={1,7,11,13,17,19,23,29,31,37,41,43,47,49,53,59}

Theorem (Euler's Phi Function Summation Formula). 
Let d1,d2,,dr be the divisors of n. Then 
ϕ(d1)+ϕ(d2)++ϕ(dr)=n

Example:
we take all the divisors of n, apply Euler's phi function to each divisor, add the values of Euler's phi function and see what we get.
We start with an example, say n=15. The divisors of 15 are 1, 3, 5, and 15.
We first evaluate Euler's phi function at the numbers 1, 3, 5, and 15,
ϕ(1)=1,ϕ(3)=2,ϕ(5)=4,ϕ(15)=8.
Next we add the values to get
ϕ(1)+ϕ(3)+ϕ(5)+ϕ(15)=1+2+4+8=15.

Euler's Totient Function has following properties
1.ϕ(mn)=ϕ(m).ϕ(n),ifgcd(m,n)=1
2.ϕ(pe)=pepe1 for prime p and e1
3.a|b implies ϕ(a)|ϕ(b)
4.ϕ(n) is even for n3.More over if n has r distinct odd prime factors , then 2r|ϕ(n)

Application of Euler's Function

We can make use of Euler's Theorem aϕ(n)1 to simplify congruences (modn) when n is composite.Euler's Theorem is useful in solving large power congruences because it reduces the computation of large powers modulo n to powers modulo ϕ(n), which can be significantly smaller than n, if n has many prime factors. This makes it more efficient to compute and work with.

Example:

Let's demonstrate Euler's Theorem with an example.
Suppose we want to compute 7100(mod15)

First, we need to compute ϕ(15), which is the number of integers coprime to 15.

Since 15 can be factored into 3×5 and both 3 and 5 are primes, ϕ(15)=ϕ(3)×ϕ(5)=(31)×(51)=2×4=8.

Now, applying Euler's Theorem, we have:
7ϕ(15)781(mod15)
So, 7100 is congruent to 78×12+4(mod15).

7100(78)12×74112×741×24011×11(mod15)

Thus, 71001mod15

Euler's Theorem allows us to efficiently compute the congruence of large powers, reducing the computation modulo ϕ(n) rather than n.

Example:
Find the last two digits of 31492 using Euler's theorem.
Here we need to compute 31492(mod100)

First, we need to find ϕ(100), which is the count of positive integers less than 100 that are coprime to 100.
 so ϕ(100)=100(11/2)(11/5)=(100.1.4)/(2.5)=40.

Now, according to Euler's theorem, if a and n are coprime, then aϕ(n)1(modn)

Therefore, 3401(mod100)

Next, we'll reduce the exponent 1492
149212(mod40)
So, we have:

1492=40×37+12

31492=(340)37×312

=137×312(mod100)

=312(mod100)

Now, we can directly compute 312

312=531441

Taking only the last two digits, we get 41.

Therefore, the last two digits of 31492 are 41.

Example Python code for finding  Euler's Phi function
from math import gcd

def phi(n):
   relprime = 0        
    for k in range(1, n + 1):
        if gcd(n, k) == 1:
            relprime+= 1
    return relprime
print(phi(60))
output:
16

# import totient() method from sympy 
from sympy.ntheory import totient 

n = 24

# Use totient() method 
totient_n = totient(n) 
print("phi({}) = {} ".format(n, totient_n)) # 1 5 7 11 13 17 19 23 

Output:
phi(24)=8

Comments

Popular posts from this blog

Number Theory CST 292 KTU IV Semester Honors Course Notes Dr Binu V P 9847390760

Sum of Squares

Well Ordering Principle