In mathematics, the **p-adic number system** for any prime number p extends the ordinary arithmetic of the rational numbers in a different way from the extension of the rational number system to the real and complex number systems. The extension is achieved by an alternative interpretation of the concept of "closeness" or absolute value. In particular, two p-adic numbers are considered to be close when their difference is divisible by a high power of p: the higher the power, the closer they are. This property enables p-adic numbers to encode congruence information in a way that turns out to have powerful applications in number theory – including, for example, in the famous proof of Fermat's Last Theorem by Andrew Wiles.^{[1]}

These numbers were first described by Kurt Hensel in 1897,^{[2]} though, with hindsight, some of Ernst Kummer's earlier work can be interpreted as implicitly using p-adic numbers.^{[note 1]} The p-adic numbers were motivated primarily by an attempt to bring the ideas and techniques of power series methods into number theory. Their influence now extends far beyond this. For example, the field of p-adic analysis essentially provides an alternative form of calculus.

Algebraic structure → Ring theoryRing theory |
---|

More formally, for a given prime p, the field **Q**_{p} of p-adic numbers is a completion of the rational numbers. The field **Q**_{p} is also given a topology derived from a metric, which is itself derived from the *p*-adic order, an alternative valuation on the rational numbers. This metric space is complete in the sense that every Cauchy sequence converges to a point in **Q**_{p}. This is what allows the development of calculus on **Q**_{p}, and it is the interaction of this analytic and algebraic structure that gives the p-adic number systems their power and utility.

The p in "p-adic" is a variable and may be replaced with a prime (yielding, for instance, "the 2-adic numbers") or another expression representing a prime number. The "adic" of "p-adic" comes from the ending found in words such as dyadic or triadic.

The decimal expansion of a positive rational number is its representation as a series

where is an integer and each is also an integer such that This expansion can be computed by long division of the numerator by the denominator, which is itself based on the following theorem: If is a rational number such that there is an integer such that and with The decimal expansion is obtained by repeatedly applying this result to the remainder which in the iteration assumes the role of the original rational number .

The p-*adic expansion* of a rational number is defined similarly, but with a different division step. More precisely, given a fixed prime number , every nonzero rational number can be uniquely written as where is a (possibly negative) integer, and are coprime integers both coprime with , and is positive. The integer is the **p-adic valuation** of , denoted and is its **p-adic absolute value**, denoted (the absolute value is small when the valuation is large). The division step consists of writing

where is an integer such that and is either zero, or a rational number such that (that is, ).

The -*adic expansion* of is the formal power series

obtained by repeating indefinitely the above division step on successive remainders. In a p-adic expansion, all are integers such that

If with , the process stops eventually with a zero remainder; in this case, the series is completed by trailing terms with a zero coefficient, and is the representation of in base-p.

The existence and the computation of the p-adic expansion of a rational number results from Bézout's identity in the following way. If, as above, and and are coprime, there exist integers and such that So

Then, the Euclidean division of by gives

with This gives the division step as

so that in the iteration

is the new rational number.

The uniqueness of the division step and of the whole p-adic expansion is easy: if one has This means divides Since and the following must be true: and Thus, one gets and since divides it must be that

The p-adic expansion of a rational number is a series that converges to the rational number, if one applies the definition of a convergent series with the p-adic absolute value. In the standard p-adic notation, the digits are written in the same order as in a standard base-p system, namely with the powers of the base increasing to the left. This means that the production of the digits is reversed and the limit happens on the left hand side.

The p-adic expansion of a rational number is eventually periodic. Conversely, a series with converges (for the p-adic absolute value) to a rational number if and only if it is eventually periodic; in this case, the series is the p-adic expansion of that rational number. The proof is similar to that of the similar result for repeating decimals.

Let us compute the 5-adic expansion of Bézout's identity for 5 and the denominator 3 is (for larger examples, this can be computed with the extended Euclidean algorithm). Thus

For the next step, one has to "divide" (the factor 5 in the numerator of the fraction has to be viewed as a "shift" of the p-adic valuation, and thus it is not involved in the "division"). Multiplying Bézout's identity by gives

The "integer part" is not in the right interval. So, one has to use Euclidean division by for getting giving

and

Similarly, one has

and

As the "remainder" has already been found, the process can be continued easily, giving coefficients for odd powers of five, and for even powers. Or in the standard 5-adic notation

with the ellipsis on the left hand side.

In this article, given a prime number p, a *p-adic series* is a formal series of the form

where every nonzero is a rational number such that none of and is divisible by p.

Every rational number may be viewed as a p-adic series with a single term, consisting of its factorization of the form with n and d both coprime with p.

A p-adic series is *normalized* if each is an integer in the interval So, the p-adic expansion of a rational number is a normalized p-adic series.

The p-adic valuation, or p-adic order of a nonzero p-adic series is the lowest integer i such that The order of the zero series is infinity

Two p-adic series are *equivalent* if they have the same order k, and if for every integer *n* ≥ *k* the difference between their partial sums

has an order greater than n (that is, is a rational number of the form with and a and b both coprime with p).

For every p-adic series , there is a unique normalized series such that and are equivalent. is the *normalization* of The proof is similar to the existence proof of the p-adic expansion of a rational number. In particular, every rational number can be considered as a p-adic series with a single nonzero term, and the normalization of this series is exactly the rational representation of the rational number.

In other words, the equivalence of p-adic series is an equivalence relation, and each equivalence class contains exactly one normalized p-adic series.

The usual operations of series (addition, subtraction, multiplication, division) map p-adic series to p-adic series, and are compatible with equivalence of p-adic series. That is, denoting the equivalence with ~, if S, T and U are nonzero p-adic series such that one has

Moreover, S and T have the same order, and the same first term.

It is possible to use a positional notation similar to that which is used to represent numbers in base p.

Let be a normalized p-adic series, i.e. each is an integer in the interval One can suppose that by setting for (if ), and adding the resulting zero terms to the series.

If the positional notation consists of writing the consecutively, ordered by decreasing values of i, often with p appearing on the right as an index:

So, the computation of the example above shows that

and

When a separating dot is added before the digits with negative index, and, if the index p is present, it appears just after the separating dot. For example,

and

If a p-adic representation is finite on the left (that is, for large values of i), then it has the value of a nonnegative rational number of the form with integers. These rational numbers are exactly the nonnegative rational numbers that have a finite representation in base p. For these rational numbers, the two representations are the same.

There are several equivalent definitions of p-adic numbers. The one that is given here is relatively elementary, since it does not involve any other mathematical concepts than those introduced in the preceding sections. Other equivalent definitions use completion of a discrete valuation ring (see § *p*-adic integers), completion of a metric space (see § Topological properties), or inverse limits (see § Modular properties).

A p-adic number can be defined as a *normalized p-adic series*. Since there are other equivalent definitions that are commonly used, one says often that a normalized p-adic series *represents* a p-adic number, instead of saying that it *is* a p-adic number.

One can say also that any p-adic series represents a p-adic number, since every p-adic series is equivalent to a unique normalized p-adic series. This is useful for defining operations (addition, subtraction, multiplication, division) of p-adic numbers: the result of such an operation is obtained by normalizing the result of the corresponding operation on series. This well defines operations on p-adic numbers, since the series operations are compatible with equivalence of p-adic series.

With these operations, p-adic numbers form a field called the **field of p-adic numbers** and denoted or There is a unique field homomorphism from the rational numbers into the p-adic numbers, which maps a rational number to its p-adic expansion. The image of this homomorphism is commonly identified with the field of rational numbers. This allows considering the

The *valuation* of a nonzero p-adic number x, commonly denoted is the exponent of p in the first nonzero term of every p-adic series that represents x. By convention, that is, the valuation of zero is This valuation is a discrete valuation. The restriction of this valuation to the rational numbers is the p-adic valuation of that is, the exponent v in the factorization of a rational number as with both n and d coprime with p.

The **p-adic integers** are the p-adic numbers with a nonnegative valuation.

A p-adic integer can be represented as a sequence

of residues x_{e} mod p^{e} for each integer e, satisfying the compatibility relations for i < j.

Every integer is a p-adic integer (including zero, since ). The rational numbers of the form with d coprime with p and are also p-adic integers (for the reason that d has an inverse mod p^{e} for every e).

The p-adic integers form a commutative ring, denoted or , that has the following properties.

- It is an integral domain, since it is a subring of a field, or since the first term of the series representation of the product of two non zero p-adic series is the product of their first terms.
- The units (invertible elements) of are the p-adic numbers of valuation zero.
- It is a principal ideal domain, such that each ideal is generated by a power of p.
- It is a local ring of Krull dimension one, since its only prime ideals are the zero ideal and the ideal generated by p, the unique maximal ideal.
- It is a discrete valuation ring, since this results from the preceding properties.
- It is the completion of the local ring which is the localization of at the prime ideal

The last property provides a definition of the p-adic numbers that is equivalent to the above one: the field of the p-adic numbers is the field of fractions of the completion of the localization of the integers at the prime ideal generated by p.

The p-adic valuation allows defining an absolute value on p-adic numbers: the p-adic absolute value of a nonzero p-adic number x is

where is the p-adic valuation of x. The p-adic absolute value of is This is an absolute value that satisfies the strong triangle inequality since, for every x and y one has

- if and only if

Moreover, if one has

This makes the p-adic numbers a metric space, and even an ultrametric space, with the p-adic distance defined by

As a metric space, the p-adic numbers form the completion of the rational numbers equipped with the p-adic absolute value. This provides another way for defining the p-adic numbers. However, the general construction of a completion can be simplified in this case, because the metric is defined by a discrete valuation (in short, one can extract from every Cauchy sequence a subsequence such that the differences between two consecutive terms have strictly decreasing absolute values; such a subsequence is the sequence of the partial sums of a p-adic series, and thus a unique normalized p-adic series can be associated to every equivalence class of Cauchy sequences; so, for building the completion, it suffices to consider normalized p-adic series instead of equivalence classes of Cauchy sequences).

As the metric is defined from a discrete valuation, every open ball is also closed. More precisely, the open ball equals the closed ball where v is the least integer such that Similarly, where w is the greatest integer such that

This implies that the p-adic numbers form a locally compact space, and the p-adic integers—that is, the ball —form a compact space.

The quotient ring may be identified with the ring of the integers modulo This can be shown by remarking that every p-adic integer, represented by its normalized p-adic series, is congruent modulo with its partial sum whose value is an integer in the interval A straightforward verification shows that this defines a ring isomorphism from to

The inverse limit of the rings is defined as the ring formed by the sequences such that and for every i.

The mapping that maps a normalized p-adic series to the sequence of its partial sums is a ring isomorphism from to the inverse limit of the This provides another way for defining p-adic integers (up to an isomorphism).

This definition of p-adic integers is specially useful for practical computations, as allowing building p-adic integers by successive approximations.

For example, for computing the p-adic (multiplicative) inverse of an integer, one can use Newton's method, starting from the inverse modulo p; then, each Newton step computes the inverse modulo from the inverse modulo

The same method can be used for computing the p-adic square root of an integer that is a quadratic residue modulo p. This seems to be the fastest known method for testing whether a large integer is a square: it suffices to test whether the given integer is the square of the value found in . Applying Newton's method to find the square root requires to be larger than twice the given integer, which is quickly satisfied.

Hensel lifting is a similar method that allows to "lift" the factorization modulo p of a polynomial with integer coefficients to a factorization modulo for large values of n. This is commonly used by polynomial factorization algorithms.

There are several different conventions for writing p-adic expansions. So far this article has used a notation for p-adic expansions in which powers of p increase from right to left. With this right-to-left notation the 3-adic expansion of 1⁄5, for example, is written as

When performing arithmetic in this notation, digits are carried to the left. It is also possible to write p-adic expansions so that the powers of p increase from left to right, and digits are carried to the right. With this left-to-right notation the 3-adic expansion of 1⁄5 is

p-adic expansions may be written with other sets of digits instead of {0, 1, ..., *p* − 1}. For example, the 3-adic expansion of ^{1}/_{5} can be written using balanced ternary digits {__1__,0,1} as

In fact any set of p integers which are in distinct residue classes modulo p may be used as p-adic digits. In number theory, Teichmüller representatives are sometimes used as digits.^{[3]}

**Quote notation** is a variant of the p-adic representation of rational numbers that was proposed in 1979 by Eric Hehner and Nigel Horspool for implementing on computers the (exact) arithmetic with these numbers.^{[4]}

Both and are uncountable and have the cardinality of the continuum.^{[5]} For this results from the p-adic representation, which defines a bijection of on the power set For this results from its expression as a countably infinite union of copies of :

**Q**_{p} contains **Q** and is a field of characteristic 0.

Because 0 can be written as sum of squares,^{[6]} **Q**_{p} cannot be turned into an ordered field.

**R** has only a single proper algebraic extension: **C**; in other words, this quadratic extension is already algebraically closed. By contrast, the algebraic closure of **Q**_{p}, denoted has infinite degree,^{[7]} that is, **Q**_{p} has infinitely many inequivalent algebraic extensions. Also contrasting the case of real numbers, although there is a unique extension of the p-adic valuation to the latter is not (metrically) complete.^{[8]}^{[9]} Its (metric) completion is called **C**_{p} or Ω_{p}.^{[9]}^{[10]} Here an end is reached, as **C**_{p} is algebraically closed.^{[9]}^{[11]} However unlike **C** this field is not locally compact.^{[10]}

**C**_{p} and **C** are isomorphic as rings, so we may regard **C**_{p} as **C** endowed with an exotic metric. The proof of existence of such a field isomorphism relies on the axiom of choice, and does not provide an explicit example of such an isomorphism (that is, it is not constructive).

If **K** is a finite Galois extension of **Q**_{p}, the Galois group is solvable. Thus, the Galois group is prosolvable.

**Q**_{p} contains the n-th cyclotomic field (*n* > 2) if and only if *n* | *p* − 1.^{[12]} For instance, the n-th cyclotomic field is a subfield of **Q**_{13} if and only if *n* = 1, 2, 3, 4, 6, or 12. In particular, there is no multiplicative p-torsion in **Q**_{p}, if *p* > 2. Also, −1 is the only non-trivial torsion element in **Q**_{2}.

Given a natural number k, the index of the multiplicative group of the k-th powers of the non-zero elements of **Q**_{p} in is finite.

The number e, defined as the sum of reciprocals of factorials, is not a member of any p-adic field; but *e*^{ p} ∈ **Q**_{p} (*p* ≠ 2). For *p* = 2 one must take at least the fourth power.^{[13]} (Thus a number with similar properties as e — namely a p-th root of *e ^{p}* — is a member of for all p.)

Helmut Hasse's local–global principle is said to hold for an equation if it can be solved over the rational numbers if and only if it can be solved over the real numbers and over the p-adic numbers for every prime p. This principle holds, for example, for equations given by quadratic forms, but fails for higher polynomials in several indeterminates.

Main article: Hensel lifting |