What are p-adic numbers?

I am not a number theorist, but I’ve always had a distant fascination with p-adic numbers. I have a list of “neat math topics” that I want to write about on my blog, and the p-adic numbers are on that list. So I was happy to see an interesting article about them by Andrew Rich called “Leftist numbers” in the November 2008 issue of the College Mathematics Journal.

The usual construction of p-adic numbers is pretty complicated for the nonexpert. But, here’s the idea in a nutshell.

The rational numbers. The set of rational numbers is the set of numbers that can be written as a fraction. Examples of rational numbers are 4, 13, 2.1, 22/7, 0.333333… The set of rational numbers has a lot of “holes” in it, and there are different ways of filling these holes.

The real numbers from the rational numbers. Our usual means of filling these holes creates the set of real numbers.  For example, we want the sequence of rational numbers 3, 3.1, 3.14, 3.141, 3.1415, 3.14159,… to converge, so we create a new number called \pi to be the limit point of this sequence. To make sense of this we need a notion of closeness, and we all know that two numbers are “close” if their decimals agree for a long way to the right.

The p-adic numbers from the rational numbers. We play a similar game to construct the p-adic numbers except that we choose a new notion of closeness. (When we speak about p-adic numbers, p is some specific number, usually a prime, and the digits of the number are 0,…,p-1.) Now we say that two numbers are “close” if their digits are the same for a long way to the left! So the 10-adic numbers 0.03, 0.53, 6.53, 96.53, 196.53, 1196.53, 21196.53,… are getting closer and closer together.

The real numbers have finitely many digits to the left of the decimal point and possibly infinitely many digits to the right of the decimal point. However, as we will see, the p-adic numbers can always be written with finitely many digits to the right of the decimal point and possibly infinitely many digits to the left of the decimal point (that is why Rich calls them “leftist numbers”). For example 33.333333… is not a 10-adic number, but …333333.33 is. In particular, the sequence given in the previous paragraph converges to some new 10-adic number …21196.53.

Here are some cool consequences of this construction.

1. Addition. We can add any two p-adic numbers. Here is a 10-adic example—add as usual, carry to the left. (Note that since addition proceeds right-to-left, it is a lot easier to add p-adic numbers with infinitely many digits than real numbers with infinitely many digits.)

\begin{array}{r}\ldots 222293.4 \\ +9.7 \\ \hline \ldots 222303.1\end{array}

2. Multiplication. Just like addition, multiplication of two p-adic numbers is possible, and is easier to carry out than for real numbers.

\begin{array}{r}\ldots 222293.4 \\ \times 9.7 \\ \hline \ldots 556053.8\\  \ldots 006406.\,\,\, \\ \hline\ldots 562459.8\\ \end{array}

3. Subtraction. There is no need for a negative sign (–) for negative numbers. For example, as a 10-adic number, we can express -16 as …999984. To justify, just observe that 16+(…999984)=0:

\begin{array}{r}\ldots 9999984 \\ +16 \\ \hline \ldots 0000000\end{array}

Similarly, it is possible to show that every p-adic number has such a “positive negation.” Thus we can always subtract by adding.

4. p-adic rationals. Every p-adic rational number can be written with finitely many digits to the right of the decimal point. For example, we usually think of 1/3 as 0.3333…, but in the 10-adic numbers we can express it as …666667. To justify, observe that (…666667)*3=1:

\begin{array}{r}\ldots 666667 \\ \times 3 \\ \hline \ldots 000001\end{array}

Moreover, as Rich shows in the article, a p-adic number is rational if, and only if, the digits are eventually repeating to the left of decimal point (which is a nice analog of the real case in which a number is rational if, and only if, it is eventually repeating to the right of the decimal point).

5. Division. What about division? As Rich shows in the article, it is often, but not always, possible to divide two 10-adic numbers. The trouble is that there can be two nonzero 10-adic numbers x and y such that xy=0. See the article for details. However, and here is the important point, if p is prime, then this cannot happen. When p is prime, every nonzero p-adic number has a reciprocal, and thus we can always divide two such numbers.

6. Ordering. Here’s a final curious fact about the p-adic numbers. We all know that if x and y are two non-equal real numbers then either x<y or y<x. However, there is no linear ordering of the p-adic numbers!

7. Mathematical gobbledygook. Here is a more mathematical way of saying all this. If p is prime then the p-adic numbers form a complete metric space containing the rational numbers (it is a completion of the rational numbers) and it is also a field. (Note that because of the division problem, when p is not prime, the p-adic numbers are not a field, but only a ring).

For more details, examples, and proofs, see Andrew Rich’s excellent article “Leftist numbers.”


  1. Oleg says:

    In my early years during study at the university, I often thought “Why geometrical space in which we live possesses such properties?”. Principles of construction of our space seemed to me not absolutely natural, complex and inconsistent. Why the God has created it such? Even Euclid could not understand with an axiom about parallel lines. In my opinion, our world as it was described in the Bhuddist’s books appears more correctly.
    Each entity in it is simultaneously a part and the whole of all world. Each point in it is the center of the world.
    At first sight for me, to present such a world in mathematical construction is difficultly. However absolutely casually I have read about p-adic numbers and I have understood, that the geometry of the world which is constructed on the p-adic metrics appears almost as it was described in Bhuddist rolls.
    Really in such a world, each point of a circle will be its center, and each triangle will be either equipotential or isosceles. I have been amazed. I have understood that human brain is able to construct the world with any geometrical properties and it will be not less real than that in which we live.
    I have decided to imagine what are the geometric properties of the world not distorted by our consciousness. I do not have sufficient mathematical education (I only the expert on computers). Therefore I scooped the ideas from religious doctrines and philosophies. I have suddenly understood, that the world was constructed on the basis of one simple principle and its geometry is very similar with geometry of the p-adic world with one exception. P-adic world is constructed by a hierarchical principle by virtue of its metrics defined as 1/p*k. In my model of the world, the metrics is defined by constant number and is equal 1. Each point of space in such a world is equidistant from all other points of the world and is also its center. As was said in the bible each of us is the God it is only necessary to become him. Each of us is Bhudda, it is only necessary to become him. And each of us is in the center of the world.

    It would like to find out your opinion in occasion of my ideas and if probably to receive a strict mathematical substantiation of properties of such a world. It seems to me, as the mathematician you can tell about it a lot of interesting.

    I am sorry for my English (my native language is Russian)

    Thank your for attention.

  2. Thank you for your interesting comment.

    From what I understand, you are asking what would happen if we thought of each number as being 1 unit away from every other number. Philosophically that has some interesting implications, but mathematically it is not that interesting.

    When we have a notion of distance between points (a “metric”) it generates a topology. That is, we have the notion of “open sets”—an open interval is an example of an open set on the real line. In the real number line, every open interval containing a point contains infinitely many other points. In a way this shows how the points on the real number line are glued together. It is what makes continuous functions interesting, for instance—nearby points map to nearby points.

    Your assumption of unit-distance between all points generates what is called the “discrete topology”. There are times when it is useful, but basically it means that (like the integers) each point is its own open set, and thus single points have no neighbors. From a topological standpoint it is not very interesting. We need nonempty open sets in order to get interesting mathematical structures.

    I hope this answers your question.

    Thank you for your comment!

  3. Oleg says:

    Thank you for your answers Dave.

    Luckily I have enough education to understand them:)
    But let me ask some questions, which nevertheless make me sleepless.
    1. Can we build some algebra on this set (with 1 unit metric).
    2. If yes. What kind of operations we’ll be able to define on such algebra: addition, substraction, division and so on?
    3. There will be zero(s), one(s), negative numbers in this algebra?

    About topology.
    1. Why in our world with 3 dimensions we can place only four points with 1 unit metric. To place fifth point we should go to fourth dimension and so on ad infinity? If we don’t want to go at fifth dim. we should collapse two (and more) points in one. Namely so, collapsing points or going in high dimensions could I imagine p-adic topology.
    2. Why should we so like continuous functions. Even Zenon suspected them from that old times:).

    About usefulness of this construction.
    1. Is not any information structure has at minimum p-adic topology ? There is a practical use of p-adic in time series exploration (ECG fo example).
    2. Is not particles in entangled state live in 1 unit metric world?

    Excuse me if my questions seems naive and unprofessional for you.

    Thank you.

    1. Oleg, These are all good questions. A set having a certain metric does not imply (or rule out) any arithmetic structure. To find out more about doing arithmetic on various sets check out books on abstract algebra.

      We study continuous functions because they preserve the topological structure—that is, we want nearby points to get sent to nearby points. If we do not assume that, then the functions are often very useful in practice.

      I’m afraid I don’t know the answers to your last few questions.

  4. sandra407 says:

    Hi! I was surfing and found your blog post… nice! I love your blog. :) Cheers! Sandra. R.

Comments are closed.