# Modular arithmetic with polynomial

Given n=pq, where p and q are primes, P(x) is polynomial and z∈Zn.

I need to prove that: P(z) ≡ 0 mod n iff P(z mod p) ≡ 0 mod p AND P(z mod q) ≡ 0 mod q.

If i could prove the more general case: P(z) mod n ≡ P(z mod p) mod p (q is the same) then i could also prove what i need of course. from my understanding so far, the above is true, but i can't figure out a way to prove this.

Back to the original question, i tried to see why the fact that p divides P(z mod p) and q divides P(z mod q) implies that pq divides P(z) and vice versa, but i didn't have much success with this.

A hint is sufficient. thank you!

• I guess $p$ and $q$ are different primes? – benh Dec 31 '13 at 15:01

Hints:

1. Chinese remainder theorem, to go from $p,q$ to $n$.

2. Expand the polynomial $P$, to see that $P(z \mod m)\equiv P(z)\pmod{m}$.

First, generally $\rm\,\ p,q\mid n\iff {\rm lcm}(pq)\mid n.\,$ But $\rm\ {\rm lcm}(p,q) = pq\,$ when $\rm\,p,q\,$ are coprime.

Second $\rm\,\ p\mid P(n)\iff p\mid P(n\ {\rm mod}\ p)\$ holds true because $\rm\ {\rm\ mod}\ p\!:\ A\equiv a\ \Rightarrow\ P(A)\equiv P(a),\,$ for any polynomial $\rm\,P\,$ with integer coefficients. This is true because polynomials are composed of Sums and Products, and these operations respect congruences, i.e. the rules below hold true

Congruence Sum Rule $\rm\qquad\quad A\equiv a,\quad B\equiv b\ \Rightarrow\ \color{#0a0}{A+B\,\equiv\, a+b}\ \ \ (mod\ m)$

Proof $\rm\ \ m\: |\: A\!-\!a,\ B\!-\!b\ \Rightarrow\ m\ |\ (A\!-\!a) + (B\!-\!b)\ =\ \color{#0a0}{A+B - (a+b)}$

Congruence Product Rule $\rm\quad\ A\equiv a,\ \ and \ \ B\equiv b\ \Rightarrow\ \color{#c00}{AB\equiv ab}\ \ \ (mod\ m)$

Proof $\rm\ \ m\: |\: A\!-\!a,\ B\!-\!b\ \Rightarrow\ m\ |\ (A\!-\!a)\ B + a\ (B\!-\!b)\ =\ \color{#c00}{AB - ab}$

Beware that such rules need not hold true for other operations, e.g. the exponential analog of above $\rm A^B\equiv a^b$ is not generally true (unless $\rm B = b,\,$ so it follows by applying $\,\rm b\,$ times the Product Rule).

• thank you, i understood this from the answer of vadim123 as he mentioned chinese remainder theorem. but your answer is still helpful and appreciated. – flyman Dec 31 '13 at 16:25
• @flyman It's is quite overkill to invoke CRT to deduce the first line of my answer. It is much better, conceptually (and computationally) to be familiar with properties of lcm and gcds. Ditto for the conceptual foundations of the second part. It is essential to comprehend these fundamental ideas if you wish to master elementary number theory. – Bill Dubuque Dec 31 '13 at 16:36
• I am familiar with these ideas, just had difficulty solving this problem. i didn't use CRT, it just helped think of the solution, i proved that P(z) mod n ≡ P(z mod p) mod p with the congruence sum & product rules that are used in CRT (mapping P(z) mod n to P(z mod p) mod p). thank you again! – flyman Jan 1 '14 at 9:09