I am doing an individual study of an abstract algebra for number theory course online. I just started, so I hope my question just note come off as too trivial. The lecture notes state that the ring of $p$-adic integers does not have a ring endomorphism.
Questions:
1. Does not the identity mapping work as a counterexample?
Then, assuming they meant: "no endomorphism except the trivial case", so the entire thing is not just a mistake:
2. I still cannot convince myself that there is no other ring endomorphism of $p$-adic integers. Could you please give me a hint how to prove it or point me to literature where such a proof is shown?
Re Question 1) Yes, the identity $id: \mathbb Z_p \rightarrow \mathbb Z_p$ is of course a ring endomorphism.
Re Question 2) To show that there is no other, assume $f: \mathbb Z_p \rightarrow \mathbb Z_p$ is any ring endomorphism. We have $f(1)=1$ hence $f(1+1)=1+1$ etc. as well as $f(-1)=-1$ etc., so that
$$(*) \qquad \qquad f(x) =x \text{ at least for all } x \in \mathbb Z.$$
We now will show it for all $x \in \mathbb Z_p$. Generally one could say that $\mathbb Z$ is dense in $\mathbb Z_p$, so it suffices to show continuity of $f$. But we'll be a bit more down to earth.
$(*)$ in particular means $f(p^n)=p^n$ and hence, by $f$ being and endomorphism (edit_corrected, thanks @KCd), $f(p^n \mathbb Z_p) \subseteq p^n\mathbb Z_p$ for all $n \in \mathbb N$. By the definition of the $p$-adic value, this implies that
$$\lvert f(x) \rvert_p \le \lvert x \rvert_p$$ for all $x \in \mathbb Z_p$, hence by $f$ being a ring endomorphism also
$$\lvert f(x)-f(y) \rvert_p \le \lvert x-y\rvert_p$$
for any $x,y \in \mathbb Z_p$, i.e. $f$ is necessarily (uniformly) continuous.
Now let $x \in \mathbb Z_p$. There exists some sequence of integers (!) $x_n \in \mathbb Z$ such that $\lim_{n \to \infty} x_n =x$. (This is the "density" argument in a nutshell.) Then
$$f(x) \stackrel{cont.}= \lim_{n \to \infty}f(x_n) \stackrel{(*)}=\lim_{n\to \infty} x_n \stackrel{def.}=x.$$
Since $x \in \mathbb Z_p$ was arbitrary, we just showed $f=id$.