Abstract.
In this post, we consider the quest of computing the 5-adic expansion of 1/2. We begin with introducing p-adic integers and numbers, and discussing when certain polynomials with coefficients in the integers have zeroes in the p-adic integers. This question is closely related to Hensel’s lemma, which can be proven using an algebraic version of Newton’s iteration. We use this to compute approximations of rational numbers in the p-adics, and consider which p-adic numers have an eventually periodic expansion.
Today, I want to discuss three topics:
-adic integers and numbers, Hensel’s Lemma as well as Newton iteration. Three topics which, on the first glance, seem to have nothing in common. But nonetheless, there is a tight relation between them.
The
-adic numbers.
Let us begin with the
-adic numbers. They are a non-achrimedean analogue to the real numbers, whence we want to discuss the real numbers first. There are many different constructions of the real numbers. We pick a certain one, namely construction as a completion of the rational numbers. For that, consider the archimedean distance
respectively the archimedean absolute value
Recall that a sequence
is said to be convergent with limit
if for every
, there exists some
with
for all
. Note that every convergent series is a Cauchy sequence, i.e. it satisfies
But not every Cauchy sequence in
converges. One reason to use the real numbers is to add limits of Cauchy sequences, so that every Cauchy sequence (with coefficients in
) converges. More precisely, consider the set of Cauchy sequences,
; this is an
-subspace of
, the space of all functions
(i.e. all sequences). Consider the subspace
of sequences converging to
; note that
. Therefore, we can consider the quotient
;
embeds via the diagonal embedding, i.e.
maps to
. One quickly checks that
is a ring, and that every non-zero element is in fact invertible, i.e. it is a field. Moreover, one quickly checks that the canonical order
on
extends to
; this allows to define
and
for
in the same manner as for rational numbers. Moreover, one sees that all Cauchy sequences in
actually converge.
The
-adic numbers can be constructed in a very similar way. Fix a prime number
, and condider the
-adic valuation on
, defined by
if
are not divisible by
. Moreover, set
. Then, we can define the
-adic absolute value
,
; then
if, and only if,
; we have that the strict triangle inequality
is satisfied; and we have that
; here,
are arbitrary. Such absolute values which satisfy the strict triangle inequality
are called non-archimedean absolute values.
Remark.In fact, one can show that these-adic absolute values together with the above Archimedean absolute value are all absolute values on
up to equivalence; here, we say that two absolute values
are equivalent if there exists some number
with
for all
.
Now let us continue with the
-adic numbers. We can define Cauchy sequences and the notion of convergence as above, by replacing
by
. As above, we obtain that
has a completion with respect to
which forms a field, denoted by
. This is the field of
-adic numbers. Also,
and
extend onto
. As opposed to the case of the real numbers, the image of
resp.
do not change; the reason is that
is a discrete valuation, i.e. attains only integers. Actually, this field
has several interesting properties, which we want to collect.
Theorem.
- For every
,
.
- The set
is a subring of
; denote this subring by
.
- For any
, we have that
and
are both open and closed in
. In particular,
is both open and closed.
- We have that
- The ring
is local with maximal ideal
, and
. In fact,
is a discrete valuation ring.
- The series
with
converges if, and only if,
.
- Every non-zero element
can be written uniquely in the form
, where
for all
,
and
.
- For every
,
.
- If
is equipped with the topology induced by the metric
, then
is the maximal compact subring of
.
Proof.
- Let
,
sequences in
with
,
. Then, for every
,
. Now
is a topological ring, and
is continuous, whence the result follows from applying
.
- From (a), we see that this set is closed under addition. That it is closed under multiplication is clear, and
are contained in it as well.
- Write
with
and
. Now
, and
- Let
be a sequence of elements in
which converges with respect to
. Then
for all
as
; as
is continuous,
.
Conversely, letand let
be a sequence of elements in
with
. Now
is open; therefore, there exists some
with
for all
. Without loss of generality, we can assume that
, i.e. all
lie in
. Moreover, we can assume that
for all
. We want to construct a sequence
in
with
. For that, write
with
, where
is not divisible by
. Let
be such that
and set
; moreover, write
with
. Then
whence
. Therefore, one obtains that
.
- One quickly checks using 1. that
is closed under addition. It is clearly also closed under multiplication by elements of
, and contains 0; therefore, it is an ideal. Now consider the map
; clearly,
, whence
is contained in the kernel of this map. But
is not contained in the kernel, as
; therefore,
contains a copy of
. To see that this is everything, let
; let
be a sequence in
with
. Let
be such that for all
,
; then
, whence
. But
is contained in the copy of
.
- Clearly, if the series converges, we must have that
.
Now, conversely, assume that. We show that
with
is a Cauchy series. For that, let
be given. Choose
such that for all
,
. Now, if
with
, we have that
by 1., what we had to show.
- First, for any choice of the
’s and
’s, we obtain an element
in
. Now assume that
with
. Assume that there exists some
with
, and further assume that
is chosen to be minimal under this condition, i.e.
for all
. Then
. Multiplying with
gives
with
. Moreover,
, and
. But now
, whence
. But by construction
, a contradiction. Therefore, the representations
are unique.
We have to show that every element incan be written in this way. For that, let
; now
satisfies
; in particular,
. We have to show that we can write
with
. For that, let
be a sequence in
with
; without loss of generality, we can assume that
for every
. Then we also have
for every
, whence
. Therefore, we can choose
inductively such that
, and we obtain that
. Finally, since
(which follows from the strict triangle inequality), it follows that
.
- Clearly,
; therefore, using 7., we see that every residue class in
is uniquely described by
, where
. Hence,
. Now, as in the proof of 5., we see that
injects into
, whence this injection is in fact a bijection. Thus
.
- Let
be any compact subring of
and
. If
, then
for
. Hence,
is unbounded, a contradiction.
Hence, it is left to show thatis compact. For that, it suffices to show that any sequence in
has at least one accumulation point. Let
be any sequence in
. We claim that for any
, there exists some
such that
contains infinitely many elements of the sequence. For
this is clear for any choice of
; hence, assume that this is the case for some
. Now
; now there must be some
such that infinitely many of the
’s lie in
(otherwise, only finitely many can lie in
); set
. We see that
is a Cauchy sequence, whence
exists. Now by construction,
is an accumulation point of
. Therefore,
is compact.
□
Before we continue, we want to explore another construction of
which is completely algebraic. For that, we need the projective limit in the category of rings:
Definition.Letbe a directed set and for every
, let
be a ring. Assume that for every
with
there exists a homomorphism
such that for all
with
, we have
, and we have
. Such a tuple
is called a projective system.
A projective limit of
is a ring
together with homomorphisms
such that
if
, which satisfies the following universal property:
Ifis any other ring and
any other family of ring homomorphisms with
whenever
, there exists a unique homomorphism
with
for all
.
![]()
We have the following, classical result:
Theorem.For every projective systemof rings, there exists a projective limit which is unique up to unique isomorphism; i.e., for any two projective limits
and
there exists a unique isomorphism
such that
for all
.
Moreover, a projective limit can be constructed aswhere
is the restriction of the canonical projection
to the subset
.
□
We chooseDefinition.Letbe a projective system. Define the projective limit of it as any projective limit, and denote it by
.
with the usual order, and let
. Then, if
, one has the projection
,
. Hence, we can define
. Now this definition coincides with the old one; this can be seen using
then, the map
is obviously an isomorphism.
Hensel’s Lemma.
Hensel’s Lemma can be formulated in a very algebraic way. All rings in this section are commutative and unitary.
Definition.Letbe a ring and
an ideal of
. We say that
is nilpotent if
for some
. We say that
is a nilideal if every
is nilpotent, i.e. if for every
there is some
with
.
Note that in Noetherian rings, nilideals are already nilpotent, since ideals generated by finitely many nilpotent elements are always nilpotent. (Note that our rings are commutative. Otherwise it won’t work.)
Proposition (Hensel's Lemma).Letbe a ring and
a nilideal in
. Let
and
such that
and
. Then there exists a unique
with
and
.
Proof (Part I).First, assume that bothand
satisfy
and
. Using
, we see that
for some
using Taylor expansion. Since
is a unit in
, there exist some
,
with
. How
is nilpotent, whence
, i.e.
. But this means that
, whence
. This shows uniqueness.
Moreover, we want to show that it suffices to require thatis nilpotent. Cosider the subring
of
which is the smallest (unitary) subring containing the coefficients of
and
, and some fixed
with
. This ring is clearly finitely generated, whence Noetherian, and
is a nilideal in
as well. Since
is Noetherian,
is in fact nilpotent. Moreover,
since
. Hence, it suffices to prove the lemma for
instead of
.
□
We will complete the proof later. First, let us discuss some implications of this result. Consider the ring
and
, where
. Then clearly
is nilpotent in
, whence we can apply Hensel’s lemma to this situation. Assume that
is a polynomial and
with
; if then
, there exists a unique
with
and
. Doing this construction for
and all
, we obtain a sequence
of elements with
and
, i.e. we obtain an element of
!
In particular, let
be any element with
. Consider
. Now there exists some
with
; therefore,
. But this implies that there exists a unique
with
and
. (Since
is unique modulo
, it follows that
is uniquely defined by
, i.e. by
.) Hence, we have shown that any integer
is invertible in
if
. But how to compute
? We will discuss this later; for now, note that we can use the Extended Euclidean Algorithm to find
with
; then
, i.e. we can approximate
up to arbitrary precision.
What about
? In that case,
: if
would have an inverse in
, say
, then we would have
, a contradiction. Therefore, we get:
Proposition.We have that
□
Newton Iteration.
In the last section, we ignored two points: first, how to prove existence in Hensel’s lemma, and second, how to compute this element in a constructive way. We want to fix this now. For this, we describe how Newton’s method works in arbitrary rings!
Let
be a polynomial,
a nilpotent ideal, and
such that
and
. Fix some
with
, and consider the sequence
We claim that
for all
; since
is nilpotent, this means that the sequence becomes stationary eventually and gives a root of
. Moreover, we claim that
, whence
for all
.
Assume that this is true for some
, i.e. we have
. Then
. Now
, whence
. To show that
, we again use the Taylor expansion; by it,
for some
. Now
, whence
. Moreover,
. Combining this gives
.
Therefore, the proof of Hensel’s lemma is completed. Moreover, we obtained an algorithm to refine an approximation of
without using the Extended Euclidean Algorithm: as soon as
with
is known, we can compute
modulo
by applying the Newton iteration
only
times. Moreover, we can start with some intermediate result, say
modulo
, to compute
modulo
(with
) in at most
iterations (which each need one multiplication and one addition modulo
). This is considerably faster than applying the Extended Euclidean Algorithm for
and
.
So, What About
in
?
Assume that
; then we know that
. Consider the polynomial
; clearly,
in
, and
is a unit in
. Therefore, we can use the methods from above to compute
.
First, we need an approximation of
modulo
. For that, use the Extended Euclidean Algorithm to compute
with
; then
satisfies
, i.e.
.
Set
and
. Then, by the above,
. Hence, this allows to approximate
up to an error of
in
iterations; we only need to perform the Extended Euclidean Algorithm once (to get a starting value), and from that, we can refine the approximation by applying a linear map.
As an example, let us consider
in
, i.e.
,
and
. Clearly,
, whence we get
. Hence,
. Now
and
, whence
,
. We rapidly get
Hence, it seems that
i.e. we have
And indeed:
since
Note that
follows from the fact that
, whence
converges in
(see the theorem); this is a geometric series, whence its value is
. Hence, if we multiply by
, we obtain
.
Finally, let us consider another example, namely
in
, i.e.
,
,
; then
, i.e.
. Hence, we obtain
and
. We then obtain
This can be continued a long time, without seeing any pattern.
One would expect that the sequence of digits evenutally gets (eventually) periodic, as it happens with the decimal expansion of rational numbers. For that, assume that we know
, where
are coprime and not divisible by
, and
. Now let
be the order of
in the multiplicative group
; hence, it is the smallest non-negative rational number with
. Then
. Now,
by the geometric series (as above), whence
Moreover, write
with
such that
. Then
, and
. Set
; then, if we write
, we see that
We are left to consider the
part. In case
, the
-adic expansion of
has finite length, whence adding it does not change the periodicity of
. But what if
?
Lemma.Let, where
. Then
![]()
Proof.Clearly,whence adding
results in the statement.
□
Therefore, the
-adic expansion of
is periodic if
, with almost all
-adic digits being
. Now, we can conclude with the fact that the sum of two periodic
-adic expansions is periodic.
Conversely, assume that
with
and
; we claim that
. Clearly, without loss of generality, we can assume that
. But then, if we set
,
Hence, we proved:
Proposition.An elementwith
lies in
if, and only if, there exists some
such that for all
,
.
□
Finally, note that the order of 17 in
is
; hence, the period length of
is probably 616. We would have had to compute a high amount of
-adic digits of
to see this.

are equivalent if there exists some number
with
for all
.
,
.
is a subring of
, we have that
and
are both open and closed in 
, and
. In fact,
with
converges if, and only if,
.
can be written uniquely in the form
, where
for all
and
.
.
,
sequences in
with
,
. Then, for every
. Now
.
are contained in it as well.
with
and
. Now
, and 
be a sequence of elements in
for all
; as
.
. Now
with
, i.e. all
lie in
. Moreover, we can assume that
for all
in
. For that, write
with
, where
is not divisible by
be such that
and set
; moreover, write
with
. Then
whence
.
is closed under addition. It is clearly also closed under multiplication by elements of
; clearly,
, whence
is contained in the kernel of this map. But
is not contained in the kernel, as
; therefore,
contains a copy of
. To see that this is everything, let
; let
; then
, whence
. But
is contained in the copy of
.
is a Cauchy series. For that, let
such that for all
,
. Now, if
with
, we have that
by 1., what we had to show.
’s and
’s, we obtain an element
with
. Assume that there exists some
with
, and further assume that
for all
. Then
. Multiplying with
gives
with
. Moreover,
. But now
, whence
. But by construction
are unique.
satisfies
; in particular,
. We have to show that we can write
with
. For that, let
for every
for every
, whence
. Therefore, we can choose
, and we obtain that
. Finally, since
(which follows from the strict triangle inequality), it follows that
; therefore, using 7., we see that every residue class in
is uniquely described by
, where
. Now, as in the proof of 5., we see that
injects into
. If
, then
for
. Hence,
such that
contains infinitely many elements of the sequence. For
this is clear for any choice of
; now there must be some
such that infinitely many of the
’s lie in
(otherwise, only finitely many can lie in
. We see that
exists. Now by construction,
be a
, let
be a ring. Assume that for every
with
there exists a homomorphism
such that for all
with
, we have
, and we have
. Such a tuple
is called a projective system.
A projective limit of
such that
if
is any other ring and
any other family of ring homomorphisms with
with
for all
and
there exists a unique isomorphism
.
where
is the restriction of the canonical projection
to the subset
.
for some
is nilpotent, i.e. if for every
with
.
and
satisfy
and
. Using
, we see that
for some
is a unit in
, there exist some
with
. How
, i.e.
. But this means that
, whence
. This shows uniqueness.
. This ring is clearly finitely generated, whence Noetherian, and
is a nilideal in
is in fact nilpotent. Moreover,
since
. Hence, it suffices to prove the lemma for
instead of
.
, where
. Then
whence adding
with
such that for all
,
.
