By Q. Zhang KS

1. Introduction

Euler’s totient function, denoted by ϕ(n)\phi(n), is a fundamental arithmetic function in number theory initially conceived by Euler in his investigations concerning modular arithmetic and power residues modulo composite integers. The function was introduced in 1763 as part of a generalisation of Fermat’s Little Theorem, now known as the Euler–Fermat Theorem.

Previously, Pierre de Fermat had established that ap−1≡1(modp)a^{p-1}\equiv 1\pmod p for any prime p∤ap \nmid a such that gcd⁡(a,p)=1\gcd(a, p) = 1. Euler sought to extend this property to composite moduli. This inquiry motivated the development of the totient function ϕ(n)\phi(n), which maps a positive integer nn to the number of integers from 1,2,...,n1, 2, … , n that are coprime to nn.

Definition 1.1. The totient function ϕ:ℤ+→ℤ+\phi:\mathbb{Z}^+\to\mathbb{Z}^+ is defined as the cardinality of the set of integers up to nn that are coprime to nn:

ϕ(n)=|{k∈ℤ+:1≤k≤n, gcd⁡(k,n)=1}|\phi(n)=\left|\{k\in\mathbb{Z}^+ : 1\leq k\leq n,\ \gcd(k,n)=1\}\right|

2. Properties of ϕ\phi

Definition 2.1. An arithmetic function f:ℤ+→ℂf : \mathbb{Z}^+ \to \mathbb{C} is termed multiplicative if f(mn)=f(m)f(n)f(mn) = f(m)f(n) given that gcd⁡(m,n)=1\gcd(m, n) = 1. It is termed completely multiplicative if this condition holds for all m,n∈ℤ+m, n \in \mathbb{Z}^+ without the restriction of coprimality. Euler’s totient function ϕ\phi is multiplicative, however it is not completely multiplicative.

2.1 Multiplicativity of ϕ\phi

Theorem 2.1. If mm and nn are coprime positive integers, then ϕ(mn)=ϕ(m)ϕ(n)\phi(mn)=\phi(m)\phi(n).

Proof. Let a1,…,aϕ(m)a_1, \dots, a_{\phi(m)} and b1,…,bϕ(n)b_1, \dots, b_{\phi(n)} be the elements of SmS_m and SnS_n respectively. We claim that each element of SmnS_{mn} is made from one unique pair (aj,bk)(a_j, b_k) and hence their number ϕ(mn)=ϕ(m)ϕ(n)\phi(mn) = \phi(m)\phi(n).

Initially we are given a pair (aj,bk)(a_j, b_k) so we can create a solution ejke_{jk} of the simultaneous congruences x≡aj(modm)x \equiv a_j \pmod m and x≡bk(modn)x \equiv b_k \pmod n, by the Chinese Remainder Theorem. We may express this as ejk=ajcjn+bkdkme_{jk} = a_j c_j n + b_k d_k m, containing two terms where the first term has aj,cja_j, c_j and nn, which are all coprime to mm and the second term has bk,dkb_k, d_k and mm, which are all also coprime to nn. Thus it follows that ejke_{jk} is coprime to mnmn. We may now reduce ejk(modmn)e_{jk} \pmod{mn} so that it lies within the range 11 to mn−1mn – 1 and thus belongs to SmnS_{mn}. It is also clear that if jj or kk is altered we must also get an altered ejke_{jk}.

Moreover, given an element ele_l belonging to SmnS_{mn}, we are able to reduce it(modn)\pmod n to give an element aja_j, and since ele_l is coprime to mnmn it must be that aja_j is coprime to mm and therefore must belong to SmS_m. Similarly we can reduce el(modn)e_l \pmod n to give an element bkb_k which belongs to SnS_n.

If two elements es,ete_s, e_t result in the same pair (aj,bk)(a_j, b_k), then es≡et(modm)e_s \equiv e_t \pmod m and es≡et(modn)e_s \equiv e_t \pmod n, and since gcd(m,n)=1gcd(m,n)=1 we obtain es≡et(modmn)e_s \equiv e_t \pmod{mn}. Thus we have established a bijection between Sm×SnS_m \times S_n and SmnS_{mn}, completing our proof. □\square

2.2 Totient Function of Prime Powers

Theorem 2.2. Let pp be a prime and kk a positive integer. Then

ϕ(pk)=pk−pk−1.\phi(p^k)=p^k-p^{k-1}.

Proof. The totient ϕ(pk)\phi(p^k) counts the number of integers xx given that 1≤x≤pk1 \leq x \leq p^k and gcd(x,pk)=1gcd(x, p^k) = 1. The only prime factor of pkp^k is pp, therefore we must have p|xp \mid x for any xx which does not satisfy the given conditions. The only integers between 11 and pkp^k inclusive that are divisible by pp are the multiples of pp:

1⋅p, 2⋅p, 3⋅p, …, pk−1⋅p=pk.1\cdot p,\ 2\cdot p,\ 3\cdot p,\ \dots,\ p^{k-1}\cdot p = p^k.

Upon factoring out the pp term, these correspond to the choices of coefficients from the set {1,2,…,pk−1}\{1, 2, \dots, p^{k-1}\}, so there are exactly pk−1p^{k-1} such elements that do not satisfy the conditions of the totient function. To calculate the number of integers coprime to pkp^k, we simply subtract the count of multiples of pp from the total number of integers in the interval:

ϕ(pk)=pk−pk−1\phi(p^k)=p^k-p^{k-1}

and we are done. □\square

2.3 The Product Formula for ϕ(n)\phi(n)

Theorem 2.3. For any integer n>1n > 1 with prime factorization n=∏i=1rpikin=\prod_{i=1}^{r}p_i^{k_i},

ϕ(n)=n∏p|n(1−1p).\phi(n)=n\prod_{p\mid n}\left(1-\frac{1}{p}\right).

Proof. We are able to prove this product formula by mathematical induction on the number of distinct prime factors rr of nn.

Base Case (r=1r = 1): If n=p1k1n = p_1^{k_1} for some prime p1p_1, then by Theorem 2.2, we have ϕ(p1k1)=p1k1(1−1p1)\phi(p_1^{k_1}) = p_1^{k_1}(1 – \frac{1}{p_1}), which satisfies the formula given when the product is tested with the single prime divisor p1p_1.

Inductive Step: Assume the formula holds for any integer having r−1r-1 distinct prime factors. Let nn have a prime factorisation of p1k1p2k2⋯prkrp_1^{k_1} p_2^{k_2} \cdots p_r^{k_r}. We can express nn as m⋅prkrm \cdot p_r^{k_r}, where m=∏i=1r−1pikim = \prod_{i=1}^{r-1} p_i^{k_i} possesses r−1r-1 distinct prime factors and satisfies gcd⁡(m,prkr)=1\gcd(m, p_r^{k_r}) = 1.

Since ϕ\phi is a multiplicative function (Theorem 2.1), we can factor the totient as:

ϕ(n)=ϕ(m)ϕ(prkr).\phi(n)=\phi(m)\phi(p_r^{k_r}).

Applying the inductive hypothesis to ϕ(m)\phi(m) and Theorem 2.2 to ϕ(prkr)\phi(p_r^{k_r}), we obtain

ϕ(n)=(m∏i=1r−1(1−1pi))(prkr(1−1pr)).\phi(n) = \left( m \prod_{i=1}^{r-1}\left(1-\frac{1}{p_i}\right) \right) \left( p_r^{k_r}\left(1-\frac{1}{p_r}\right) \right).

Grouping the scalar terms mprkr=nm p_r^{k_r} = n and combining the other products yields

ϕ(n)=(mprkr)∏i=1r(1−1pi)=n∏p|n(1−1p).\phi(n) = (m p_r^{k_r}) \prod_{i=1}^{r}\left(1-\frac{1}{p_i}\right) = n\prod_{p\mid n}\left(1-\frac{1}{p}\right).

Thus by induction, the formula holds for all integers n>1n > 1. □\square

3. The Euler–Fermat Theorem

The most well-known application of Euler’s totient function in number theory and applied cryptography is the Euler–Fermat Theorem, often also referred to as Euler’s Theorem, which provides a generalisation of Fermat’s Little Theorem, the proof of which we give below.

Theorem 3.1. (Euler–Fermat)If mm is a positive integer and aa is an integer such that gcd⁡(a,m)=1\gcd(a,m)=1, then

aϕ(m)≡1(modm).a^{\phi(m)}\equiv 1\pmod m.

Proof. Let R={r1,r2,…,rϕ(m)}R=\{r_1,r_2,\dots,r_{\phi(m)}\} be the distinct residues (mod mm) which are coprime to mm and aa is any element of this set. This is known as a reduced residue system modulo nn. By our definition, we have that each rir_i is coprime to nn, so that no two elements are congruent modulo nn, and thus the total number of elements in RR is exactly ϕ(m)\phi(m).

Now consider the set of residue classes formed by multiplying each element of RR by aa:

S={ar1,ar2,…,arϕ(m)}(modm).S=\{ar_1,ar_2,\dots,ar_{\phi(m)}\}\pmod m.

We claim that SS is also a reduced residue system modulo mm by verifying two properties:

  1. Coprimality: Since gcd⁡(a,m)=1\gcd(a,m)=1 and gcd⁡(ri,m)=1\gcd(r_i,m)=1 for each ii, we have that gcd⁡(ari,m)=1\gcd(ar_i,m)=1. Thus it follows that each element in SS must be coprime to mm.
  2. Distinctness modulo mm: Suppose for the sake of contradiction that ari≡arj(modm)ar_i\equiv ar_j\pmod m for some i≠ji \neq j, then a(ri−rj)≡0(modm)a(r_i – r_j)\equiv 0\pmod m. Since gcd⁡(a,n)=1\gcd(a,n)=1, we obtain ri≡rj(modm)r_i\equiv r_j\pmod m. Now each rir_i lies between 1 and (m−1)(m-1) inclusive, hence ri=rjr_i = r_j. As the residues are distinct, this forces i=ji=j. Contradiction establishes the result.

Consequently, SS also consists of ϕ(m)\phi(m) distinct residue classes, each of which is coprime to mm, thus it is a permutation of the residues in RR modulo mm. Then we may evaluate the product of the elements in SS and RR congruent modulo mm as follows:

∏i=1ϕ(m)(ari)≡∏i=1ϕ(m)ri(modm).\prod_{i=1}^{\phi(m)}(ar_i)\equiv \prod_{i=1}^{\phi(m)}r_i\pmod m.

Factoring out aϕ(m)a^{\phi(m)} from the left-hand side produces

aϕ(m)(∏i=1ϕ(m)ri)≡∏i=1ϕ(m)ri(modm).a^{\phi(m)}\left(\prod_{i=1}^{\phi(m)}r_i\right) \equiv \prod_{i=1}^{\phi(m)}r_i\pmod m.

Let P=∏i=1ϕ(m)riP=\prod_{i=1}^{\phi(m)}r_i. It is true that each rir_i is coprime to mm, thus their product PP must also be coprime to mm. Therefore, there exists some multiplicative inverse for PP modulo mm, and multiplying both sides by this inverse, we may cancel out the term PP and yield

aϕ(m)≡1(modm).a^{\phi(m)}\equiv 1\pmod m.

□\square

4. Cryptographic Applications

The totient function forms a key part of the RSA cryptosystem, which uses a public key to encrypt messages and a private key to decrypt them. While anyone is able to use the public key to encrypt a message, a message can only be decrypted when an individual is given access to the private key.

The RSA private key refers to a pair of numbers (d,n)(d, n) where nn is the publicly available modulus and dd denotes the private exponent which allows a person to unlock the message mm from the ciphertext cc:

m≡cd(modn)m \equiv c^d \pmod n

and a key equation connects the public component ee and the private key dd:

ed≡1(modϕ(n))ed \equiv 1 \pmod{\phi(n)}

Herein lies the vulnerability associated with ϕ(n)\phi(n), that is if an adversary were to gain access to it, they could use the Extended Euclidean Algorithm to compute the modular inverse of ee modulo ϕ(n)\phi(n), thereby finding the private exponent dd instantly. More significantly, knowing ϕ(n)\phi(n) bypasses the intractability of the system upon which RSA’s security depends: while multiplying two very large distinct primes pp and qq to yield nn is trivial, reversing the process to recover the prime factors pp and qq from only nn is believed to be infeasible for modern computers given sufficiently large pp and qq. Knowledge of ϕ(n)\phi(n) and its multiplicative properties reduces the issue to elementary algebra as

ϕ(n)=(p−1)(q−1)=n−(p+q)+1\phi(n) = (p – 1)(q – 1) = n – (p + q) + 1

Thus an attacker may simply rearrange to find the sum of the two primes:

p+q=n−ϕ(n)+1p + q = n – \phi(n) + 1

and the product n=pqn=pq and the sum p+qp+q of the two secret primes satisfy the following quadratic equation:

x2−(p+q)x+n=0x^2 – (p + q)x + n = 0

which can instantly yield pp and qq.

Therefore ϕ(n)\phi(n) is the fundamental architectural tool required to formulate the key during the setup and its preservation is essential to the integrity of a secure system.

5. Conclusion and Discussion

From its origins in modular residue classes and the proof of Euler–Fermat, Euler’s totient function ϕ(n)\phi(n) acts as a bridge between elements of elementary number theory, abstract algebra and modern applied cryptography. However, the cryptographic significance of ϕ(n)\phi(n) remains only a small facet of its overall theoretical importance, with it being a key domain for mathematical inquiry in many other fields.

These include the algebraic generalisation of counting coprime residue classes beyond the ring of integers ℤ\mathbb{Z} to general Dedekind domains and algebraic number fields as well as the analytic behaviour of ϕ(n)\phi(n) within analytic number theory. The study of its average order reveals elegant asymptotic density properties, as in:

∑n≤xϕ(n)=3π2x2+O(xlog⁡x)\sum_{n \le x} \phi(n) = \frac{3}{\pi^2} x^2 + O(x \log x)

Its broader behaviour directly links to the distribution of primes and longlasting open questions in number theory such as Lehmer’s Totient Problem and Carmichael’s Totient Conjecture. Ultimately, ϕ(n)\phi(n), though simple in its initial combinatorial definition, serves as a magical unifying thread across many fields of pure and applied mathematics.

References

Apostol, Tom M. Introduction to Analytic Number Theory. Undergraduate Texts in Mathematics, Springer-Verlag, 1976. https://doi.org/10.1007/978-1-4757-5579-4.

Hardy, G. H., and E. M. Wright. An Introduction to the Theory of Numbers. Revised by D. R. Heath-Brown and J. H. Silverman, 6th ed., Oxford University Press, 2008. https://india.oup.com/product/an-introduction-to-the-theory-of-numbers-sixth-edition-9780199219865.

Ireland, Kenneth, and Michael Rosen. A Classical Introduction to Modern Number Theory. 2nd ed., Graduate Texts in Mathematics, vol. 84, Springer-Verlag, 1990. https://doi.org/10.1007/978-1-4757-2103-4.

Niven, Ivan, Herbert S. Zuckerman, and Hugh L. Montgomery. An Introduction to the Theory of Numbers. 5th ed., John Wiley & Sons, 1991. https://catalog.hathitrust.org/Record/002430432.

Rivest, Ronald L., Adi Shamir, and Leonard Adleman. “A Method for Obtaining Digital Signatures and Public-Key Cryptosystems.” Communications of the ACM, vol. 21, no. 2, 1978, pp. 120–126. https://doi.org/10.1145/359340.359342.

Cover image: portrait of Leonhard Euler by Jakob Emanuel Handmann (1753), public domain, via Wikimedia Commons.


Leave a Reply

Trending