p-adic numbers are often mystified as being highly exotic or counter-intuitive. I’d like to say to those unfamiliar with p-adic numbers that they are entirely graspable, so long as one is willing to delve into the analytic foundations of more familiar number fields such as the rationals and the reals. The fact of the matter is that the p-adic fields are just as foundational in contemporary number theory. So, let’s see what these number fields are made of.
Completions of the Rationals
Given a prime p, a p-adic number is just a number in a particular kind of number field called a p-adic field
Each p-adic field is a completion of the field of rational numbers, ℚ. What is a completion of ℚ? It is a field in which Cauchy sequences converge.
A helpful way to begin thinking about Cauchy sequences is to begin with a base-10 series, i.e., a decimal expansion of a number:
For example, there are two decimal expansions for the number 1. The first is as follows:
The second is simply
The second converges to 1 immediately. The first does so in the infinite limit.
What does convergence mean? It means that for some sequence
given a real infinitesimal ε, it is the case that
This is just a technical way of saying that the difference between consecutive terms eventually becomes so small that it decreases below some negligible threshold (expressed by ε), at which point we regard the sequence to be convergent.
The two given Cauchy sequences for 1, because they encode the same number, are said to belong to an equivalence class. We can think of the field of real numbers, ℝ, as a field of equivalence classes of decimal expansions of numbers. Importantly, ℝ contains Cauchy sequences that do not belong in the field of rationals, such as the square root of 2.
How many ways can we complete the rational numbers to obtain convergent Cauchy sequences? Thanks to Ostrowski’s theorem, we know that there are only two ways: via the reals, and via p-adic fields. That’s why the p-adic fields are so important, and so fundamental.
Solutions Mod p
Let’s begin our review with a concrete computation of a p-adic number. Those with some exposure to number theory will doubtlessly be familiar with taking solutions mod p or mod pn. Algebraically speaking, we can begin to think about p-adic numbers in terms of solutions to equations mod pn for increasing values of n.
For instance, if one wants to obtain the number 1/3 in the 2-adic field, one just solves the following for all n:
With this straightforward computation, one gets the following values:
As we will see later in this tutorial, this actually gives a convergent Cauchy sequence in the 2-adic field!
Rather than write the 2-adic number as a decimal, one writes it in base-2. Whereas decimals have coefficients between 0 and 9, the coefficient of each 2-adic term is either 0 or 1. Thus, the new Cauchy sequence is as follows:
How do we encode these solutions mod 2n in base-2? The answer is: each coefficient an is uniquely determined by the number of solutions mod 2n . We can think of the coefficient values, 1 or 0, as a yes-or-no answer to the following question: given the number of solutions mod 2n, do we need a bit at position n to encode that number of solutions? If we do need the bit, the coefficient an is 1, or else it is 0. If the coefficient an is 1, then the number of solutions mod 2n is 2n-1 ≤ x < 2n.
That is all to say:
Let’s compute some coefficients for the 2-adic expansion of 1/3:
Proceeding from right to left (as one does with p-adic numbers), one gets the following repeating sequence:
or
Hopefully this exercise helps to demystify p-adic numbers: we’re just encoding data regarding solutions mod pn in base-p. With this in mind, we can better understand what is often regarded as an unusual aspect of p-adic fields: p-adic distance.
p-Adic Distance and Valuation
Unlike the rationals, the reals form a metric space, which means that given any two real numbers, one can measure the distance between them, i.e., by taking an absolute value:
The p-adic fields offer an entirely different way to form metric spaces. That is to say, p-adic fields obtain convergent Cauchy sequences in a different way, with a different kind of distance, the p-adic distance:
where vp is the p-adic valuation:
What is this saying? Basically, the p-adic valuation of a number n is the greatest natural number which, as an exponent for p, divides n.
Let’s do an example. In the 2-adic field, the numbers 257 and 1 are rather close because 257-1=256, which is divisible by 28:
and so the 2-distance between 257 and 1 is:
on the other hand, 257 and 2 are much farther away (i.e., their distance is greater):
I believe there’s a rather natural way to think about this, especially in the case of p=2: one can think of 2-adic distance in terms of ‘bit-flipping’. In coding theory, for instance, there are notions such as Hamming distance to measure the dissimilarity between binary strings. 2-adic distance is (qualitatively) analogous, actually.
For instance, the binary encoding for 1 is 10000000 and the binary encoding of 257 is 10000001; they differ by only 1 bit-flip. Moreover, they agree for the first 7 bits. One can think of 2-adic distance as essentially saying that numbers which agree for more bits before a bit-flip is required, and which require fewer bit-flips, are closer. On the other hand, the binary encoding of 2 is 01000000. Thus, it differs from the binary encoding of 257 by three bit-flips, and disagrees at the second bit.
Real absolute values, on the other hand, simply take the distance between two numbers on a number line. Their distance is called “Archimedean”, meaning that it satisfies the Archimedean property (which essentially amounts to saying that distances correspond to a number line). For instance, the distances
are as follows on the real number line:
On the other hand, because p-adic distance depends on exponentiation, numbers that would be close on a number line may not be close according to a p-adic metric. p-adic distance is typically visualized via Euclidean models, which have ‘non-linear’, self-similar structure:
Although this fractal-like characteristic of p-adic distance might appear unusual out of context, hopefully, by now, it seems intuitive.
Cauchy Sequence Convergence
Finally, let’s see how p-adic numbers give rise to convergent Cauchy sequences. Consider once again the 2-adic expansion of 1/3:
In the case of the real numbers, for |r|<1, one could apply the following formula to obtain the convergent value
If we were to try to apply this trick to the case of the 2-adic expansion of 1/3, it would be rewritten as:
If we plug 2(20 + 22 + 24 + ….) into the above formula, we find:
That seems to work! However, in the case of the reals, one can only use this formula when |r|<1; otherwise, the sequence doesn’t converge. This can be seen plainly from plotting the values. Under the real metric (i.e., absolute values), it certainly isn’t converging. It’s growing!
However, if we take the 2-adic distance between consecutive terms, we find that it is decreasing:
This works in general: 2-adic expansions of 1/3, 1/7, 1/11, and 1/13 all appear to grow in the real field…
but the 2-adic distances between terms decreases:









