Idempotents in a Quotient Ring Let $R=\mathbb{Z}_p[x]/(x^p-x)$.  Show that $R$ has exactly $2^p$ elements satisfying $r^2=r$.
I know that for $f,g\in\mathbb{Z}_p[x]$, we have $f-g\in(x^p-x)$ if and only if $f(a)=g(a)$ for all $a\in\mathbb{Z}_p$.  It follows that $r^2=r\in R$ if and only if $r$ is represented by some $f\in\mathbb{Z}_p[x]$ such that $f(a)^2=f(a)$ for all $a\in\mathbb{Z}_p$.  Thus, it must follow that $f(a)=0$ or $f(a)=1$ for each $a$.
Now, for each of the $2^p$ $p$-tuples $(b_0,\ldots,b_{p-1})$ where each $b_i$ is either $0$ or $1$, does there exist a polynomial $f$ such that $f(a)=b_a$, and is this polynomial uniquely defined in $R$?
 A: Each of the $p$ elements of the field $\mathbb{Z}_p$ is a root of the polynomial $q(x) = x^p - x$.  Thus we have a factorization of $q(x)$ into $p$ distinct irreducible factors: $$q(x) = x (x-1) \cdots (x-(p-1)).$$ By the Chinese Remainder Theorem, we therefore have a ring isomorphism $$\mathbb{Z}_p[x]/(x^p - x) \cong \mathbb{Z}_p[x]/(x) \times \mathbb{Z}_p[x]/(x-1) \times \cdots \times \mathbb{Z}_p[x]/(x-(p-1)) \cong (\mathbb{Z}_p)^p.$$ 
It's now much easier to compute the number of idempotents of this ring.  I'll leave the rest of the fun to you!
A: As rohit mentions in the comments, we may use Lagrange interpolation to explicitly construct such polynomials satisfying $f(x)=b_x$ for all $x\in{\bf F}_p$ for any vector $(b_0,\cdots,b_{p-1})$ with entries $0$ or $1$.
Explicitly, the method tells us to consider the following:
$$f(x)=\sum_{\substack{\rm all~linear \\ {\rm factors}~(x-u)}}\,b_u\frac{\displaystyle\prod_{\substack{\rm all~linear~factors \\ {\rm except}~(x-u)}}(x-v)}{\displaystyle\prod_{v\ne u}(u-v)}=\sum_{u\in{\bf F}_p}b_u\frac{\displaystyle\frac{x^p-x}{x-u}~~~~~~}{\displaystyle\left.\frac{x^p-x}{x-u}\right|_{x=u}}.$$
To evaluate $f(t)$ for some $t\in{\bf F}_p$ note that $\frac{t^p-t}{t-u}=0$ for all $t\ne u$, so the only summand that has a contribution is with $u=t$, yielding $f(t)=b_t\frac{\rm blah}{\rm blah}=b_t$, exactly as desired. The denominator in the summands can be evaluated exactly symbolically (so $x=u$ can be plugged in directly) as
$$\frac{x^p-x}{x-u}=\frac{(x/u)^p-(x/u)}{(x/u)-1}=\frac{x}{u}\left[\left(\frac{x}{u}\right)^{p-2}+\cdots+\left(\frac{x}{u}\right)+1\right] \\ \implies \left.\frac{x^p-x}{x-u}\right|_{x=u}=p-1=-1.$$
We assume $x\ne0$ as that case is trivial: $(x^p-x)/x=x^{p-1}-1=-1$ at $x=0$.
Uniqueness follows from the fact that these polynomials have different images under a certain homomorphism. In particular, there is a map from ${\bf F}_p[x]$ to the space of set-theoretic maps on our space ${\bf F}_p\to{\bf F}_p$ with kernel generated by $\prod_{t\in{\bf F}_p} (x-t)=x^p-x$. These $f(x)$ polynomials (in the quotient ${\bf F}_p[x]/\ker$) correspond to functions, and since they are distinct functions they are different elements in the domain.
We may also be able to prove the $f(x)$ exist using linear algebra to create a linear system that the coefficients solve; whether or not this is more or less constructive is arguable. If
$$f(x)=a_0+a_1x+\cdots+a_{p-1}x^{p-1}+(x^p-x)$$
then we obtain
$$\begin{pmatrix} 1 & 0 & 0 & \cdots & 0 \\
1 & 1 & 1 & \cdots & 1 \\
1 & 2 & 2^2 & \cdots & 2^{p-1} \\
\vdots & \vdots & \vdots & \ddots & \ddots \\
1 & -1 & 1 & \cdots & (p-1)^{p-1} \end{pmatrix}\begin{pmatrix}a_0 \\ a_1 \\ a_2 \\ \vdots \\ a_{p-1}\end{pmatrix}=\begin{pmatrix}b_0 \\ b_1 \\ b_2 \\ \vdots \\ b_{p-1}\end{pmatrix}. $$
Thus, as long as we can show the Vandermonde determinant is nonzero mod $p$, linear algebra tells us the system has a solution and the $a_i$ may be solved for, so the $f(x)$ exists.
Both of these methods are completely overkill for the problem. Manny's answer is the smarter rather than harder route. But familiarity with linear algebra and interpolation can come in handy other places, so I thought I'd showcase them.
