For the other case, assume that gcd(x,n)=1. Since n=pq and x<n, we know x is a multiple of p or a multiple of q, but not both. We will describe the first possibility only, since the second is entirely similar. There is then an integer r, with r<q and x=rp. Note that we have gcd(x,q)=1 and that m=ϕ(n)=(p−1)(q−1)=ϕ(p)ϕ(q). Then, using Theorem 6.18, but now mod q,
xkm=xkϕ(p)ϕ(q)=(xϕ(q))kϕ(p)=(1)kϕ(p)=1modq.
So there is an integer t such that xkm=1+tq. Thus, Alice also recovers the message in this case,
yD=xkm+1=xkmx=(1+tq)x=x+tq(rp)=x+trn=xmodn.