State the inclusion-exclusion principle.
Let n⩾2 be an integer. Let X={0,1,2,…,n−1} and
Y={(a,b)∈X2∣gcd(a,b,n)=1}
where gcd(x1,…,xk) is the largest number dividing all of x1,…,xk. Let R be the relation on Y where (a,b)R(c,d) if ad−bc≡0(modn).
(a) Show that
∣Y∣=n2p∣n∏(1−p21)
where the product is over all primes p dividing n.
(b) Show that if gcd(a,b,n)=1 then there exist integers r,s,t with ra+sb+tn=1.
(c) Show that if (a,b)R(c,d) then there exists an integer λ with λa≡c(modn) and λb≡d(modn). [Hint: Consider λ=rc+sd, where r,s are as in part (b).] Deduce that R is an equivalence relation.
(d) What is the size of the equivalence class containing (1,1)? Show that all equivalence classes have the same size, and deduce that the number of equivalence classes is
np∣n∏(1+p1).