# A Baby's Guide to the p-adic Number System.

Updated: Jun 27, 2020

I am sitting in a *commutative algebra* class this semester and one of the things which I really appreciate about Daniel, our professor, is that he often starts explaining a proof or an idea with the word '*Imagine*' -- "Imagine that *x* is a real number...". Now, people who have some experience with sitting in math classes will probably find this different. At least, I am used to listening instead, "ok, let us *assume* that *x* is a real number". Students who are new to learning proofs in math often complain "oh!, but how can we just *assume* something!". So, Daniel's way got me thinking. Using the word 'imagine' perhaps fixes this problem. Speaking broadly, it lays emphasis on the fact that in addition to logic, reasoning and computation, mathematics is about imagination and creativity, something which many don't realize.

In honor of my algebra class, let's imagine today, a new universe. A universe, where we are free to operate a little bit differently than the usual. In this blog post, we aim to introduce the readers to something known as the *p*-adic numbers. These are mathematical objects that mathematicians, especially number theorists love to work with. Although, understanding them requires some exposure to graduate level mathematics and much sophistication, via this exposition, our goal is to give a flavor of how mathematicians think and create new mathematics. So hold on to your seatbelts and enjoy the new ideas as we go! However, our ride starts from the basics and we first need to make sure that we have them in order to go beyond the mundane.

** Numbers as we know them.**

Let's begin by diving into the simplest of the objects in mathematics -- our very own *integers*.

We express every integer *uniquely* in base 10. For example,

This is the way we write our numbers as we know them -- in base 10. Let's move a step forward. How about the rational numbers ? These are the fractions which we obtain by dividing the integers. We know that rational numbers have a terminating or a repeating decimal expansion. For example, 105/4 = 21.25 and 10/3 = 3.33333. . . . are both rational numbers. We do the same as above for these but now we have *negative* powers of 10.

Notice that 21.25 has a finite "polynomial expansion" while 3.3333. . . keeps going on and on... and on... with higher negative powers of 10. By now you must have guessed that there is nothing special about the rational numbers and in fact *every* real number can be expressed as a "polynomial" in powers of 10. For example,

** The idea of distance and convergence.**

Now that we have encountered an infinite sum, let's dig a little bit deeper to see how to think about them. Let's start with a simple infinite sum:

1 + 2 + 3 + 4 + 5 + 6 + 7 + . . . .

Well, we can break the infinite sum into pieces to start computing: 1 + 2 = 3, 1 + 2 + 3 = 6, 1 + 2 + 3 + 4 = 10 and so on. If we keep adding numbers one by one, the sum explodes. That is, it *diverges* to infinity. But what about the infinite sum we encountered in the previous section ?

Let's do the same with this one. Break it into pieces and compute.

As we keep going, we get "closer and closer" to 3.33333. . . . With each step, we see that the "distance'' of the finite sum from 10/3 = 3.3333. . . . is decreasing. In such a case, we say that the infinite "sequence" 3.3,3.33, 3.333, . . . . "converges" to the rational number 10/3.

I want to emphasize here that the notion of convergence relies on the idea of "distance" between numbers. In the world we live in, we have a natural way of defining the distance between any two numbers. The distance between 3 and 5 is 2, between 7 and -1 is 8 and so on. Keep this in mind as we will come back to it later.

Let's do a quick summary of the journey so far: we started off by writing integers as polynomials in powers of 10, then moved on to expressing rational and real numbers as polynomial expansions by allowing negative powers of 10. Oh! and we have to be careful while dealing with infinite sums. But with the idea of convergence in hand, we have the power to make sense of such infinite series and work with them formally.

** Building a new number system.**

Alright, now comes the part where we will take a giant leap in our imagination. Let *p* be a prime number. What if instead of base 10, we start by writing the integers in base *p *? Let's go ahead and do it for *p *= 3. For example:

Same idea as base 10-- write every integer as a finite polynomial instead in powers of 3.

Now, we want to take this one step further. Let's see if we can think about rational numbers in base 3. Let us try and do it for -1/2. We write:

Readers might recognize this as the geometric series formula we learnt back in high school. Of course, the above expression is complete nonsense in our usual universe. However, we are now operating in a different universe where everything works peculiarly. To convince you that the above expression makes sense, at least formally, let's multiply this infinite expansion with -2 = 1-3 and see what do we get. We write *p* = 3 so that there is slightly less confusion.

When we keep going on indefinitely, the higher powers of 3 "cancel" magically far towards the right.

** Measuring distances in the unknown universe.**

As we saw before, in case of the rational and the real numbers, infinite sums required to be handled carefully. How do we make sense of the infinite series above in this unknown universe ? Back in our world, this would certainly diverge. Well, recall that convergence of an infinite sum relies on the idea of distances. Turns out we have a completely new way of measuring distances in this universe which fits in the formal setup mathematicians work with.

Back to our base 3 system -- I'll give some intuition on the new way to measure numbers. A number in this system is "small" if a higher power of 3 divides it. Write *p = 3*. In this new set up, we will see that the infinite sum of powers of *p* converges.

Same trick -- break into pieces and see if the "distance" is decreasing.

For the first truncation, the difference between the infinite sum and *1+p* is divisible by the second power of *p*. Similarly, as we subtract the bigger pieces, we see that that the difference becomes divisible by higher powers of *p*. And so the distance is indeed decreasing!

** This is the p-adic number system**

Things may be becoming a little hard to digest by now. But the journey is almost complete. I want to conclude by telling you what have we done till now. We started with a new idea by writing every integer as a polynomial in powers of 3 and then we extended this to the rationals. With the aid of a new idea of distance, we were able to make sense of *infinite *polynomials in powers of 3.

To sum it up -- *every number in the 3-adic number system looks like a "polynomial" in powers of 3. *This complete system of numbers which we just built is called the *3-adic number system*. Certainly, there is nothing special about 3 and we can work with the *p*-adic number system for any prime *p*.

** Why are the p-adics so cute?**

One major problem in mathematics is to find integer or rational solutions to polynomial equations. For instance, if we look at the equation of a circle of radius 1 -- does it have integer solutions? Well, indeed we can see 4 solutions which are integers right away. But what if someone throws at you a complicated equation in four variables given below? Does this have a rational solution?

Turns out it does! Now, this may sound easy. However, looking for solutions to equations in our universe or even showing that a solution exists is very tough, but looking for solutions in the *p*-adic universe is not so bad. One beautiful theorem in mathematics tells us that in order to find integer solutions for *certain* equations, we have to go look for solutions in the *p*-adic universe. If we are able to find a solution there, we can be sure that there exists a rational solution.

Another very cute thing about the *p-*adics universe -- back in school we learnt that the sum of the distance between two sides of a triangle is always greater than the third side. This is really a property of the way we measure distances in the real world. However, in the *p-*adic number system, something fun happens. Keeping in mind that we here measure distances in a different way -- every triangle turns out to be isosceles!

**Wait... what?**

You might have this unsatisfied feeling right now because I left many questions unanswered and shoved many ideas under the rug by casually throwing them at you. But I assure you, we just dived into a beautiful theory in mathematics which lies at the intersection of two broad areas of math called *analysis* and *number theory*. Of course, we have a completely rigorous way to think about these ideas which take time to learn and imbibe. However, as a start, all you have to do is *Imagine*.