Why $g(x^{p})=(g(x))^{p}$ in the reduction mod $p$?

In one of the proof in the book "Abstract Algebra'' by Dummit and Foote (Theorem 41, pg. 554) we have a monic polynomial $g(x)\in\mathbb{Z}[x]$, and the book claims that $g(x^{p})=(g(x))^{p}\mod p$

Can someone please explain why this is true ? I know that $\forall a\in\mathbb{F}_{p}:a=a^{p}$, but I don't see how this imply the equality as polynomials

-

First, note that the claim is clearly true for the polynomial $x\in\mathbb{Z}[x]$, as well as for any constant polynomial $a\in\mathbb{Z}$ (the latter is just Fermat's Little Theorem).
Now note that any element of $\mathbb{Z}[x]$ can be obtained as a combination of sums and products of the polynomial $x$ and constant polynomials.
For any $f,g\in\mathbb{Z}[x]$, we have that $$(f+g)^p=f^p+\binom{p}{1}f^{p-1}g+\cdots+\binom{p}{p-1}fg^{p-1}+g^p\equiv f^p+g^p\bmod p$$ and $(fg)^p=f^pg^p$, so we certainly have that $(fg)^p\equiv f^pg^p\bmod p$.
Thus, the claim is true for all polynomials in $\mathbb{Z}[x]$ (the condition that $g$ be monic is unnecessary).
So infact I have: $g(x^p)=(g(x))^p=g(x)$ in the reduction mod $p$, right ? – Belgi Jul 19 '12 at 4:48
No, the indeterminate $x$ is still an indeterminate; we didn't have $x^p = x$ in $\mathbb{Z}[x]$, so we won't have $\bar{x}^p=\bar{x}$ in $\mathbb{F}_p[x]$. This is a common sticking point. To give an explicit example, if $g(x)=2x+1\in\mathbb{Z}[x]$, then when considered in $\mathbb{F}_3[x]$, $$g(x)^3=(2x+1)^3=2x^3+1=g(x^3)$$ but $2x^3+1\neq 2x+1$ in $\mathbb{F}_3[x]$. – Zev Chonoles Jul 19 '12 at 4:50