<<

Lecture 14: Basic

Nitin Saxena ?

IIT Kanpur

1 Euler’s totient function φ

The case when n is not a prime is slightly more complicated. We can still do modular arithmetic with division if we only consider numbers coprime to n. For n ≥ 2, let us define the set,

∗ Zn := {k | 0 ≤ k < n, gcd(k, n) = 1} . ∗ The cardinality of this set is known as Euler’s totient function φ(n), i.e., φ(n) = |Zn|. Also, define φ(1) = 1.

Exercise 1. What are φ(5), φ(10), φ(19) ?

Exercise 2. Show that φ(n) = 1 iff n ∈ [2]. Show that φ(n) = n − 1 iff n is prime.

Clearly, for a prime p, φ(p) = p − 1. What about a prime power n = pk? There are pk−1 numbers less than n which are NOT coprime to n (Why?). This implies φ(pk) = pk − pk−1. How about a general number n? We can actually show that φ(n) is an almost multiplicative function. In the context of number theory, it means,

Theorem 1 (Multiplicative). If m and n are coprime to each other, then φ(m · n) = φ(m) · φ(n) .

∗ ∗ ∗ ∗ ∗ Proof. Define S := Zm × Zn = {(a, b): a ∈ Zm, b ∈ Zn}. We will show a bijection between Zmn and ∗ ∗ ∗ ∗ ∗ S = Zm × Zn. Then, the theorem follows from the observation that φ(mn) = |Zmn| = |S| = |Zm||Zn| = φ(m)φ(n). ∗ The bijection ψ : S → Zmn is given by the map ψ :(a, b) 7→ bm + an mod mn. We need to prove that ψ is a bijection. That amounts to proving these three things.

∗ ∗ ∗ – The mapping is valid, i.e., if a ∈ Zm and b ∈ Zn then bm + an ∈ Zmn. This follows from the fact that bm is coprime to n implies bm + an is coprime to n. Similarly bm + an is coprime to m. So bm + an is coprime to mn (and we use its residue representative in [mn − 1]). – Mapping ψ is injective (one to one). Why? If bm + an = b0m + a0n mod mn implies (b − b0)m + (a − a0)n = 0 mod mn. The latter implies, using coprimality of m, n, that n|(b − b0) and m|(a − a0). Thus, (a, b) = (a0, b0) in S. – Mapping ψ is surjective (onto). Why? ∗ −1 ∗ Consider t ∈ Zmn. Compute k := tm mod n. (Note: k ∈ Zn.) Since t = km mod n we can write 0 0 0 ∗ t = km + `n. If need be, reduce ` to ` mod m. This achieves both t = km + ` n mod mn and ` ∈ Zm. These three properties of ψ finish the proof.

Exercise 3. Find numbers m, n such that φ(mn) 6= φ(m)φ(n).

? Edited from Rajat Mittal’s notes. Fundamental theorem of arithmetic implies that we can express any number as a product of prime powers. By using Thm 1, we can calculate φ(mn), when φ(m) and φ(n) are given to us (m and n are coprime).

k1 k2 k` Theorem 2. If n = p1 p2 ··· p` is a natural number. Then,  1   1   1  φ(n) = n 1 − 1 − ··· 1 − . p1 p2 p` Exercise 4. Prove the above theorem using the argument above.

2 Inclusion-Exclusion vs. M¨obiusInversion

There is another way to look at Thm. 2. We are interested in finding out the number of elements between 0 k1 k2 k` and n−1 which do not share a factor with n = p1 p2 ··· p` . Let us consider all the elements {0, 1, ··· , n−1}. Define Ai to be the set of elements which are divisible by pi. For any I ⊆ [`], define AI to be the set of elements which are divisible by all pi where i ∈ I. You can see that we are interested in the event when none of the pi’s, where i ∈ [`], divide an element. This is a straightforward application of inclusion-exclusion,

X |I| φ(n) = (−1) · |AI | . I⊆[`] n Notice that the number of elements which are divisible by p1p2 ··· pj is just . This gives us, p1p2···pj n |AI | = Q . i∈I pi So, X n φ(n) = (−1)|I| . (1) Πi∈I pi I⊆[`] Exercise 5. Prove that the above expression is the same as the one in Thm. 2.

In Eqn. 1, the sum is taken over all square-free (i.e. of the form p1p2 ··· pi with distinct primes) of n. Define a function, µ(k),   1, if k = 1 µ(k) := 0, if a2 | k for some a ≥ 2  (−1)r, if k is square-free with r primes. This function µ(k) is called the M¨obiusfunction. Then Eqn. 1 can be rewritten as, X n φ(n) = µ(d) · . d d|n P

Exercise 6. For an n ≥ 2 show that, d|n µ(d) = 0 .

] ` [ ∈ i ] ` [ ∈ i n | d i i

i i

)=0. = )) p ( µ + (1 = )) p ( µ + · · · + ) p ( µ + ) p ( µ + (1 = ) d ( µ that deduce

Q Q P 2 i k

.Ti a eue to used be can This ). ab ( µ = ) b ( µ · ) a ( µ , b a, coprime for i.e. function, multiplicative a is ) k ( µ

M¨obiusfunction is really useful in number theory, and combinatorics. One of the main reasons is the “inversion property” (for special functions f). Theorem 3 (M¨obiusinversion). Let f and g be functions defined on natural numbers. Then, X X n f(n) = g(d) implies g(n) = µ(d)f . d d|n d|n

2 Proof. Let us look at RHS of the expression for g(n):

X n X X µ(d)f = µ(d) g(c) d d|n d|n c|n/d   X X = g(c) µ(d) c|n d|n/c = g(n)µ(1) = g(n) . P The third equality follows from the fact that d|n µ(d) is 0 for n ≥ 2 (is 1 for n = 1). The second equality is sum-swapping.

Exercise 7. Prove the second equality by considering the pairs (c, d) s.t. d | n and c | n/d.

Functions f and g are called M¨obiustransforms of each other. Eg. n and φ(n) are M¨obiustransforms of each other!

Exercise 8. Finite fields are routinely used in computer science. Read up on how to use M¨obiusinversion to count the number of irreducible polynomials, of degree d, over a finite field.

References

1. N. L. Biggs. Discrete Mathematics. Oxford University Press, 2003. 2. P. J. Cameron. Combinatorics: Topics, Techniques and Algorithms. Cambridge University Press, 1994. 3. K. H. Rosen. Discrete Mathematics and Its Applications. McGraw-Hill, 1999.

3