I think this post is more than two years late in coming, but anywhow…

This post introduces the -adic integers , and the -adic numbers . The one-sentence description is that these are “integers/rationals carrying full mod information” (and only that information).

The first four sections will cover the founding definitions culminating in a short solution to a USA TST problem.

In this whole post, is always a prime. Much of this is based off of Chapter 6B from *Straight from the Book*.

## 1. Motivation

Before really telling you what and are, let me tell you what you might expect them to do.

In elementary/olympiad number theory, we’re already well-familiar with the following two ideas:

- Taking modulo a prime or prime , and
- Looking at the exponent .

Let me expand on the first point. Suppose we have some Diophantine equation. In olympiad contexts, one can take an equation modulo to gain something else to work with. Unfortunately, taking modulo loses some information: (the reduction is far from injective).

If we want finer control, we could consider instead taking modulo , rather than taking modulo . This can also give some new information (cubes modulo , anyone?), but it has the disadvantage that isn’t a field, so we lose a lot of the nice algebraic properties that we got if we take modulo .

One of the goals of -adic numbers is that we can get around these two issues I described. The -adic numbers we introduce is going to have the following properties:

- You can “take modulo for all at once”.
In olympiad contexts, we are used to picking a particular modulus and then seeing what happens if we take that modulus. But with -adic numbers, we won’t have to make that choice. An equation of -adic numbers carries enough information to take modulo .

- The numbers form a field, the nicest possible algebraic structure: makes sense. Contrast this with , which is not even an integral domain.
- It doesn’t lose as much information as taking modulo does: rather than the surjective we have an
*injective*map . - Despite this, you “ignore” some “irrelevant” data. Just like taking modulo , you want to zoom-in on a particular type of algebraic information, and this means necessarily losing sight of other things.
Let me draw an analogy. We know that the equation

has no integer solutions, because, well, squares are nonnegative. But you will find that this equation has solutions modulo any prime , because once you take modulo you stop being able to talk about numbers being nonnegative. The same thing will happen if we work in -adics: the above equation has a solution in for every prime .

So, you can think of -adic numbers as the right tool to use if you only really care about modulo information, but normal isn’t quite powerful enough.

To be more concrete, I’ll give a poster example now:

Here is a problem where we *clearly* only care about -type information. Yet it’s a nontrivial challenge to do the necessary manipulations mod (try it!). The basic issue is that there is no good way to deal with the denominators modulo (in part is not even an integral domain).

However, with -adic analysis we’re going to be able to overcome these limitations and give a “straightforward” proof by using the identity

Such an identity makes no sense over or for converge reasons, but it will work fine over the , which is all we need.

## 2. Algebraic perspective

We now construct and . I promised earlier that a -adic integer will let you look at “all residues modulo ” at once. This definition will formalize this.

### 2.1. Definition of

**Definition 2** **(Introducing )**

A **-adic integer** is a sequence

of residues modulo for each integer , satisfying the compatibility relations for .

The set of -adic integers forms a ring under component-wise addition and multiplication.

**Example 3** **(Some -adic integers)**

Let . Every usual integer generates a (compatible) sequence of residues modulo for each , so we can view each ordinary integer as -adic one:

On the other hand, there are sequences of residues which do not correspond to any usual integer despite satisfying compatibility relations, such as

which can be thought of as .

In this way we get an injective map

which is not surjective. So there are more -adic integers than usual integers.

(Remark for experts: those of you familiar with category theory might recognize that this definition can be written concisely as

where the inverse limit is taken across .)

**Exercise 4**

Check that is an integral domain.

### 2.2. Base expansion

Here is another way to think about -adic integers using “base ”. As in the example earlier, every usual integer can be written in base , for example

More generally, given any , we can write down a “base ” expansion in the sense that there are exactly choices of given . Continuing the example earlier, we would write

and in general we can write

where , such that the equation holds modulo for each . Note the expansion is infinite to the *left*, which is different from what you’re used to.

(Amusingly, negative integers also have infinite base expansions: , corresponding to .)

Thus you may often hear the advertisement that a -adic integer is an “possibly infinite base expansion”. This is correct, but later on we’ll be thinking of in a more and more “analytic” way, and so I prefer to think of this as a **“Taylor series with base ”**. Indeed, much of your intuition from generating functions (where is a field) will carry over to .

### 2.3. Constructing

Here is one way in which your intuition from generating functions carries over:

**Proposition 5** **(Non-multiples of are all invertible)**

The number is invertible if and only if . In symbols,

Contrast this with the corresponding statement for : a generating function is invertible iff .

*Proof:* If then , so clearly not invertible. Otherwise, for all , so we can take an inverse modulo , with . As the are themselves compatible, the element is an inverse.

**Example 6** **(We have )**

We claim the earlier example is actually

Indeed, multiplying it by gives

(Compare this with the “geometric series” . We’ll actually be able to formalize this later, but not yet.)

**Remark 7** **( is an integer for )**

The earlier proposition implies that (among other things); your intuition about what is an “integer” is different here! In olympiad terms, we already knew made sense, which is why calling an “integer” in the -adics is correct, even though it doesn’t correspond to any element of .

Fun (but trickier) exercise: rational numbers correspond exactly to eventually periodic base expansions.

With this observation, here is now the definition of .

**Definition 8** **(Introducing )**

Since is an integral domain, we let denote its field of fractions. These are the **-adic numbers**.

Continuing our generating functions analogy:

This means is “**Laurent series with base **”, and in particular according to the earlier proposition we deduce:

**Proposition 9** **( looks like formal Laurent series)**

Every nonzero element of is uniquely of the form

Thus, continuing our base analogy, elements of are in bijection with “Laurent series”

for . So the base representations of elements of can be thought of as the same as usual, but extending infinitely far to the left (rather than to the right).

(Fair warning: the field has characteristic *zero*, not .)

**Remark 10** **(Warning on fraction field)**

This result implies that you shouldn’t think about elements of as (for ) in practice, even though this is the official definition (and what you’d expect from the name ). The only denominators you need are powers of .

To keep pushing the formal Laurent series analogy, is usually not thought of as quotient of generating functions but rather as “formal series with some negative exponents”. You should apply the same intuition on .

(At this point I want to make a remark about the fact , connecting it to the wish-list of properties I had before. In elementary number theory you can take equations modulo , but if you do the quantity doesn’t make sense unless you know . You can’t fix this by just taking modulo since then you need to get , ad infinitum. You can work around issues like this, but the nice feature of and is that you have modulo information for “all at once”: the information of packages all the modulo information simultaneously. So you can divide by with no repercussions.)

## 3. Analytic perspective

### 3.1. Definition

Up until now we’ve been thinking about things mostly algebraically, but moving forward it will be helpful to start using the language of analysis. Usually, two real numbers are considered “close” if they are close on the number of line, but for -adic purposes we only care about modulo information. So, we’ll instead think of two elements of or as “close” if they differ by a large multiple of .

For this we’ll borrow the familiar from elementary number theory.

**Definition 11** **(-adic valuation and absolute value)**

We define the **-adic valuation** in the following two equivalent ways:

- For we let be the largest such that (or if ). Then extend to all of by .
- Each can be written uniquely as for , . We let .

By convention we set . Finally, define the **-adic absolute value** by

In particular .

This fulfills the promise that and are close if they look the same modulo for large ; in that case is large and accordingly is small.

### 3.2. Ultrametric space

In this way, and becomes a metric space with metric given by .

In fact, these spaces satisfy a stronger form of the triangle inequality than you are used to from .

**Proposition 13** **( is an ultrametric)**

For any , we have the **strong triangle inequality**

Equality holds if (but not only if) .

However, is more than just a metric space: it is a field, with its own addition and multiplication. This means we can do analysis just like in or : basically, any notion such as “continuous function”, “convergent series”, et cetera has a -adic analog. In particular, we can define what it means for an infinite sum to converge:

**Definition 14** **(Convergence notions)**

Here are some examples of -adic analogs of “real-world” notions.

- A sequence , \dots converges to a limit if .
- The infinite series converges if the sequence of partial sums , , \dots, converges to some limit.
- \dots et cetera \dots

With this definition in place, the “base ” discussion we had earlier is now true in the analytic sense: if then

Indeed, the th partial sum is divisible by , hence the partial sums approach as .

While the definitions are all the same, there are some changes in properties that should be true. For example, in convergence of partial sums is simpler:

Contrast this with in . You can think of this as a consequence of strong triangle inequality. *Proof:* By multiplying by a large enough power of , we may assume . (This isn’t actually necessary, but makes the notation nicer.)

Observe that must eventually stabilize, since for large enough we have . So let be the eventual residue modulo of for large . In the same way let be the eventual residue modulo , and so on. Then one can check we approach the limit .

Here’s a couple exercises to get you used to thinking of and as metric spaces.

**Exercise 16** **( is compact)**

Show that is not compact, but is. (For the latter, I recommend using sequential continuity.)

**Exercise 17** **(Totally disconnected)**

Show that both and are *totally disconnected*: there are no connected sets other than the empty set and singleton sets.

### 3.3. More fun with geometric series

While we’re at it, let’s finally state the -adic analog of the geometric series formula.

**Proposition 18** **(Geometric series)**

Let with . Then

*Proof:* Note that the partial sums satisfy , and as since .

So, is really a correct convergence in . And so on.

If you buy the analogy that is generating functions with base , then all the olympiad generating functions you might be used to have -adic analogs. For example, you can prove more generally that:

**Theorem 19** **(Generalized binomial theorem)**

If and , then for any we have the series convergence

(I haven’t defined , but it has the properties you expect.) The proof is as in the real case; even the theorem statement is the same except for the change for the extra subscript of . I won’t elaborate too much on this now, since -adic exponentiation will be described in much more detail in the next post.

### 3.4. Completeness

Note that the definition of could have been given for as well; we didn’t need to introduce it (after all, we have in olympiads already). The big important theorem I must state now is:

**Theorem 20** **( is complete)**

The space is the completion of with respect to .

This is the definition of you’ll see more frequently; one then defines in terms of (rather than vice-versa) according to

(Remark for experts: is a field with a non-Arcihmedian valuation; then is its valuation ring.)

Let me justify why this definition is philosophically nice.

Suppose you are a numerical analyst and you want to estimate the value of the sum

to within . The sum consists entirely of rational numbers, so the problem statement would be fair game for ancient Greece. But it turns out that in order to get a good estimate, it *really helps* if you know about the real numbers: because then you can construct the infinite series , and deduce that , up to some small error term from the terms past , which can be bounded.

Of course, in order to have access to enough theory to prove that , you need to have the real numbers; it’s impossible to do serious analysis in the non-complete space , where e.g. the sequence , , , , \dots is considered “not convergent” because . Instead, all analysis is done in the completion of , namely .

Now suppose you are an olympiad contestant and want to estimate the sum

to within mod (i.e. to within in ). Even though is a rational number, it still helps to be able to do analysis with infinite sums, and then bound the error term (i.e. take mod ). But the space is not complete with respect to either, and thus it makes sense to work in the completion of with respect to . This is exactly .

## 4. Solving USA TST 2002/2

Let’s finally solve Example~1, which asks to compute

Armed with the generalized binomial theorem, this becomes straightforward.

Using the elementary facts that and , this solves the problem.