Can one show a beginning student how to use the $p$-adics to solve a problem?

I recently had a discussion about how to teach $p$-adic numbers to high school students. One person mentioned that they found it difficult to get used to $p$-adics because no one told them why the $p$-adics are useful.

As a graduate student in algebraic number theory, this question is easy to answer. But I'm wondering if there's a way to answer this question to someone who only knows very basic things about number theory and the $p$-adics. I'm thinking of someone who has learned over the course of a few days what the $p$-adic numbers are, what they look like, etc, but doesn't know much more.

I'm specifically wondering if there's any elementary problem that one can solve using $p$-adic numbers. It's okay if the answer is no, and that it takes time to truly motivate them (other than more abstract motivation).


Here is a very concrete question that can be explained by appealing to the $p$-adic continuity of addition and multiplication. We don't even need completions: the problem takes place entirely in the rational numbers and is not a fake problem in any sense.

We can form binomial coefficients $\binom{r}{n}$ when $r$ is not necessarily an integer, and this is important because they occur in the coefficients of the power series for $(1+x)^r$ in calculus. Their formula, for $n \geq 1$, is $$ \binom{r}{n} = \frac{r(r-1)\cdots(r-n+1)}{n!}. $$ If you look at the expansion for $\sqrt{1+x}$ and for $\sqrt[3]{1+x}$, corresponding to $r = 1/2$ and $r = 1/3$, the series start off as $$ 1 + \frac{1}{2}x - \frac{1}{8}x^2 + \frac{1}{16}x^3 - \frac{5}{128}x^4 + \frac{7}{256}x^5 + \cdots $$ and $$ 1 + \frac{1}{3}x - \frac{1}{9}x^2 + \frac{5}{81}x^3 - \frac{10}{243}x^4 + \frac{22}{729}x^5 + \cdots $$ The surprise is that the denominators are entirely powers of 2 in the first case and 3 in the second case. Think about that: $\binom{1/3}{5}$ involves division by $5!$, but the 2 and 5 factors cancel out. As a more extreme example, $\binom{-3/22}{7} = -\frac{1071892575}{39909726208}$ and $39909726208 = 2^{11}11^7$. Even though the definition of $\binom{-3/22}{7}$ involves division by $7!$, the primes that survive in the denominator seem to have nothing to do with $7!$ and everything to do with the denominator of $-3/22$.

Claim: For $n \geq 1$ and nonzero rational $r$, if a prime $p$ is in the denominator of $\binom{r}{n}$ then $p$ is in the denominator of $r$.

Proof: We show the contrapositive. If $p$ is not in the denominator of $r$ then $|r|_p \leq 1$, so the denominator of $r$ is invertible modulo any power of $p$, and therefore $r$ is a $p$-adic limit of positive integers, say $r = \lim_{k \rightarrow \infty} a_k$ with $a_k \in {\mathbf Z}^+$. That is a $p$-adic limit. By $p$-adic continuity of addition and multiplication (and division), we get $\binom{r}{n} = \lim_{k \rightarrow \infty} \binom{a_k}{n}$, another $p$-adic limit. By combinatorics we know $\binom{a_k}{n}$ is a positive integer, so $|\binom{a_k}{n}|_p \leq 1$. The $p$-adic absolute value on ${\mathbf Q}$ is $p$-adically continuous, so $|\binom{r}{n}|_p = \lim_{k \rightarrow \infty} |\binom{a_k}{n}|_p \leq 1$. Thus $p$ is not in the denominator of $\binom{r}{n}$. QED

The special case $r = 1/2$ can be explained in terms of Catalan numbers: $\binom{1/2}{n} = (-1)^{n-1}C_{n-1}/2^{2n-1}$, where $C_{n-1}$ is the $(n-1)$th Catalan number (a positive integer). Therefore the denominator of $\binom{1/2}{n}$ is a power of 2. For the general case, I know of no argument that explains why primes in the denominator of $\binom{r}{n}$ must be primes in the denominator of $r$ in such a clean way as this $p$-adic method.

The converse of the claim is also true: for $n \geq 1$ and nonzero rational $r$, if a prime $p$ is in the denominator of $r$ then $p$ is in the denominator of $\binom{r}{n}$. That is, if $|r|_p > 1$ then $|\binom{r}{n}|_p > 1$. More precisely, if $|r|_p > 1$ then $|\binom{r}{n}|_p \geq |r|_p^n$, so in fact $|\binom{r}{n}|_p \rightarrow \infty$ as $n \rightarrow \infty$. Let's leave that as an exercise. (The data for the coefficients of $\sqrt{1+x}$ and $\sqrt[3]{1+x}$ suggest that perhaps the sequence $|\binom{r}{n}|_p$ is monotonically increasing if $|r|_p > 1$, and that too can be proved in general by looking at the $p$-adic absolute value of the ratio $\binom{r}{n+1}/\binom{r}{n}$.) In particular, for $n \geq 1$ the denominator of $\binom{1/2}{n}$ is a power of $2$ other than $1$.


My personal elementary favorites are:

  • Prove that $$ \frac11+\frac12+\frac13+\cdots+\frac1n $$ is not an integer, if $n>1$.
  • And the variant of proving that $$ \frac11+\frac13+\frac15+\cdots+\frac1{2n+1} $$ is not an integer, if $n\ge1$.

Both are resolved by using the non-archimedean $p$-adic triangle inequality for a suitable choice of $p$.


An example for Hasse-Minkowski might be worth studying it, i.e., the binary quadratic form $5x^2 + 7y^2 − 13z^2$ has a non-trivial rational root since it has a $p$-adic one for every prime, and obviously also a real root.

Another example is the $3$-square theorem of Gauss: A positive integer $n$ is the sum of three squares if and only if $-n$ is not a square in $\mathbb{Q}_2$, the field of $2$-adic integers.


A nice application is a proof of Gauss's lemma: if $f$ is a monic polynomial with integer coefficients which factors as $gh$ in $\mathbf Q[x]$, with both $g, h$ monic, then $g$ and $h$ also have integer coefficients. This involves defining the $p$-adic absolute value on polynomials as $\left|\sum a_i x^i\right|_p := \max |a_i|_p$, and then showing that $|gh|_p = |g|_p|h|_p$. Since $g$ and $h$ are monic we have $|g|_p \geq 1$ and $|h|_p \geq 1$ because $|1|_p = 1$. Since $|f|_p = 1$, we must also have $|g|_p|h|_p = 1$, so therefore $|g|_p = 1$ and $|h|_p = 1$ - that is, the coefficients of $g$ and $h$ must be $p$-integral. Since this is true for all $p$, the coefficients of $g$ and $h$ are integers. This is much cleaner than the proof using gcds/lcms of the numerators or denominators of the coefficients, and shorter than proofs that require the development of algebraic integers.

The usual proof of Gauss's lemma relies on the product of two primitive polynomials in ${\mathbf Z}[x]$ being primitive, where a polynomial $f(x)$ in $\mathbf Z[x]$ is called primitive when its coefficients have no common prime factor, or equivalently when $|f|_p = 1$ for all primes $p$. If $f$ and $g$ are primitive in $\mathbf Z[x]$ (not the same $f$ and $g$ as above!), we have $|f|_p = 1$ and $|g|_p = 1$ for all $p$, so $|fg|_p = |f|_p|g|_p = 1$ for all $p$, and therefore $fg$ is primitive!

This is also quite a striking application of $p$-adic numbers, but it's not constructive as it involves extending the $2$-adic absolute value to the real numbers. Use at your own risk!