Homepage Solution manuals Ivan Niven An Introduction to the Theory of Numbers Exercise 4.5.7* (The probability that the sum of $k$ integers in $[\![1,n]\!]$ is divisible by $n$ is $1/n$)

Exercise 4.5.7* (The probability that the sum of $k$ integers in $[\![1,n]\!]$ is divisible by $n$ is $1/n$)

Let n and k be positive integers with n > k and ( n , k ) = 1 . Prove that if k distinct integers are selected at random from 1 , 2 , , n , the probability that their sum is divisible by n is 1 n .

Answers

I found on the net (math.stackexchange.com) the following crucial hint:

”Think of the numbers as integers modulo n . Consider the map

A = { a 1 , a 2 , , a k } { a 1 + 1 , a 2 + 1 , , a k + 1 } .

This adds k modulo n to the sum of the elements of A .”

      answered Sep 5, 2017 Angina Seng.

Proof. We suppose that 1 k < n and that k n = 1 .

Let 𝒫 k ( [ [ 1 , n ] ] ) denote the set of subsets of [ [ 1 , n ] ] with k elements, and N = | 𝒫 k ( [ [ 1 , n ] ] ) | its cardinality (then N = ( n k ) ).

Consider

k , n = { B 𝒫 k ( [ [ 1 , n ] ] ) a B a 0 ( mod n ) }

the subset of B 𝒫 k ( [ [ 1 , n ] ] ) such that the sum of elements of B is divisible by n . Then the wanted probability p is p = | k , n | N .

If

𝒜 k , n = { A 𝒫 k ( nℤ ) α A α = 0 } ,

Then | 𝒜 k , n | = | k , n | , because { 1 , 2 , , n } is a complete residue system modulo n , so the map

{ k , n 𝒜 k , n A = { a 1 , a 2 , a k } { α 1 , α 2 , , α k } = { a 1 ¯ , a 2 ¯ , , a k ¯ }

is a bijection. It remains to compute the cardinality of 𝒜 k , n .

Consider the map

t { 𝒫 k ( [ [ 1 , n ] ] ) 𝒫 k ( [ [ 1 , n ] ] ) A = { α 1 , α 2 , , α k } { α 1 + 1 , α 2 + 1 , , α k + 1 } = α A { α + 1 } .

(Here 1 = 1 ¯ nℤ .) Then t is bijective, with t 1 ( B ) = β B { β 1 } , so t i is defined for all integers i , and

t i ( { α 1 , α 2 , , α k } ) = { α 1 + i ¯ , α 2 + i ¯ , , α k + i ¯ } .

We define the relation between any two elements A = { α 1 , α 2 , , α k } , B = { β 1 , β 2 , , β k } of 𝒫 k ( [ [ 1 , n ] ] ) by

A B i , B = t i ( A ) γ nℤ , j [ [ 1 , k ] ] , β j = α j + γ .

Then is an equivalence relation: A = t 0 ( A ) A ; if A B , then B = t i ( A ) for some i , then A = t i ( B ) , so B A ; if A B and B C , then B = t i ( A ) , C = t j ( B ) for some integers i , j , then C = t i + j ( A ) , so A C .

What is the class of A = { α 1 , α 2 , , α k } for the relation (where α 1 , α 2 , , α k are distinct)? Since t n ( A ) = A , and t n + j ( A ) = t j ( A ) for all j , the class of A is

Ȧ = { A , t ( A ) , t 2 ( A ) , , t n 1 ( A ) } .

Moreover, if t i ( A ) = t j ( A ) , where 0 i j < n , then A = t j i ( A ) . Therefore

α A α = ( α A α ) + k ( j ¯ i ¯ ) ,

thus k ( j i ) 0 ( mod n ) , where k n = 1 , so j i 0 ( mod n ) (and 0 i j < n ), thus i = j .

This shows that | Ȧ | = n , so all the classes have same cardinality n , and the number of classes is N n = 1 n ( n k ) (in particular, this shows that if k n = 1 , then n ( n k ) , which is not quite obvious).

The important fact is that every class contains a unique element { γ 1 , γ 2 , , γ k } in 𝒜 k , n (such that γ 1 + γ 2 + + γ k = 0 ). Indeed, consider the class Ȧ of A = { α 1 , α 2 , , α k } 𝒫 k ( [ [ 1 , n ] ] ) , and let B = { γ 1 , γ 2 , , γ k } = { α 1 + j ¯ , α 2 + j ¯ , , α k + j ¯ } in the class Ȧ . Then

γ 1 + γ 2 + + γ k = α 1 + α 2 + + α k + k ¯ j ¯ .

Since k n = 1 , there is a unique j ¯ nℤ such that α 1 + α 2 + + α k + k ¯ j ¯ = 0 , so every class contains a unique element of 𝒜 k , n . This shows that there are as many classes than elements of 𝒜 k , n . Therefore

| 𝒜 k , n | = | 𝒫 k ( [ [ 1 , n ] ] ) | n = 1 n ( n k ) ,

so

p = | 𝒜 k , n | ( n k ) = 1 n .

if k n = 1 and if k distinct integers are selected at random from 1 , 2 , , n , the probability that their sum is divisible by n is 1 n . □

Note: In the language of group actions, the group nℤ acts on 𝒫 k ( [ [ 1 , n ] ] ) by

γ A = α A { α + γ } .

By the preceding arguments, if k n = 1 , all orbits have n elements, and every orbit contains a unique element of 𝒜 k , n , so

| 𝒜 k , n | = | 𝒫 k ( [ [ 1 , n ] ] ) | n .

User profile picture
2025-03-19 11:15
Comments