Assume we have two polynomials $$X^5 - 10X + 12 \qquad \text{and} \qquad X^2 + 2X$$ in $(\mathbb{Z}/n\mathbb{Z})[X]$ for some $n > 1$. I am a bit unsure how to perform the polynomial division $$(X^5 - 10X + 12):(X^2 + 2X)$$ but as far as I can tell, we can perform this in $\mathbb{Z}[X]$ and then consider the result in $(\mathbb{Z}/n\mathbb{Z})[X]$. Why exactly is this legitimate?
Performing polynomial division in $(\mathbb{Z}/n\mathbb{Z})[X]$
2 Answers
That's because the usual modulo map
$$F:\mathbb{Z}\to(\mathbb{Z}/n\mathbb{Z})$$ $$F(x)=x + n\mathbb{Z}$$ is a ring homomorphism that extends to a homomoprhism between ring of polynomials:
$$\overline{F}:\mathbb{Z}[X]\to(\mathbb{Z}/n\mathbb{Z})[X]$$ $$\overline{F}(a_nX^n + \cdots + a_0)=F(a_n)X^n + \cdots + F(a_0)$$
So if you have $W = U\cdot V$ for some polynomials over $\mathbb{Z}$, then $\overline{F}(W)=\overline{F}(U)\cdot \overline{F}(V)$.
The key insight is that both those maps are epimorphisms. Now if you can find a preimage of both your polynomials (which are over $\mathbb{Z}/n\mathbb{Z}$) as a polynomials over $\mathbb{Z}$ then you are good to go. You just need to do polynomial division and apply modulo map again. But that preimage is trivial: it's just the same polynomials treated as $\mathbb{Z}$ polynomials.
That is because there's a canonical isomorphism $$\mathbf Z[X]/n\mathbf Z[X]\simeq(\mathbf Z/n\mathbf Z)[X]$$ and because you divide by a monic polynomial (otherwise, there might be artifacts due to division by $0$).