Ma · Mathematics

How to Visualize p-adic Numbers

Published By the 9to5Science editorial team

At a glance

  1. 1. Start with digits

    Write a p-adic integer as an infinite base-p digit string, with the least significant digit first.

  2. 2. Build the tree

    Group strings by their first digit, then by their first two digits, producing a rooted p-ary tree.

  3. 3. Read distances

    Two numbers are close when their digit strings agree for many initial digits.

  4. 4. Add scales

    Visualize all of Q_p by attaching scaled copies of the p-adic integer tree for different powers of p.

For a prime pp, a p-adic number is difficult to picture on the ordinary real number line because p-adic distance measures similarity of low-order base-pp digits, not the size of a real-number difference. The most useful visualization is therefore not a line but a branching tree of nested residue classes.

The basic picture is especially clear for the ring of p-adic integers, denoted by Zp\mathbb{Z}_p. The full field Qp\mathbb{Q}_p can then be built by adding powers of pp and translating the same structure.

p-adic numbers as digit strings

Every p-adic integer has an expansion

x=a0+a1p+a2p2+a3p3+⋯ ,x=a_0+a_1p+a_2p^2+a_3p^3+\cdots,

where each digit satisfies ai∈{0,1,…,p−1}a_i\in\{0,1,\ldots,p-1\}. Unlike an ordinary decimal expansion, this expansion extends indefinitely toward higher powers of pp while still defining a valid p-adic number.

The first digit a0a_0 is the residue modulo pp. The first two digits determine the residue modulo p2p^2, the first three determine the residue modulo p3p^3, and so on. Thus an infinite p-adic integer can be viewed as an infinite sequence

(a0,a1,a2,…).(a_0,a_1,a_2,\ldots).

The order is worth noticing: a0a_0 is the units digit, so it comes first when measuring p-adic closeness.

The rooted p-ary tree

Make one root representing all of Zp\mathbb{Z}_p. Split it into pp branches according to the value of a0a_0:

Zp=⋃a0=0p−1(a0+pZp).\mathbb{Z}_p=\bigcup_{a_0=0}^{p-1}(a_0+p\mathbb{Z}_p).

Each branch is then split into pp smaller branches according to a1a_1. After nn levels, the branches correspond to the residue classes modulo pnp^n:

a0+a1p+⋯+an−1pn−1+pnZp.a_0+a_1p+\cdots+a_{n-1}p^{n-1}+p^n\mathbb{Z}_p.

Every infinite path from the root chooses one digit at each level and therefore represents exactly one element of Zp\mathbb{Z}_p.

For example, when p=3p=3, the first split has the three branches

0+3Z3,1+3Z3,2+3Z3.0+3\mathbb{Z}_3,\qquad 1+3\mathbb{Z}_3,\qquad 2+3\mathbb{Z}_3.

The branch beginning with digit 11 splits into

1+9Z3,4+9Z3,7+9Z3,1+9\mathbb{Z}_3,\qquad 4+9\mathbb{Z}_3,\qquad 7+9\mathbb{Z}_3,

corresponding to the second digit 00, 11, or 22. Continuing indefinitely gives a ternary tree.

Why shared digits mean closeness

For a nonzero rational number x=a/bx=a/b, where aa and bb are nonzero integers, define

vp(x)=vp(a)−vp(b),v_p(x)=v_p(a)-v_p(b),

where, for a nonzero integer mm, vp(m)v_p(m) is the largest nonnegative integer kk such that pk∣mp^k\mid m. This valuation extends to Qp\mathbb{Q}_p. The p-adic absolute value is

∣x∣p=p−vp(x)(x≠0),∣0∣p=0,|x|_p=p^{-v_p(x)}\quad (x\ne0),\qquad |0|_p=0,

and the distance is dp(x,y)=∣x−y∣pd_p(x,y)=|x-y|_p.

If two p-adic integers agree in their first nn digits, then their difference is divisible by pnp^n. Consequently,

x≡y(modpn)⟹∣x−y∣p≤p−n.x\equiv y\pmod{p^n} \quad\Longrightarrow\quad |x-y|_p\le p^{-n}.

In the tree, the p-adic distance is determined by the depth of the last common branch. The deeper two paths remain together, the closer the corresponding numbers are.

This is the opposite of the usual real-number intuition. In the real metric, 11 and 10011001 are far apart. But they are not close in the 33-adic metric, because

1001−1=1000=33⋅37+11001-1=1000=3^3\cdot 37+1

is not divisible by 33, so ∣1001−1∣3=1|1001-1|_3=1. A better comparison is 11 and 2828:

28−1=27=33,28-1=27=3^3,

so

∣28−1∣3=3−3=127.|28-1|_3=3^{-3}=\frac{1}{27}.

They are close in the 33-adic metric even though they are far apart on the real line. Their base-33 expansions agree in the first three low-order digits.

For another comparison,

4−1=3,∣4−1∣3=13,4-1=3, \qquad |4-1|_3=\frac13,

so 11 and 44 share one initial ternary digit but not two. Meanwhile,

2−1=1,∣2−1∣3=1,2-1=1, \qquad |2-1|_3=1,

so they are not closer than the basic unit scale.

Nested balls: a second visualization

A p-adic ball is both open and closed. For an integer n≥0n\ge0, the closed ball of radius p−np^{-n} around aa can be written as

{x∈Qp:∣x−a∣p≤p−n}=a+pnZp.\{x\in\mathbb{Q}_p:|x-a|_p\le p^{-n}\}=a+p^n\mathbb{Z}_p.

This set is also open. When a∈Zpa\in\mathbb{Z}_p, it is exactly one node of the digit tree: all numbers whose first nn digits agree with those of aa.

For p=3p=3, the ball

1+9Z31+9\mathbb{Z}_3

contains all 3-adic integers congruent to 11 modulo 99. It is one of the three subballs of 1+3Z31+3\mathbb{Z}_3. Each ball breaks into pp equal smaller balls, and two balls are either disjoint or one contains the other. This nested behavior is called ultrametric.

The ultrametric inequality is stronger than the ordinary triangle inequality:

∣x+z∣p≤max⁡{∣x∣p,∣z∣p}.|x+z|_p\le\max\{|x|_p,|z|_p\}.

As a result, every triangle in a p-adic space is isosceles, with the two largest sides equal. This is another reason a tree is a better mental model than a Euclidean diagram.

Visualizing the full field Qp\mathbb{Q}_p

The tree above describes Zp\mathbb{Z}_p. Every element of Qp\mathbb{Q}_p can be written as

x=pku,k∈Z,u∈Zp,x=p^k u, \qquad k\in\mathbb{Z},\quad u\in\mathbb{Z}_p,

with uu a p-adic unit when x≠0x\ne0. Thus Qp\mathbb{Q}_p contains copies of the p-adic integer structure at different scales.

A practical drawing has three ingredients:

  1. Draw a rooted p-ary tree for Zp\mathbb{Z}_p.
  2. Label the levels by powers of pp, such as 1,p−1,p−21,p^{-1},p^{-2} for distance scales.
  3. Add translated and rescaled copies to represent numbers with negative powers of pp.

For a more advanced geometric model, the Bruhat–Tits tree for PGL2(Qp)\mathrm{PGL}_2(\mathbb{Q}_p) is a regular tree of valence p+1p+1. Its boundary is P1(Qp)\mathbb{P}^1(\mathbb{Q}_p), so Qp\mathbb{Q}_p itself is identified with the boundary after removing the point at infinity; boundary neighborhoods encode the p-adic balls.

Why a usual number line can mislead

You can assign a p-adic digit sequence to points in a real interval and draw a Cantor-like or space-filling picture. Such a picture may display digit patterns, but it does not preserve the p-adic distance in the ordinary Euclidean plane. Nearby points in the drawing need not be p-adically close.

For computation, a finite truncation is often enough. Display the residues modulo pnp^n as the level-nn nodes of the tree. Increasing nn reveals more digits and refines each node into pp children. This gives an accurate visualization of p-adic approximation without pretending that Qp\mathbb{Q}_p is an ordinary subset of the real plane.

Common mistakes

  • Reading digits in the usual direction: p-adic closeness starts with the units digit, not the highest displayed digit.
  • Using real distance: a large real difference can have a small p-adic norm if it is divisible by a high power of pp.
  • Drawing Qp\mathbb{Q}_p as a line: the field has a totally disconnected, branching geometry rather than interval geometry.
  • Confusing Zp\mathbb{Z}_p and Qp\mathbb{Q}_p: the rooted p-ary boundary directly represents Zp\mathbb{Z}_p; Qp\mathbb{Q}_p also requires different scales and translations.

References

  1. p-adic Numbers: An Introduction, by Fernando Q. Gouvêa
  2. p-adic Numbers, p-adic Analysis, and Zeta-Functions, by Neal Koblitz

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.