Ring endomorphism of $p$-adic integers 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?
 A: 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$.
A: For your reference, there is a more general perspective from the theory of "Witt vectors". Throughout, we let $p$ denote a fixed prime and $\mathbb{F}_p$ the finite field with $p$ elements.
The p-adic integers $\mathbb{Z}_p$ are an example of a strict $p$-ring, which  is a ring $A$ such that

*

*$p$ is not a zero divisor in $A$,

*$A$ is $p$-adically complete and Hausdorff, and

*$A/(p)$ is a perfect ring (for example, a finite field).

Then we have the following theorem: if $A$ and $B$ are strict $p$-rings, then there is a natural "mod $p$" bijection between  ring homomorphisms $A \to B$ and ring homomorphisms $A/(p) \to B/(p)$ (see theorem 1.2 in https://arxiv.org/abs/1409.7445, which is an expository paper on Witt vectors, and/or Chapter II of Serre's Local Fields). Taking $A = \mathbb{Z}_p = B$, we have a bijection between endomorphisms of $\mathbb{Z}_p$ and endomorphisms of $\mathbb{Z}_p/(p) =  \mathbb{F}_p$. The only ring endomorphism of $\mathbb{F}_p$ is the identity, so the same holds for $\mathbb{Z}_p$.
