TITLE: Explanation about reduced residue system theorem
QUESTION [6 upvotes]: I need an explanation of the following theorem from Leveque's Elementary Theory of Numbers (page 44):

Theorem 3-7 If $(m,n)=1$ then $\varphi(mn)=\varphi(m)\varphi(n)$

Proof: Take integers m,n with $(m,n)=1$, and consider the numbers of the form $mx+ny$. If we can so restrict the values which x and y assume that these numbers form a reduced residue system (mod mn), there must be $\varphi(mn)$ of them. But their number is also the product of the number of values which x assumes and the number of values which y assumes. Clearly, in order for $mx+ny$ to be prime to m, it is necessary that $(m,y)=1$, and likewise we must have $(n,x)=1$. Conversely, if these last two conditions are satisfied, then $(mx+ny,mn)=1$, since in this case any prime divisor of m, or of n, divides exactly one of the two terms in$ mx+ny$. Hence let x range over a reduced residue system (mod n), say $x_1,...,x_{\varphi(n)}$, and let y run over a reduced residue system (mod m), say $y_1,...,y_{\varphi(m)}$. If for some indices $i,j,k,l$ we have 
$$mx_i+ny_j \equiv mx_k + ny_l (mod\text{ } mn)$$
then 
$$m(x_i-x_k)+n(y_j-y_l)\equiv 0(mod \text{ } mn)$$
Since divisibility by mn implies divisibility by m, we have
$$m(x_i-x_k)+n(y_j-y_l) \equiv 0(mod\text{ } m)$$
$$n(y_j-y_l) \equiv 0 (mod\text{ } m)$$
$$y_j \equiv y_l(mod\text{ } m)$$
whence $j =l$. Similarly, $i=k$. Thus the numbers $mx+ny$ so formed are incongruent (mod mn). Now let a be any integer prime to mn: in particular, $(a,m)=1$ and $(a,n)=1$. Then theorem 2-6 shows that there are integers X,Y (not necessarily in the chosen reduced residue systems)) such that $mX+nY=a$, whence also $mX+nY \equiv a(mod\text{ } mn)$. Since $(m,Y)=(n,X)=1$, there is an $x_i$ such that $X\equiv x_i(mod n)$ and there is a $y_j$ such that $Y \equiv y_j(mod\text{ } m)$. This means that there are integers $k,l$ such that $X=x_i+kn$, $Y=y_j+lm$. Therefore,  
$$mX+nY=m(x_i+kn)+n(y_j+lm)\equiv mx_i+ny_j \equiv a(mod\text{ } mn)$$ 
Hence, as x and y run over fixed reduced residue systems (mod n) and (mod m), respectively, $mx+ny$ runs over a reduced residue system (mod mn), and the proof is complete.
The book was doing a very good job at explaining theorems in an easy way up to the latter. I couldn't hate that proof more. It obviates a lot of things that are hard to understand. I underlined some of things that I didn't get but there are still more. I would be glad if someone provides a simplified or better explained proof for this theorem. The first thing that I would like to understand is when they refer to x ranging over a residue system. What does that mean?. Does that mean x is congruent to some term in that specific residue system mod n?

REPLY [2 votes]: The proof works as follows. Let $\,U_m,\,U_m,\, U_{mn}$ be reduced residue systems mod $\,m,n,mn.\,$ 
We show that if $\,x\in U_n,\, y\in U_m$ then $\,mx+ny\in U_{mn}\,$ and this mapping yields a bijection $\, U_m \times U_n \cong U_{mn}.\,$ Comparing  cardinalities we get $\,\varphi(m)\varphi(n) = \varphi(mn).\,$ Note: when we write $\,z\in U_i\,$ we mean $\,z\equiv z'\,$ for some $\,z'\in U_i$
First we show that $\,mx+ny\,$ lies in $\,U_{mn},\,$ i.e. it is coprime to $\,mn.\,$ Note
$$(mx+ny,m) = (ny,m) = (y,m) = 1\ \ {\rm by}\ \ y\in U_m$$
$$(mx+ny,n) = (mx,n) = (x,n) = 1\ \ {\rm by}\ \ x\in U_n$$
Since $\,mx+ny\,$ is coprime to $\,m,n\,$ it is coprime to their lcm = product, so it is in $U_{mn}$
Next we show the map is injective, i.e. $1$-$1$. If $\ mX+nY = mx+ny\ $ then $\, m(X-x) = n(y-Y)\,$ so by $\,m,n\,$ coprime we get $\,m\mid y-Y,\,$ $n\mid X-x,\,$ so $\, X\equiv x\pmod n,\,$ $\,Y\equiv y\pmod m$
Finally we show the map is surjective (onto). Let $\,a\in U_{mn}$. By Bezout $\, mx + ny = a\,$ for some $\,x,y.\,$ So, mod $\,n\!:\ mx\equiv a,\,$ so $\,x \equiv m^{-1}a,\,$ where $\,m^{-1}$ exists by $\,(m,n)=1.\,$ Also $\,(x,n) = 1,\,$ else $\,p\mid x,n\,$ so $\,p\mid a= mx\!+\!ny,\,$ contra $\,(a,n)=1$ by $\,(a,mn)=1.\,$ Since $\,(x,n)=1\,$ we infer $\,x\,$ is congruent to some $\,x_i\in U_n.\,$  Similarly $\,y\equiv y_i \in U_m.\,$ Your final equation shows $\,mx_1+n y_1 = m(x+jn)+n(y+kn)\equiv mx+ny\equiv a\pmod{mn},\,$ so $\,(x_i,y_j)\in U_n\times U_m\,$ maps to $\,a\in U_{mn},\,$ so the map is onto.
Remark $\ $ The proof will become much clearer when you learn about the ring-theoretic view of CRT = Chinese Remainder Theorem. Then it follows simply from 
$$\Bbb Z/mn\, \cong\, \Bbb Z/m \oplus \Bbb Z/n\ \Rightarrow\ U(\Bbb Z/mn)\, \cong\, U(\Bbb Z/m) \times  U( \Bbb Z/n) $$
where $\,U(R)\,$ denotes the group of units (invertibles) of $R$.