§ A motivation for p-adic analysis

I've seen the definitions of p-adic numbers scattered around on the internet, but this analogy as motivated by the book p-adic numbers by Fernando Gouvea really made me understand why one would study the p-adics, and why the definitions are natural. So I'm going to recapitulate the material, with the aim of having somoene who reads this post be left with a sense of why it's profitable to study the p-adics, and what sorts of analogies are fruitful when thinking about them. We wish to draw an analogy between the ring C[X]\mathbb C[X], where (Xα)(X - \alpha) are the prime ideals, and Z\mathbb Z where (p)(p) are the prime ideals. We wish to take all operations one can perform with polynomials, such as generating functions ( 1/(Xα)=1+X+X2+1/(X - \alpha) = 1 + X + X^2 + \dots ), taylor expansions (expanding aronund (Xα)(X - \alpha)), and see what their analogous objects will look like in Z\mathbb Z relative to a prime pp.

§ Perspective: Taylor series as writing in base pp:

Now, for example, given a prime pp, we can write any positive integer mm in base pp, as (m=i=0naipi)(m = \sum_{i=0}^n a_i p^i) where (0aip1)(0 \leq a_i \leq p - 1). For example, consider m=72,p=3m = 72, p = 3. The expansion of 72 is 72=0×1+0×3+2×32+2×3372 = 0\times 1 + 0 \times 3 + 2 \times 3^2 + 2 \times 3^3. This shows us that 72 is divisible by 323^2. This perspective to take is that this us the information local to prime pp, about what order the number mm is divisible by pp, just as the taylor expansion tells us around (Xα)(X - \alpha) of a polynomial P(X)P(X) tells us to what order P(X)P(X) vanishes at a point α\alpha.

§ Perspective: rational numbers and rational functions as infinite series:

Now, we investigate the behaviour of expressions such as
  • P(X)=1/(1+X)=1X+X2X3+P(X) = 1/(1+X) = 1 - X + X^2 -X^3 + \dots.
We know that the above formula is correct formally from the theory of generating functions. Hence, we take inspiration to define values for rational numbers . Let's take p3p \equiv 3, and we know that 4=1+3=1+p4 = 1 + 3 = 1 + p. We now calculate 1/41/4 as:
1/4=1/(1+p)=1p+p2p3+p4p5+p6+ 1/4 = 1/(1+p) = 1 - p + p^2 - p^3 + p^4 - p^5 + p^6 + \cdots
However, we don't really know how to interpret (1p)(-1 \cdot p), since we assumed the coefficients are always non-negative. What we can do is to rewrite p2=3pp^2 = 3p, and then use this to make the coefficient positive. Performing this transformation for every negative coefficient, we arrive at:
1/4=1/(1+p)=1p+p2p3+p4+=1+(p+3p)+(p3+3p3)+=1+2p+2p3+ \begin{aligned} 1/4 &= 1/(1+p) = 1 - p + p^2 - p^3 + p^4 + \cdots \\ &= 1 + (- p + 3p) + (- p^3 + 3p^3) + \cdots \\ &= 1 + 2p + 2p^3 + \cdots \end{aligned}
We can verify that this is indeed correct, by multiplying with 4=(1+p)4 = (1 + p) and checking that the result is 11:
(1+p)(1+2p+2p3+)=(1+p)+(2p+2p2)+(2p3+2p4)+=1+3p+2p2+2p3+2p4+(Rewrite 3p=pp=p2)=1+(p2+2p2)+2p3+2p4+=1+3p2+2p3+2p4+(Rewrite 3p2=p3 and collect p3)=1+3p3+2p4+=1+3p4+=1+=1 \begin{aligned} &(1 + p)(1 + 2p + 2p^3 + \cdots) \\ &= (1 + p) + (2p + 2p^2) + (2p^3 + 2p^4) + \cdots \\ &= 1 + 3p + 2p^2 + 2p^3 + 2p^4 + \cdots \\ &\text{(Rewrite $3p = p \cdot p = p^2$)} \\ &= 1 + (p^2 + 2p^2) + 2p^3 + 2p^4 + \cdots \\ &= 1 + 3p^2 + 2p^3 + 2p^4 + \cdots \\ &\text{(Rewrite $3p^2 = p^3$ and collect $p^3$)} \\ &= 1 + 3p^3 + 2p^4 + \cdots \\ &= 1 + 3p^4 + \cdots \\ &= 1 + \cdots = 1 \end{aligned}
What winds up happening is that all the numbers after 11 end up being cleared due to the carrying of (3pipi+1)(3p^i \mapsto p^{i+1}). This little calculation indicates that we can also define take the pp-adic expansion of rational numbers .

§ Perspective: -1 as a p-adic number

We next want to find a p-adic expansion of -1, since we can then expand out theory to work out "in general". The core idea is to "borrow" pp, so that we can write -1 as (p1)p(p - 1) - p, and then we fix p-p, just like we fixed 1-1. This eventually leads us to an infinite series expansion for 1-1. Written down formally, the calculation proceeds as:
1=1+pp(borrow p, and subtract to keep equality)=(p1)p(Now we have a problem of p)=(p1)p+p2p2=(p1)+p(p1)p2=(p1)+p(p1)p2+p3p3=(p1)+p(p1)+p2(p1)p3(Generalizing the above pattern)1=(p1)+p(p1)+p2(p1)+p3(p1)+p4(p1)+ \begin{aligned} -1 &= -1 + p - p \qquad \text{(borrow $p$, and subtract to keep equality)} \\ &= (p - 1) - p \qquad \text{(Now we have a problem of $-p$)} \\ &= (p - 1) - p + p^2 - p^2 \\ &= (p - 1) + p(p - 1) - p^2 \\ &= (p - 1) + p(p - 1) - p^2 + p^3 - p^3 \\ &= (p - 1) + p(p - 1) + p^2(p - 1) - p^3 \\ &\text{(Generalizing the above pattern)} \\ -1 &= (p - 1) + p(p - 1) + p^2(p - 1) + p^3(p - 1) + p^4(p - 1) + \cdots \\ \end{aligned}
This now gives us access to negative numbers, since we can formally multiply the series of two numbers, to write a=1a-a = -1 \cdot a. Notice that this definition of 1-1 also curiously matches the 2s complement definition, where we have 1=111-1 = 11\dots 1. In this case, the expansion is infinite , while in the 2s complement case, it is finite. I would be very interested to explore this connection more fully.

§ What have we achieved so far?

We've now managed to completely reinterpret all the numbers we care about in the rationals as power series in base pp. This is pretty neat. We're next going to try to complete this, just as we complete the rationals to get the reals. We're going to show that we get a different number system on completion, called Qp\mathbb Q_p. To perform this, we first look at how the pp-adic numbers help us solve congruences mod p, and how this gives rise to completions to equations such as x22=0x^2 - 2 = 0, which in the reals give us x=2x = \sqrt 2, and in Qp\mathbb Q_p give us a different answer!

§ Solving X225mod3nX^2 \equiv 25 \mod 3^n

Let's start by solving an equation we already know how to solve: X225mod3nX^2 \equiv 25 \mod 3^n. We already know the solutions to X225mod3nX^2 \equiv 25 \mod 3^n in Z\mathbb Z are X±5mod3nX \equiv \pm 5 \mod 3^n. Explicitly, the solutions are:
  • X3mod3X \equiv 3 \mod 3
  • X5mod9X \equiv 5 \mod 9
  • X5mod27X \equiv 5 \mod 27
  • At this point, the answer remains constant.
This was somewhat predictable. We move to a slightly more interesting case.

§ Solving X=5mod3nX = -5 \mod 3^n

The solution sets are:
  • X51mod3X \equiv -5 \equiv 1 \mod 3
  • X54=1+3mod9X \equiv -5 \equiv 4 = 1 + 3 \mod 9
  • X522=1+3+29mod27X \equiv -5 \equiv 22 = 1 + 3 + 2 \cdot 9 \mod 27
  • X576=1+3+29+227mod81X \equiv -5 \equiv 76 = 1 + 3 + 2 \cdot 9 + 2 \cdot 27 \mod 81
This gives us the infinite 3-adic expansion:
  • X=5=1+13+232+233+X = -5 = 1 + 1\cdot 3 + 2\cdot 3^2 + 2\cdot 3^3 + \dots
Note that we can't really predict the digits in the 3-adic sequence of -5, but we can keep expanding and finding more digits. Also see that the solutions are "coherent". In that, if we look at the solution mod 9, which is 44, and then consider it mod 3, we get 11. So, we can say that given a sequence of integers 0αnpn10 \leq \alpha_n \leq p^n - 1, αn\alpha_n is p-adically coherent sequence iff:
  • αn+1=αnmodpn \alpha_{n+1} = \alpha_n \mod p^n.

§ Viewpoint: Solution sets of X2=25mod3nX^2 = 25 \mod 3^n

Since our solution sets are coherent, we can view the solutions as a tree, with the expansions of X=5,X=5mod3X = 5, X = -5 \mod 3 and then continuing onwards from there. That is, the sequences are
  • 25552 \rightarrow 5 \rightarrow 5 \rightarrow 5 \rightarrow \dots
  • 1422761 \rightarrow 4 \rightarrow 22 \rightarrow 76 \rightarrow \dots

§ Solving X22mod7nX^2 \equiv 2 \mod 7^n

We now construct a solution to the equation X2=1X^2 = 1 in the 7-adic system, thereby showing that Qp\mathbb Q_p is indeed strictly larger than Q\mathbb Q, since this equation does not have rational roots. For n=1n=1, we have the solutions as X3mod7X \equiv 3 \mod 7, X43mod7X \equiv 4 \equiv -3 \mod 7. To find solutions for n=2n = 2, we recall that we need our solutions to be consistent with those for n=1n = 1. So, we solve for:
  • (3+7k)2=2mod49(3 + 7k)^2 = 2 \mod 49, (4+7k)2=2mod49(4 + 7k)^2 = 2 \mod 49.
Solving the first of these:
(3+7k)22mod499+42k+49k22mod499+42k+0k22mod497+42k0mod491+6k0mod49k1mod49 \begin{aligned} (3 + 7k)^2 &\equiv 2 \mod 49 \\ 9 + 42 k + 49k^2 &\equiv 2 \mod 49 \\ 9 + 42 k + 0k^2 &\equiv 2 \mod 49 \\ 7 + 42 k &\equiv 0 \mod 49 \\ 1 + 6 k &\equiv 0 \mod 49 \\ k &\equiv 1 \mod 49 \end{aligned}
This gives the solution X10mod49X \equiv 10 \mod 49. The other branch ( X=4+7kX = 4 + 7k) gives us X3910mod49X \equiv 39 \equiv -10 \mod 49. We can continue this process indefinitely ( exercise ), giving us the sequences:
  • 31010821663 \rightarrow 10 \rightarrow 108 \rightarrow 2166 \rightarrow \dots
  • 4392352354 \rightarrow 39 \rightarrow 235 \rightarrow 235 \rightarrow \dots
We can show that the sequences of solutions we get satisfy the equation X2=2mod7X^2 = 2 \mod 7. This is so by construction. Hence, Q7\mathbb Q_7 contains a solution that Q\mathbb Q does not, and is therefore strictly bigger, since we can already represent every rational in Q\mathbb Q in Q7\mathbb Q_7.

§ Use case: Solving X=1+3XX = 1 + 3X as a recurrence

Let's use the tools we have built so far to solve the equation X=1+3XX = 1 + 3X. Instead of solving it using algebra, we look at it as a recurrence Xn+1=1+3XnX_{n+1} = 1 + 3X_n. This gives us the terms:
  • X0=1X_0 = 1
  • X1=1+3X_1 = 1 + 3
  • X2=1+3+32X_2 = 1 + 3 + 3^2
  • Xn=1+3++3nX_n = 1 + 3 + \dots + 3^n
In R\mathbb R, this is a divergent sequence. However, we know that the solution so 1+X+X2+=1/(1X)1 + X + X^2 + \dots = 1/(1-X), at least as a generating function. Plugging this in, we get that the answer should be:
  • 1/(13)=1/21/(1 - 3) = -1/2
which is indeed the correct answer. Now this required some really shady stuff in R\mathbb R. However, with a change of viewpoint, we can explain what's going on. We can look at the above series as being a series in Q3\mathbb Q_3. Now, this series does really converge, and by the same argument as above, it converges to 1/2-1/2. The nice thing about this is that a dubious computation becomes a legal one by changing one's perspective on where the above series lives.

§ Viewpoint: 'Evaluation' for p-adics

The last thing that we need to import from the theory of polynomials is the ability to evaluate them: Given a rational function F(X)=P(X)/Q(X)F(X) = P(X)/Q(X), where P(X),Q(X)P(X), Q(X) are polynomials, we can evaluate it at some arbitrary point x0x_0, as long as x0x_0 is not a zero of the polynomial Q(X)Q(X). We would like a similar function, such that for a fixed prime pp, we obtain a ring homomorphism from QFpx\mathbb Q \rightarrow \mathbb F_p^x, which we will denote as p(x0)p(x_0), where we are imagining that we are "evaluating" the prime pp against the rational x0x_0. We define the value of x0=a/bx_0 = a/b at the prime pp to be equal to ab1modpab^{-1} \mod p, where bb11modpb b^{-1} \equiv 1 \mod p. That is, we compute the usual ab1ab^{-1} to evaluate a/ba/b, except we do this (modp)(\mod p), to stay with the analogy. Note that if b0modpb \equiv 0 \mod p, then we cannot evaluate the rational a/ba/b, and we say that a/ba/b has a pole at pp. The order of the pole is the number of times pp occurs in the prime factorization of bb. I'm not sure how profitable this viewpoint is, so I asked on math.se , and I'll update this post when I recieve a good answer.

§ Perspective: Forcing the formal sum to converge by imposing a new norm:

So far, we have dealt with infinite series in base pp, which have terms pi,i0p^i, i \geq 0. Clearly, these sums are divergent as per the usual topology on Q\mathbb Q. However, we would enjoy assigning analytic meaning to these series. Hence, we wish to consider a new notion of the absolute value of a number, which makes it such that pip^i with large ii are considered small. We define the absolute value for a field KK as a function :KR|\cdot |: K \rightarrow \mathbb R. It obeys the axioms:
  1. x=0    x=0\lvert x \rvert = 0 \iff x = 0
  2. xy=xy\lvert xy \rvert = \lvert x \rvert \lvert y \rvert for all x,yKx, y \in K
  3. x+yx+y\lvert x + y \rvert \leq \lvert x \rvert + \lvert y \rvert, for all x,yKx, y \in K.
We want the triangle inequality so it's metric-like, and the norm to be multiplicative so it measures the size of elements. The usual absolute value xx:x0;x: otherwise\lvert x \rvert \equiv \\{ x : x \geq 0; -x : ~ \text{otherwise} \\} satisfies these axioms. Now, we create a new absolute value that measures primeness. We first introduce a gadget known as a valuation, which measures the pp-ness of a number. We use this to create a norm that makes number smaller as their pp-ness increases. This will allow infinite series in pip^i to converge.

§ p-adic valuation: Definition

First, we introduce a valuation vp:Z0Rv_p: \mathbb Z - \\{0\\} \rightarrow \mathbb R, where vp(n)v_p(n) is the power of the prime pip^i in the prime factorization of nn. More formally, vp(n)v_p(n) is the unique number such that:
  • n=pvp(n)mn = p^{v_p(n)} m, where pmp \nmid m.
  • We extend the valuation to the rationals by defining vp(a/b)=vp(a)vp(b)v_p(a/b) = v_p(a) - v_p(b).
  • We set vp(0)=+v_p(0) = +\infty. The intuition is that 00 can be divided by ppan infinite number of times.
The valuation gets larger as we have larger powers of pp in the prime factorization of a number. However, we want the norm to get smaller . Also, we need the norm to be multiplicative, while vp(nm)=vp(n)+vp(m)v_p(nm) = v_p(n) + v_p(m), which is additive. To fix both of these, we create a norm by exponentiating vpv_p. This converts the additive property into a multiplicative property. We exponentiate with a negative sign so that higher values of vpv_p lead to smaller values of the norm.

§ p-adic abosolute value: Definition

Now, we define the p-adic absolute value of a number nn as nppvp(n)|n|_p \equiv p^{-v_p(n)}.
  • the norm of 00 is pvp(0)=p=0p^{-v_p(0)} = p^{-\infty} = 0.
  • If pvp(n)=0p^{-v_p(n)} = 0, then vp(n)=logp0=-v_p(n) = \log_p 0 = -\infty, and hence n=0n = 0.
  • The norm is multiplicative since vpv_p is additive.
  • Since vp(x+y)min(vp(x),vp(y)),x+ypmax(xp,yp)xp+ypv_p(x + y) \geq \min (v_p(x), v_p(y)), |x + y|_p \leq max(|x|_p, |y|_p) \leq |x|_p + |y|_p. Hence, the triangle inequality is also satisfied.
So np|n|_p is indeed a norm, which measures pp-ness, and is smaller as ii gets larger in the power pip^i of the factorization of nn, causing our infinite series to converge. There is a question of why we chose a base pp for np=pvp(n)|n|_p = p^{v_p(n)}. It would appear that any choice of np=cvp(n),c>1|n|_p = c^{v_p(n)}, c > 1 would be legal. I asked this on math.se, and the answer is that this choosing a base pp gives us the nice formula
xZ,{p:p is prime}{}xp=1 \forall x \in \mathbb Z, \prod_{\{p : p~\text{is prime}\} \cup \{ \infty \}} |x|_p = 1
That is, the product of all pp norms and the usual norm (denoted by x\lvert x \rvert_\infty ) give us the number 1. The reason is that the xp \lvert x\rvert_p give us multiples pvp(x)p^{-v_p(x)}, while the usual norm x\lvert x \rvert_\infty contains a multiple pvp(x)p^{v_p(x)}, thereby cancelling each other out.

§ Conclusion

What we've done in this whirlwind tour is to try and draw analogies between the ring of polynomials C[X]\mathbb C[X] and the ring Z\mathbb Z, by trying to draw analogies between their prime ideals: (Xα)(X - \alpha) and (p)(p). So, we imported the notions of generating functions, polynomial evaluation, and completions (of Q\mathbb Q) to gain a picture of what Qp\mathbb Q_p is like. We also tried out the theory we've built against some toy problems, that shows us that this point of view maybe profitable. If you found this interesting, I highly recommend the book p-adic numbers by Fernando Gouvea .