# Prove that if an integer $z$ is not divisible by $p$, then it is invertible in the $p$-adic integer ring $\mathbb{Z}_p$.

Let $p$ be a prime number. Define the $p$-adic valuation on $\mathbb{Z}$ as $v_p(p^kx) = p^{-k}$ where $x$ is not divisible by the prime $p$. Let $\mathbb{Z}_p$ (the $p$-adic integers) be a completion of $\mathbb{Z}$ under this valuation.

The problem is to prove that if an integer $z$ is not divisible by $p$, then it is invertible in the ring $\mathbb{Z}_p$.

My thoughts by now are the following:

For any such $z$ there are integers $q \neq 0$ and $-p<r < p$ such that $z = qp + r$. Then we claim existence of $p$-adic integer $a = \sum^\infty_{n=0}a_np^n$ with the properties:

1. $b_0 =\mathbf{a_0}(r + qp) + rp\mathbf{a_1} = 1$
2. $\forall k : \mathrm{even} . b_k = qa_{k-1} + \mathbf{a_k}(r + qp) + rp\mathbf{a_{k+1}} =0$

If such $a$ exists then $za = 1$ as $za = \sum^\infty_{n=0}b_{2n}p^n$.

We will try to derive coefficients of $a$ from this conditions starting from $a_0$ and $a_1$. If $r+qp$ and $rp$ are coprime then we are done. This will be true in case $\gcd(r,q) = 1$, otherwise we will have problem with solving for $a_1, a_0$ in first condition. However, if $m = gcd(r,q)$ then $m < p$ which gives us representation of form $m = p - (p-m)$ and, as $q$ in this representation is $1$, number $m$ must be divisible in $\mathbb{Z}_p$. Same holds for $m^{-1}z = m^{-1}qp +m^{-1}r$ as $\gcd(m^{-1}q,m^{-1}r) = 1$. Then we may construct $z^{-1} = m^{-1}(m^{-1}qp +m^{-1}r)^{-1}$ which completes the proof.

Is this proof correct?

Do you know better proofs of this fact?

One possible slight improvement but still in the style you propose is as follows. Since $z$ is prime to $p$, there are integers $y$ and $k$ such that $yz=1+kp$. We can invert $1+kp$ in $\mathbb Z_p$ by expanding the geometric series $${1\over 1+kp} \;=\; 1-kp+(kp)^2-(kp)^3+\ldots$$ This converges very nicely in $\mathbb Z_p$. Then $$\Big(y\cdot (1-kp+(kp)^2-\ldots)\Big) \cdot z \;=\; 1$$
Since $p$ does not divide $z$, $z$ is coprime to every $p^n$, and therefore it has an inverse $y_n$ modulo $p^n$.
If $n<m$, then $y_mz\equiv 1\pmod{p^m}$ and therefore also modulo $p^n$. Since $z$ can have only one inverse modulo $p^n$ we must have $y_m\equiv y_n\pmod{p^n}$, so the $p$-adic distance between $y_n$ and $y_m$ is at most $p^{-n}$. Thus, the sequence of $y_n$s is Cauchy and converges in $\mathbb Z_p$.
Furthermore the sequence $(y_nz-1)_n$ clearly converges to $0$, so the limit of the $y_n$s is inverse to $z$.
See Jean-Pierre Serre, A course in arithmetic, chapter II, section 2, "Properties of $Z_p$", Proposition 2, for a slightly more general result. To extend his proof to the case of $Z_p$, you just need to see that if $p$ doesn't divide an element $x=(x_n)\in Z_p$, then it doesn't divide any $x_n$ (for example, if $p$ divides $x_1$, using the morphism $\varphi_2$ you see that $p$ divides $x_2$, then $x_3$, then ...). So every $x_n$ is invertible in $Z/p^nZ$.