For every prime number p, the p-adic numbers form an extension of the rational numbers first described by Kurt Hensel in 1897. They have been used to solve several problems in number theory, many of them using Helmut Hasse's local-global principle, which roughly states that an equation can be solved over the rational numbers if it can be solved over the real numbers and over the p-adic numbers for every prime p.

If p is a fixed prime number, then any integer can be written as a p-adic expansion in the form

```       n
±  ∑  aipi
i=0
```

where the ai are integers in {0,...,p-1}. For example, the 2-adic or binary expansion of 35 is 1*25 + 0*24 + 0*23 + 0*22 + 1*21 + 1*20, often written in the shorthand notation 1000112.

If we extend this set by allowing infinite sums of the form

```       ∞
±  ∑  aipi
i=0
```

we obtain the p-adic integers. Intuitively, these are numbers whose p-adic expansion to the left never stops. The main technical problem is to define a proper notion of infinite sum which makes these expressions meaningful; two different but equivalent solutions to this problem will be presented below.

The p-adic integers form a ring, and by taking quotients of two p-adic integers, we obtain the field Qp of p-adic numbers. These numbers can be visualized as p-adic expansions which to the left never stop, and which have finitely many p-adic digits to the right of the "decimal" point. Qp which has the nice topological property of completeness. This allows the development of p-adic analysis akin to real analysis.

### Construction

#### Analytic approach

The real numbers can be defined as equivalence classes of Cauchy sequences of rational numbers. However, the definition of a Cauchy sequence relies on the metric chosen and, by choosing a different norm, numbers other than the real numbers can be constructed. The usual metric is called the Euclidean metric.

For a given prime p > 1, we define the p-adic metric in Q as follows: for a non-zero rational number x, write x = pny where neither the numerator and denominator of y have the factor p (notice that n is uniquely specified by this requirement); now define |x|p = p-n. We also define |0|p = 0. It can be proved that all norms on Q are equivalent to either the Euclidean norm or one of the p-adic norms for some prime p. The p-adic norm defines a metric on Q by setting dp(x,y) = |x - y|p.

The field Qp of p-adic numbers can then be defined as the completion of the metric space (Q,dp); its elements are equivalence classes of Cauchy sequences, where two sequences are called equivalent if their difference converges to zero. In this way, we obtain a complete metric space which is also a field and contains Q.

#### Algebraic approach

In the algebraic approach, we first define the ring of p-adic integers, and then construct the field of quotients of this ring to get the field of p-adic numbers.

We start with the inverse limit of the rings Zpn (see modular arithmetic): a p-adic integer is then a sequence (an) such that an is in Zpn, and if n<m, an = am (mod pn). Note that addition and multiplication of such sequences is well defined, since addition and multiplication commute with the mod operator, see modular arithmetic.

Every natural number, m defines such a sequence (m mod pn), and can therefore be regarded as a p-adic integer.

Note that every sequence (an) where the first element is not 0 has an inverse: since in that case, for every n, an and p are relatively prime (their greatest common divisor is a1), and so an and pn are relatively prime. Therefore, an has an inverse mod pn, and the sequence of inverses, (bn), is the sought inverse of (an).

The ring of p-adic integers has no zero divisors, so we can take the quotient field to get the field Qp of p-adic numbers. Note that in the quotient field, every number can be written as p-na with an element a in the ring and n a natural number.

### Properties

The p-adic numbers contain the rational numbers Q and form a field of characteristic 0. This field cannot be turned into an ordered field.

The topology of the set of p-adic integers is that of a Cantor set; the topology of the set of p-adic numbers is that of a Cantor set minus a point (which would naturally be called infinity).

As metric spaces, both the p-adic integers and the p-adic numbers are complete.

The real numbers have only a single algebraic extension, the complex numbers; in other words, a quadratic extension is already algebraically closed. The necessary algebraic extension to the field of p-adic numbers that makes it algebraically closed has infinite degree; and for any given p, there exist infinitely many inequivalent algebraic extensions.