p-adic Numbers

We close with one of the strangest and most powerful ideas in number theory. What if "closeness" between two numbers wasn't measured by how far apart they sit on the number line — but by how many factors of a chosen prime p hide inside their difference?

That single change of perspective builds an entirely different number system: the p-adic numbers. In it, a number like 1{,}000{,}000 can be "close" to 0 if p = 2 — because 1{,}000{,}000 = 2^{6}\cdot 15{,}625 has a healthy power of 2 buried inside it. Ordinarily a million feels enormous and enormously far from zero. p-adically, that hidden 2^6 already makes it noticeably closer to zero than a typical odd number half its size.

This isn't a party trick — it's a genuinely different, internally consistent geometry hiding inside the rational numbers, one prime at a time. Ordinary distance is built for measuring size (how big a number is). p-adic distance is built for measuring divisibility (how deeply a prime divides a number) — a completely different question that the ordinary number line was never designed to answer.

A new notion of size

Fix a prime p. The p-adic distance declares a number small when it is divisible by a high power of p — the opposite intuition from the ordinary number line, where small numbers just sit near zero regardless of their factors. So p, p^2, p^3, \dots march toward zero:

|p^{k}|_{p} = p^{-k} \longrightarrow 0 \quad\text{as } k \to \infty.

Modulo 5, the numbers 25 and 50 are "tiny" while 3 is "large" — even though 3 < 25 on the ordinary number line. This is a genuine distance — it satisfies an even stronger triangle inequality than the ordinary one — and completing the rationals with respect to it gives the field \mathbb{Q}_p of p-adic numbers, exactly as completing them the usual way gives \mathbb{R}.

There is one such field \mathbb{Q}_p for every prime p — infinitely many different, genuinely inequivalent ways to "complete" the same starting rationals, alongside the single familiar real-number completion. Ostrowski's theorem says that's actually the whole list: the ordinary absolute value and the p-adic absolute values (one per prime) are the only reasonable notions of distance the rational numbers support.

Worked example: how close are 7 and 32?

Take the two whole numbers 7 and 32. On the ordinary number line their distance is easy: |32 - 7| = 25 — not especially close.

Now measure 5-adically. The difference is 32 - 7 = 25 = 5^2, a number entirely made of factors of 5. That gives

|32 - 7|_5 = |5^2|_5 = 5^{-2} = \frac{1}{25}.

A p-adic distance of \tfrac{1}{25} is small — these two numbers, which look moderately far apart on the ordinary number line, are actually 5-adically close, precisely because their difference is divisible by a decent power of 5. Change the difference to something not divisible by 5 at all — say 7 and 9, difference 2 — and the two numbers are as 5-adically far apart as two numbers can possibly be, despite sitting right next to each other on the ordinary line.

Push it further: 7 and 32 + 125 = 157 differ by 150 = 2 \cdot 3 \cdot 5^2, still exactly two factors of 5, so they are just as 5-adically close as 7 and 32 were — even though 157 sits much further from 7 on the ordinary line than 32 does. p-adic closeness genuinely doesn't care how big the gap looks; it only cares how many factors of p are hiding inside it.

Worked example: a strange home for -1

p-adic arithmetic can produce expansions that look outright impossible in ordinary decimal notation. Work 5-adically and consider the infinite string of digits \dots 4444_5 (an unending row of 4s, reading leftward forever). Add 1 to it the way you'd add any number, carrying as you go:

\dots 4444_5 + 1 = \dots 0000_5 = 0.

Every 4 becomes a 0 with a carry, forever, so the sum is exactly 0 — which means \dots 4444_5 is a perfectly legitimate, convergent p-adic representation of -1. Negative numbers, which have no finite place in an expansion built from non-negative digits 0 \le a_i < p, slot in neatly as infinite ones. The p-adic numbers don't need a minus sign bolted on from outside — negativity is already built into the arithmetic of infinite expansions.

Numbers as infinite expansions

Just as reals have decimal expansions going infinitely to the right, p-adic numbers have expansions in powers of p going infinitely to the left:

x = a_0 + a_1 p + a_2 p^2 + a_3 p^3 + \cdots, \qquad 0 \le a_i < p.

These series converge p-adically because the terms shrink — each extra term is a higher and higher power of p, and higher powers of p are p-adically tinier and tinier. The arithmetic stitches together all the congruences modulo p, p^2, p^3, \dots at once — a p-adic integer is precisely a coherent choice of residue to every power of p, all agreeing with each other simultaneously.

Why bother: solving equations everywhere at once

Here's the payoff. Ordinarily, checking whether an equation has a solution modulo p, then modulo p^2, then modulo p^3, and so on forever, sounds like an endless chore. p-adic numbers turn that whole infinite checklist into a single question: does the equation have a solution in \mathbb{Q}_p? Tools like Hensel's lemma let a solution modulo p often be "lifted" automatically to a full p-adic solution, all congruences satisfied at once.

Here is Hensel's lemma actually doing work. The equation x^2 \equiv 2 \pmod 7 has the solution x \equiv 3, since 3^2 = 9 \equiv 2. Hensel's lemma guarantees that solution "lifts" to modulo 49 = 7^2: writing x = 3 + 7t and solving for t gives t \equiv 1 \pmod 7, so x = 10 satisfies x^2 = 100 \equiv 2 \pmod{49}. Keep going forever — modulo 343, modulo 2401, and so on — and the lifted digits assemble into an honest 7-adic number x \in \mathbb{Q}_7 with x^2 = 2 exactly. The rationals have no square root of 2, but \mathbb{Q}_7 does.

Hasse's local–global principle pushes this further: for certain equations, a solution exists in the rationals if and only if one exists in \mathbb{R} and in every \mathbb{Q}_p — solve it everywhere "locally" (one prime, or the reals, at a time) and you've solved it "globally" (over the rationals themselves). Hasse proved this exactly for quadratic forms (the Hasse–Minkowski theorem): an equation like ax^2 + by^2 = cz^2 has a rational solution precisely when it has a real solution and a p-adic solution for every single prime p — infinitely many conditions, all individually easy to check, that together settle the question completely.

It's worth being honest about the limits, too: the local–global principle is not a universal law of arithmetic — it holds for well-behaved families like quadratic forms, but there are more complicated equations (found by Selmer and others) that are solvable in \mathbb{R} and in every \mathbb{Q}_p yet have no rational solution at all. Measuring exactly when local-to-global reasoning succeeds and when it fails is itself an active area of modern number theory. With the principle in hand, though, number theory comes full circle: the divisibility and congruences we started with reappear as the very geometry of the p-adic world.

Ordinary number-line intuition is actively misleading here — import it and you will get p-adic closeness backwards.

Two numbers that sit right next to each other on the ordinary line can be p-adically as far apart as possible: 1 and 2 differ by 1, which has no factor of 2 at all, so |1-2|_2 = 1 — the largest a p-adic distance can be. Meanwhile, two numbers that are enormously far apart ordinarily can be p-adically almost on top of each other: 1 and 1 + 5^{10} differ by roughly nine million on the ordinary line, but 5-adically their distance is only 5^{-10} — tiny. Don't reach for ordinary-distance instincts in the p-adic world; they point the wrong way.

p-adic numbers aren't just an elegant curiosity — they are a cornerstone of modern algebraic number theory, and genuinely load-bearing machinery in one of the most famous proofs of the twentieth century. When Andrew Wiles finally proved Fermat's Last Theorem in 1994, his argument leaned heavily on p-adic Galois representations and p-adic analytic techniques (Iwasawa theory among them) to control elliptic curves and modular forms at every prime simultaneously.

A margin note from 1637 about whole-number powers ended up needing, three and a half centuries later, an entire number system built out of "closeness measured by shared prime factors." Very few ideas travel that far.

p-adic numbers keep showing up wherever number theorists need to control a problem "one prime at a time": p-adic L-functions, p-adic modular forms, and the whole machinery of Iwasawa theory all trace back to Hensel's original, almost throwaway idea of measuring size by divisibility instead of magnitude.