A first introduction to p-adic numbers

David A. Madore

Revised 7th december 2000

In all that follows, p will stand for a prime number. ℕ, ℤ, ℚ, ℝ and ℂ are the sets of respectively the natural numbers (i.e. non negative integers), integers, rational numbers, reals and complex numbers.

In some — but not all — of what follows, we assume the reader is familiar with the notions of “group”, “ring” and “field”. We assume throughout that the reader knows the basic facts about the b-adic representation (i.e. representation in base b) of integers and reals

Note: I did not aim here at writing a completely rigorous document, but only an easily understandable introduction for those who do not have any idea of what a p-adic is.

1 First definition

We will call \underline{p-adic digit} a natural number between 0 and p − 1 (inclusive). A \underline{p-adic integer} is by definition a sequence (a_{i})_{i∈ℕ} of p-adic digits. We write this conventionally as

⋯ a_{i} ⋯ a_{2} a_{1} a_{0}

(that is, the a_{i} are written from left to right).

If n is a natural number, and

n = \overline{a_{k−1} a_{k−2} ⋯ a_{1} a_{0}}

is its p-adic representation (in other words n = ∑_{i=0}^{k−1} a_{i}p^{i} with each a_{i} a p-adic digit) then we identify n with the p-adic integer (a_{i}) with a_{i} = 0 if i ≥ k. This means that natural numbers are exactly the same thing as p-adic integer only a finite number of whose digits are not 0. Also note that 0 is the p-adic integer all of whose digits are 0, and that 1 is the p-adic integer all of whose digits are 0 except the right-most one (digit 0) which is 1.

If α = (a_{i}) and β = (b_{i}) are two p-adic integers, we will now define their \underline{sum}. To that effect, we define by induction a sequence (c_{i}) of p-adic digits and a squence (ε_{i}) of elements of {0, 1} (the “carries”) as follows:

• ε_{0} is 0.

• c_{i} is a_{i} + b_{i} + ε_{i} or a_{i} + b_{i} + ε_{i} − p according as which of these two is a p-adic digit (in other words, is between 0 and p − 1). In the former case, ε_{i+1} = 0 and in the latter, ε_{i+1} = 1.

Under those circumstances, we let α + β = (c_{i}) and we call α + β the sum of α and β. Note that the rules described above are exactly the rules used for adding natural numbers in p-adic representation. In particular, if α and β turn out to be natural numbers, then their sum as a p-adic integer is no different from their sum as a natural number. So 2 + 2 = 4 remains valid (whatever p is — but if p = 2 it would be written ⋯ 010 + ⋯ 010 = ⋯ 100).

Here is an example of a 7-adic addition:

⋯ 2 5 1 4 1 3
+ ⋯ 1 2 1 1 0 2
⋯ 4 0 2 5 1 5

This addition of p-adic integers is associative, commutative, and verifies α + 0 = α for all α (recall that 0 is the p-adic integer all of whose digits are 0).

Subtraction of p-adic integers is also performed in exactly the same way as that of natural numbers in p-adic form. Since everybody reading this is assumed to have gone through first and second grade, we will not elaborate further :-).

Note that this subtraction scheme gives us the negative integers readily: for example, subtract 1 from 0 (in the 7-adics) :

⋯ 0 0 0 0 0 0
− ⋯ 0 0 0 0 0 1
⋯ 6 6 6 6 6 6

(each column borrows a 1 from the next one on the left). So −1 = ⋯ 666 as 7-adics. More generally, −1 is the p-adic all of whose digits are p − 1, −2 has all of its digits equal to p − 1 except the right-most which is p − 2, and so on. In fact, (strictly) negative integers correspond exactly to those p-adics all of whose digits except a finite number are equal to p − 1.

It can then be verified that p-adic integers, under addition, form an abelian group.

We now proceed to describe multiplication. First note that if n is a natural number and α a p-adic integer, then we have a naturally defined nα = α + ⋯ + α (n times, with 0α = 0 of course). If n is negative, we let, of course, nα = −((−n)α). This limited multiplication satisfies some obvious equalities, such as (m + n)α = mα + nα, n(α + β) = nα + nβ, m(nα) = (mn)α, and so on (for those with some background in algebra, this is not new: any abelian group is a ℤ-module). Note also that multiplying by p = ⋯ 0010 is the same as adding a 0 on the right.

Multiplying two p-adic integers on the other hand requires some more work. To do that, we note that if α_{0}, α_{1}, α_{2}, … are p-adic integers, with α_{1} ending in (at least) one zero, α_{2} ending in (at least) two zeroes, and so on, then we can define the sum of all the α_{i}, even though they are not finite in number. Indeed, the last digit of the sum is just the last digit of α_{0} (since α_{1}, α_{2}, … all end in zero), the second-last is the second-last digit of α_{0} + α_{1} (because α_{2}, α_{3}, … all end in 00), and so on: every digit of the (infinite) sum can be calculated with just a finite sum. Now we suppose that we want to multiply α and β = (b_{i}) two p-adic integers. We then let α_{0} = b_{0}α (we know how to define this since b_{0} is just a natural number), α_{1} = pb_{1}α, and so on: α_{i} = p^{i}b_{i}α. Since α_{i} is a p-adic integer multiplied by p^{i}, it ends in i zeroes, and therefore the sum of all the α_{i} can be defined.

This procedure may sound complicated, but, once again, it is still exactly the same as we have all learned in grade school to multiply two natural numbers. Here is an example of a 7-adic multiplication:

⋯ 2 5 1 4 1 3
× ⋯ 1 2 1 1 0 2
⋯ 5 3 3 1 2 6
+ ⋯ 0 0 0 0 0
+ ⋯ 1 4 1 3
+ ⋯ 4 1 3
+ ⋯ 2 6
+ ⋯ 3
⋯ 3 1 0 4 2 6

(of course, it is relatively likely that I should have made some mistake somewhere).

We now have a set of p-adic integers, which we will call ℤ_{p}, with two binary operations on it, addition and multiplication. It can be checked — but we will not do it — that ℤ_{p} is then a commutative ring (for those who don’t know what that means, it means that addition is associative and commutative, that zero exists and satisfies the properties we wish it to satisfy, that multiplication is associative and commutative, and distributive over addition, and that 1 exists and satisfies the properties we wish it to satisfy (namely 1α = α for all α)).

Now, how about division? First, the bad news: division of p-adics is not performed in the same way as division of integers or reals. In fact, it can’t always be performed. For example, 1/p has no meaning as a p-adic integer — that is, the equation pα = 1 has no solution — since multiplying a p-adic integer by p always gives a p-adic integer ending in 0. There is nothing really surprising here: 1/p can’t be performed in the integers either.

However, what is mildly surprising is that division by p is essentially the only division which cannot be performed in the p-adic integers. This statement (in technical terms “ℤ_{p} is a local ring”) will not be made precise for the moment; however, we give a concrete example. Suppose p is odd (in other words, p ≠ 2). And let α be the p-adic integer all of whose digits are equal to (p − 1)/2 except the last one which is (p + 1)/2. By performing 2α (in other words, α + α), it is clear that every digit will be zero except the last one which is 1. So 2α = 1, in other words α = 1/2.

For example, with our usual example of p = 7 we show that the number α = ⋯ 333334 is the number “one half” by adding it to itself:

⋯ 3 3 3 3 3 4
+ ⋯ 3 3 3 3 3 4
⋯ 0 0 0 0 0 1

Thus, in the 7-adic integers, “one half” is an integer. And so are “one third” (⋯ 44445), “one quarter” (⋯ 1515152), “one fifth” (⋯ 541254125413), “one sixth” (⋯ 55556), “one eighth” (⋯ 0606061), “one ninth” (⋯ 3613613614), “one tenth” (⋯ 462046205), “one eleventh” (⋯ 162355043116235504312) and so on. But “one seventh”, “one fourtneenth” and so on, are not 7-adic integers.

We now give a way to calculate the inverse (and therefore the quotient) of p-adic integers. Suppose α is a p-adic integer ending in zero (such numbers are called small for reasons we will describe later). Then α^{i} ends in at least i zeros. Therefore, as we have seen, we can calculate β = 1 + α + α^{2} + ⋯ even though it has an infinite number of terms. Multiplying this by (1 − α) and expanding out (we shall admit that all the appropriate properties of addition are preserved when dealing with infinite sums) we find that (1−α)β = 1−α+α−α^{2} +α^{2} −⋯ = 1. Therefore we are able to calculate the inverse of 1 − α, which may be, as is easy to see, any p-adic integer ending in 1. To summarize: p-adic integers ending in 0 have no inverse; those ending in 1 can be inverted with the formula described above. To inverse a p-adic integer α ending in a digit d other than 0 and 1, we find the (unique) digit f such that df is congruent to 1 mod p (i.e. is equal to 1 plus a multiple of p). In that case, fα ends in 1 so can be inverted, and we then have 1/α = f/(fα). To find f for small values of p, I have no better advice than checking successively all digits. Perhaps computer scientists can suggest an altogether faster method for inverting p-adics.

Up to now we have only described p-adic integers, and not p-adic numbers. We now proceed to define the latter. The relation between the set (ring) ℤ_{p} of p-adic integers and the set (field) ℚ_{p} of p-adic numbers is the same as between the set (ring) ℤ of integers and the set (field) ℚ of rationals. Namely, the second is obtained by taking quotients of an element of the first by a non zero element of the same — or, which amounts to the same, by adding new inverses to some elements of the first. In the case of the rationals, an inverse has to be added to every prime number p. In our case, however, we are fortunate, and adding an inverse to p only will suit our needs. We therefore proceed to do that.

We now define a \underline{p-adic number} to be a ℤ-indexed sequence (a_{i})_{i∈ℤ} of p-adic digits such that a_{i} = 0 for sufficiently small i (explicitly: there exists i_{0} ∈ ℤ such that a_{i} = 0 for i < i_{0}). Such numbers are also written from right to left, with a “p-adic dot” after decimal 0. So our condition says: there are a finite number of non zero digits on the right of the p-adic point. We consider p-adic integers as padic numbers by identifying (a_{i})_{i∈ℕ} with (a_{i})_{i∈ℤ} where a_{i} = 0 for i < 0, in other words by adding zeros to the right of the point. If α = (a_{i}) is a p-adic number such that a_{i} = 0 for i < i_{0} (and we can certainly suppose i_{0} ≤ 0 so we do) then the p-adic number α′ obtained by shifting every decimal of α by −i_{0} places to the left is a p-adic integer. We write α = α′p^{i_{0}} (or α = α′/p^{−i_{0}}).

p-adic numbers can then be added as follows: if α = α′p^{i} with α′ a p-adic intger, and β = β′p^{j} ditto, and suppose moreover i ≤ j ≤ 0, then we let α + β = (α′ + β′p^{j−i})p^{i} — note that α′ + β′p^{j−i} is indeed a p-adic integer. This is just a complicated way of saying that we add as usual, starting from the furthest (rightmost) column where there is a non zero digit. Multiplication is easier: under the same notations (except that the condition i ≤ j is no longer necessary) we let αβ = α′β′p^{i+j}. This says that we multiply “as usual”, ignoring the p-adic dot, and then we place the dot in the “obvious” place where it should be.

The set ℚ_{p} of p-adic numbers, with this addition and multiplication, forms a field — in other words, all the properties of a ring are satisfied, and moreover every nonzero element has a multiplicative inverse.

2 Second definition — topology and metric

If n is an integer, recall that its p-adic valuation is the exponent of the greatest power of p that divides n. It is written v_{p}(n). By convention, v_{p}(0) = ∞. If r = a/b is a rational, its p-adic valuation is defined as v_{p}(r) = v_{p}(a) − v_{p}(b).

For example, the 7-adic valuation of 7 is 1. That of 14 is also 1, as are those of 21, 28, 35, 42 or 56. The 7-adic valuation of 49, on the other hand, is 2, as is that of 98. And the 7-adic valuation of 343 is 3. The 2-adic valuation of an integer is 0 iff it is odd, it is at least 1 iff it is even, at least 2 iff the integer is multiple by 4, and so on. The 7-adic valuation of 1/7 is −1, and so are those of 3/7, 1/14, 5/56. The 7-adic valuation of 1/2 or 8/3 is 0. The 7-adic valuation of 7/3 or 14/5 is 1. The 7-adic valuation of 48/49 is −2.

We now define the p-adic \underline{absolute value} of a rational number r to be |r|_{p} = p^{−v_{p}(r)}. For example, |p|_{p} = \frac{1}{p}, |1|_{p} = 1, |2p|_{p} = \frac{1}{p} if p is odd, and |\frac{1}{p^{2}} | = p^{2}.

We then define the p-adic distance between two rationals r, r′ to be |r′ − r|_{p}. It is relatively straightforward to check that this indeed defines a distance on the rationals. The rationals are not complete for that distance, in other words, every Cauchy sequence is not convergent. It is possible to define the p-adic numbers as the completion of the p-adic rationals under this metric. General theorems on topological fields ensure that this defines a field, the field of p-adic numbers.

To make the equivalence of both definitions clearer, we say that the valuation of a p-adic number (a_{i}) is the smallest i_{0} (possibly positive) such that a_{i} = 0 for all i < i_{0}. With this terminology, a p-adic integer is exactly a p-adic number with non negative valuation. And a small p-adic integer (one which ends in 0) is one whose valuation is (strictly) positive. It is not hard to check that this definition coincides with the aforementioned one for integers, hence for rationals.

As for rationals, we define the p-adic absolute value and distance by |α|_{p} = p^{−v_{p}(α)}. Note that the p-adic absolute value of a p-adic number is real number (it is also a p-adic, and in fact a rational, but ought not be considered as such). Then ℚ_{p} is a metric space, and the two following facts can be proven:

• ℚ_{p} is complete.

• ℚ is dense in ℚ_{p}.

Also note that ℤ_{p} is the unit ball with center 0 in ℚ_{p}.