vEnhance's avatar

Oct 10, 2018

🖉 A trailer for p-adic analysis, first half: USA TST 2003

I think this post is more than two years late in coming, but anywhow…

This post introduces the pp-adic integers Zp\mathbb Z_p, and the pp-adic numbers Qp\mathbb Q_p. The one-sentence description is that these are “integers/rationals carrying full mod pep^e information” (and only that information).

The first four sections will cover the founding definitions culminating in a short solution to a USA TST problem.

In this whole post, pp is always a prime. Much of this is based off of Chapter 3A from Straight from the Book.

1. Motivation

Before really telling you what Zp\mathbb Z_p and Qp\mathbb Q_p are, let me tell you what you might expect them to do.

In elementary/olympiad number theory, we’re already well-familiar with the following two ideas:

  • Taking modulo a prime pp or prime pep^e, and
  • Looking at the exponent νp\nu_p.

Let me expand on the first point. Suppose we have some Diophantine equation. In olympiad contexts, one can take an equation modulo pp to gain something else to work with. Unfortunately, taking modulo pp loses some information: (the reduction ZZ/p\mathbb Z \twoheadrightarrow \mathbb Z/p is far from injective).

If we want finer control, we could consider instead taking modulo p2p^2, rather than taking modulo pp. This can also give some new information (cubes modulo 99, anyone?), but it has the disadvantage that Z/p2\mathbb Z/p^2 isn’t a field, so we lose a lot of the nice algebraic properties that we got if we take modulo pp.

One of the goals of pp-adic numbers is that we can get around these two issues I described. The pp-adic numbers we introduce is going to have the following properties:

  1. You can “take modulo pep^e for all ee at once”. In olympiad contexts, we are used to picking a particular modulus and then seeing what happens if we take that modulus. But with pp-adic numbers, we won’t have to make that choice. An equation of pp-adic numbers carries enough information to take modulo pep^e.
  2. The numbers Qp\mathbb Q_p form a field, the nicest possible algebraic structure: 1/p1/p makes sense. Contrast this with Z/p2\mathbb Z/p^2, which is not even an integral domain.
  3. It doesn’t lose as much information as taking modulo pp does: rather than the surjective ZZ/p\mathbb Z \twoheadrightarrow \mathbb Z/p we have an injective map ZZp\mathbb Z \hookrightarrow \mathbb Z_p.
  4. Despite this, you “ignore” some “irrelevant” data. Just like taking modulo pp, you want to zoom-in on a particular type of algebraic information, and this means necessarily losing sight of other things. (To draw an analogy: the equation a2+b2+c2+d2=1a^2 + b^2 + c^2 + d^2 = -1 has no integer solutions, because, well, squares are nonnegative. But you will find that this equation has solutions modulo any prime pp, because once you take modulo pp you stop being able to talk about numbers being nonnegative. The same thing will happen if we work in pp-adics: the above equation has a solution in Zp\mathbb Z_p for every prime pp.)

So, you can think of pp-adic numbers as the right tool to use if you only really care about modulo pep^e information, but normal Z/pe\mathbb Z/p^e isn’t quite powerful enough.

To be more concrete, I’ll give a poster example now:

Example 1 (USA TST 2002/2)

For a prime pp, show the value of fp(x)=k=1p11(px+k)2(modp3)f_p(x) = \sum_{k=1}^{p-1} \frac{1}{(px+k)^2} \pmod{p^3} does not depend on xx.

Here is a problem where we clearly only care about pep^e-type information. Yet it’s a nontrivial challenge to do the necessary manipulations mod p3p^3 (try it!). The basic issue is that there is no good way to deal with the denominators modulo p3p^3 (in part Z/p3\mathbb Z/p^3 is not even an integral domain).

However, with pp-adic analysis we’re going to be able to overcome these limitations and give a “straightforward” proof by using the identity (1+pxk)2=n0(2n)(pxk)n.\left( 1 + \frac{px}{k} \right)^{-2} = \sum_{n \ge 0} \binom{-2}{n} \left( \frac{px}{k} \right)^n. Such an identity makes no sense over Q\mathbb Q or R\mathbb R for converge reasons, but it will work fine over the Qp\mathbb Q_p, which is all we need.

2. Algebraic perspective

We now construct Zp\mathbb Z_p and Qp\mathbb Q_p. I promised earlier that a pp-adic integer will let you look at “all residues modulo pep^e” at once. This definition will formalize this.

2.1. Definition of Zp\mathbb Z_p

Definition 2 (Introducing Zp\mathbb Z_p)

A pp-adic integer is a sequence x=(x1modp,x2modp2,x3modp3,)x = (x_1 \bmod p, x_2 \bmod{p^2}, x_3 \bmod{p^3}, \dots) of residues xex_e modulo pep^e for each integer ee, satisfying the compatibility relations xixj(modpi)x_i \equiv x_j \pmod{p^i} for i<ji < j.

The set Zp\mathbb Z_p of pp-adic integers forms a ring under component-wise addition and multiplication.

Example 3 (Some 33-adic integers)

Let p=3p=3. Every usual integer nn generates a (compatible) sequence of residues modulo pep^e for each ee, so we can view each ordinary integer as pp-adic one: 50=(2mod3,5mod9,23mod27,50mod81,50mod243,).50 = \left( 2 \bmod 3, 5 \bmod 9, 23 \bmod{27}, 50 \bmod{81}, 50 \bmod{243}, \dots \right). On the other hand, there are sequences of residues which do not correspond to any usual integer despite satisfying compatibility relations, such as (1mod3,4mod9,13mod27,40mod81,)\left( 1 \bmod 3, 4 \bmod 9, 13 \bmod{27}, 40 \bmod{81}, \dots \right) which can be thought of as x=1+p+p2+x = 1 + p + p^2 + \dots.

In this way we get an injective map

ZZpn(nmodp,nmodp2,nmodp3,) \mathbb Z \hookrightarrow \mathbb Z_p \qquad n \mapsto \left( n \bmod p, n \bmod{p^2}, n \bmod{p^3}, \dots \right)

which is not surjective. So there are more pp-adic integers than usual integers.

(Remark for experts: those of you familiar with category theory might recognize that this definition can be written concisely as ZplimZ/peZ\mathbb Z_p \coloneqq \varprojlim \mathbb Z/p^e \mathbb Z where the inverse limit is taken across e1e \ge 1.)

Exercise 4. Check that Zp\mathbb Z_p is an integral domain.

2.2. Base pp expansion

Here is another way to think about pp-adic integers using “base pp”. As in the example earlier, every usual integer can be written in base pp, for example 50=12123=230+131+232+133.50 = \overline{1212}_3 = 2 \cdot 3^0 + 1 \cdot 3^1 + 2 \cdot 3^2 + 1 \cdot 3^3. More generally, given any x=(x1,)Zpx = (x_1, \dots) \in \mathbb Z_p, we can write down a “base pp” expansion in the sense that there are exactly pp choices of xkx_k given xk1x_{k-1}. Continuing the example earlier, we would write

(1mod3,4mod9,13mod27,40mod81,)=1+3+32+=11113 \begin{aligned} \left( 1 \bmod 3, 4 \bmod 9, 13 \bmod{27}, 40 \bmod{81}, \dots \right) &= 1 + 3 + 3^2 + \dots \\ &= \overline{\dots1111}_3 \end{aligned}

and in general we can write x=k0akpk=a2a1a0px = \sum_{k \ge 0} a_k p^k = \overline{\dots a_2 a_1 a_0}_p where ak{0,,p1}a_k \in \{0, \dots, p-1\}, such that the equation holds modulo pep^e for each ee. Note the expansion is infinite to the left, which is different from what you’re used to.

(Amusingly, negative integers also have infinite base pp expansions: 4=2222123-4 = \overline{\dots222212}_3, corresponding to (2mod3,5mod9,23mod27,77mod81,)(2 \bmod 3, 5 \bmod 9, 23 \bmod{27}, 77 \bmod{81}, \dots).)

Thus you may often hear the advertisement that a pp-adic integer is an “possibly infinite base pp expansion”. This is correct, but later on we’ll be thinking of Zp\mathbb Z_p in a more and more “analytic” way, and so I prefer to think of this as a “Taylor series with base pp. Indeed, much of your intuition from generating functions K[[X]]K[[X]] (where KK is a field) will carry over to Zp\mathbb Z_p.

2.3. Constructing Qp\mathbb Q_p

Here is one way in which your intuition from generating functions carries over:

Proposition 5 (Non-multiples of pp are all invertible)

The number xZpx \in \mathbb Z_p is invertible if and only if x10x_1 \ne 0. In symbols, xZp×    x≢0(modp).x \in \mathbb Z_p^\times \iff x \not\equiv 0 \pmod p.

Contrast this with the corresponding statement for K[[X]]K[[X]]: a generating function FK[[X]]F \in K[[X]] is invertible iff F(0)0F(0) \neq 0.

Proof: If x0(modp)x \equiv 0 \pmod p then x1=0x_1 = 0, so clearly not invertible. Otherwise, xe≢0(modp)x_e \not\equiv 0 \pmod p for all ee, so we can take an inverse yey_e modulo pep^e, with xeye1(modpe)x_e y_e \equiv 1 \pmod{p^e}. As the yey_e are themselves compatible, the element (y1,y2,)(y_1, y_2, \dots) is an inverse. \Box

Example 6 (We have 12=11113Z3-\frac{1}{2} = \overline{\dots1111}_3 \in \mathbb Z_3)

We claim the earlier example is actually

12=(1mod3,4mod9,13mod27,40mod81,)=1+3+32+=11113. \begin{aligned} -\frac{1}{2} &= \left( 1 \bmod 3, 4 \bmod 9, 13 \bmod{27}, 40 \bmod{81}, \dots \right) \\ &= 1 + 3 + 3^2 + \dots \\ &= \overline{\dots1111}_3. \end{aligned}

Indeed, multiplying it by 2-2 gives (2mod3,8mod9,26mod27,80mod81,)=1.\left( -2 \bmod 3, -8 \bmod 9, -26 \bmod{27}, -80 \bmod{81}, \dots \right) = 1.

(Compare this with the “geometric series” 1+3+32+=1131 + 3 + 3^2 + \dots = \frac{1}{1-3}. We’ll actually be able to formalize this later, but not yet.)

Remark 7 (12\frac{1}{2} is an integer for p>2p > 2)

The earlier proposition implies that 12Z3\frac{1}{2} \in \mathbb Z_3 (among other things); your intuition about what is an “integer” is different here! In olympiad terms, we already knew 12(mod3)\frac{1}{2} \pmod 3 made sense, which is why calling 12\frac{1}{2} an “integer” in the 33-adics is correct, even though it doesn’t correspond to any element of Z\mathbb Z.

Fun (but trickier) exercise: rational numbers correspond exactly to eventually periodic base pp expansions.

With this observation, here is now the definition of Qp\mathbb Q_p.

Definition 8 (Introducing Qp\mathbb Q_p)

Since Zp\mathbb Z_p is an integral domain, we let Qp\mathbb Q_p denote its field of fractions. These are the pp-adic numbers.

Continuing our generating functions analogy: Zp is to QpasK[[X]] is to K((X)).\mathbb Z_p \text{ is to } \mathbb Q_p \quad\text{as}\quad K[[X]] \text{ is to } K((X)). This means Qp\mathbb Q_p is “Laurent series with base pp”, and in particular according to the earlier proposition we deduce:

Proposition 9 (Qp\mathbb Q_p looks like formal Laurent series)

Every nonzero element of Qp\mathbb Q_p is uniquely of the form pku where kZ,uZp×.p^k u \qquad \text{ where } k \in \mathbb Z, u \in \mathbb Z_p^\times.

Thus, continuing our base pp analogy, elements of Qp\mathbb Q_p are in bijection with “Laurent series” knakpk=a2a1a0.a1a2anp\sum_{k \ge -n} a_k p^k = \overline{\dots a_2 a_1 a_0 . a_{-1} a_{-2} \dots a_{-n}}_p for ak{0,,p1}a_k \in \left\{ 0, \dots, p-1 \right\}. So the base pp representations of elements of Qp\mathbb Q_p can be thought of as the same as usual, but extending infinitely far to the left (rather than to the right).

(Fair warning: the field Qp\mathbb Q_p has characteristic zero, not pp.)

Remark 10 (Warning on fraction field)

This result implies that you shouldn’t think about elements of Qp\mathbb Q_p as x/yx/y (for x,yZpx,y \in \mathbb Z_p) in practice, even though this is the official definition (and what you’d expect from the name Qp\mathbb Q_p). The only denominators you need are powers of pp.

To keep pushing the formal Laurent series analogy, K((X))K((X)) is usually not thought of as quotient of generating functions but rather as “formal series with some negative exponents”. You should apply the same intuition on Qp\mathbb Q_p.

(At this point I want to make a remark about the fact 1/pQp1/p \in \mathbb Q_p, connecting it to the wish-list of properties I had before. In elementary number theory you can take equations modulo pp, but if you do the quantity n/pmodpn/p \bmod{p} doesn’t make sense unless you know nmodp2n \bmod{p^2}. You can’t fix this by just taking modulo p2p^2 since then you need nmodp3n \bmod{p^3} to get n/pmodp2n/p \bmod{p^2}, ad infinitum. You can work around issues like this, but the nice feature of Zp\mathbb Z_p and Qp\mathbb Q_p is that you have modulo pep^e information for “all ee at once”: the information of xQpx \in \mathbb Q_p packages all the modulo pep^e information simultaneously. So you can divide by pp with no repercussions.)

3. Analytic perspective

3.1. Definition

Up until now we’ve been thinking about things mostly algebraically, but moving forward it will be helpful to start using the language of analysis. Usually, two real numbers are considered “close” if they are close on the number of line, but for pp-adic purposes we only care about modulo pep^e information. So, we’ll instead think of two elements of Zp\mathbb Z_p or Qp\mathbb Q_p as “close” if they differ by a large multiple of pep^e.

For this we’ll borrow the familiar νp\nu_p from elementary number theory.

Definition 11 (pp-adic valuation and absolute value)

We define the pp-adic valuation νp:Qp×Z\nu_p : \mathbb Q_p^\times \rightarrow \mathbb Z in the following two equivalent ways:

  • For x=(x1,x2,)Zpx = (x_1, x_2, \dots) \in \mathbb Z_p we let νp(x)\nu_p(x) be the largest ee such that xe0(modpe)x_e \equiv 0 \pmod{p^e} (or e=0e=0 if xZp×x \in \mathbb Z_p^\times). Then extend to all of Qp×\mathbb Q_p^\times by νp(xy)=νp(x)+νp(y)\nu_p(xy) = \nu_p(x) + \nu_p(y).
  • Each xQp×x \in \mathbb Q_p^\times can be written uniquely as pkup^k u for uZp×u \in \mathbb Z_p^\times, kZk \in \mathbb Z. We let νp(x)=k\nu_p(x) = k.

By convention we set νp(0)=+\nu_p(0) = +\infty. Finally, define the pp-adic absolute value p\left\lvert \bullet \right\rvert_p by xp=pνp(x).\left\lvert x \right\rvert_p = p^{-\nu_p(x)}. In particular 0p=0\left\lvert 0 \right\rvert_p = 0.

This fulfills the promise that xx and yy are close if they look the same modulo pep^e for large ee; in that case νp(xy)\nu_p(x-y) is large and accordingly xyp\left\lvert x-y \right\rvert_p is small.

3.2. Ultrametric space

In this way, Qp\mathbb Q_p and Zp\mathbb Z_p becomes a metric space with metric given by xyp\left\lvert x-y \right\rvert_p.

Exercise 12. Suppose f ⁣:ZpQpf \colon \mathbb Z_p \rightarrow \mathbb Q_p is continuous and f(n)=(1)nf(n) = (-1)^n for every nZ0n \in \mathbb Z_{\ge 0}. Prove that p=2p = 2.

In fact, these spaces satisfy a stronger form of the triangle inequality than you are used to from R\mathbb R.

Proposition 13 (p\left\lvert \bullet \right\rvert_p is an ultrametric)

For any x,yZpx,y \in \mathbb Z_p, we have the strong triangle inequality

x+ypmax{xp,yp}. \left\lvert x+y \right\rvert_p \le \max \left\{ \left\lvert x \right\rvert_p, \left\lvert y \right\rvert_p \right\}.

Equality holds if (but not only if) xpyp\left\lvert x \right\rvert_p \neq \left\lvert y \right\rvert_p.

However, Qp\mathbb Q_p is more than just a metric space: it is a field, with its own addition and multiplication. This means we can do analysis just like in R\mathbb R or C\mathbb C: basically, any notion such as “continuous function”, “convergent series”, et cetera has a pp-adic analog. In particular, we can define what it means for an infinite sum to converge:

Definition 14 (Convergence notions)

Here are some examples of pp-adic analogs of “real-world” notions.

  • A sequence s1s_1, … converges to a limit LL if limnsnLp=0\lim_{n \rightarrow \infty} \left\lvert s_n - L \right\rvert_p = 0.
  • The infinite series kxk\sum_k x_k converges if the sequence of partial sums s1=x1s_1 = x_1, s2=x1+x2s_2 = x_1 + x_2, …, converges to some limit.
  • … et cetera …

With this definition in place, the “base pp” discussion we had earlier is now true in the analytic sense: if x=a2a1a0pZpx = \overline{\dots a_2 a_1 a_0}_p \in \mathbb Z_p then k=0akpkconverges to x.\sum_{k=0}^\infty a_k p^k \quad\text{converges to } x. Indeed, the nn‘th partial sum is divisible by pnp^n, hence the partial sums approach xx as nn \rightarrow \infty.

While the definitions are all the same, there are some changes in properties that should be true. For example, in Qp\mathbb Q_p convergence of partial sums is simpler:

Proposition 15 (xkp0|x_k|_p \rightarrow 0 iff convergence of series)

A series k=1xk\sum_{k=1}^\infty x_k in Qp\mathbb Q_p converges to some limit if and only if limkxkp=0\lim_{k \rightarrow \infty} |x_k|_p = 0.

Contrast this with 1n=\sum \frac1n = \infty in R\mathbb R. You can think of this as a consequence of strong triangle inequality.

Proof: By multiplying by a large enough power of pp, we may assume xkZpx_k \in \mathbb Z_p. (This isn’t actually necessary, but makes the notation nicer.)

Observe that xk(modp)x_k \pmod p must eventually stabilize, since for large enough nn we have xnp<1    νp(xn)1\left\lvert x_n \right\rvert_p < 1 \iff \nu_p(x_n) \ge 1. So let a1a_1 be the eventual residue modulo pp of k=0Nxk(modp)\sum_{k=0}^N x_k \pmod p for large NN. In the same way let a2a_2 be the eventual residue modulo p2p^2, and so on. Then one can check we approach the limit a=(a1,a2,)a = (a_1, a_2, \dots). \Box

Here’s a couple exercises to get you used to thinking of Zp\mathbb Z_p and Qp\mathbb Q_p as metric spaces.

Exercise 16 (Zp\mathbb Z_p is compact)

Show that Qp\mathbb Q_p is not compact, but Zp\mathbb Z_p is. (For the latter, I recommend using sequential continuity.)

Exercise 17 (Totally disconnected)

Show that both Zp\mathbb Z_p and Qp\mathbb Q_p are totally disconnected: there are no connected sets other than the empty set and singleton sets.

3.3. More fun with geometric series

While we’re at it, let’s finally state the pp-adic analog of the geometric series formula.

Proposition 18 (Geometric series)

Let xZpx \in \mathbb Z_p with xp<1\left\lvert x \right\rvert_p < 1. Then 11x=1+x+x2+x3+.\frac{1}{1-x} = 1 + x + x^2 + x^3 + \dots.

Proof: Note that the partial sums satisfy 1+x+x2++xn=1xn1x1 + x + x^2 + \dots + x^n = \frac{1-x^n}{1-x}, and xn0x^n \rightarrow 0 as nn \rightarrow \infty since xp<1\left\lvert x \right\rvert_p < 1. \Box

So, 1+3+32+=121 + 3 + 3^2 + \dots = -\frac{1}{2} is really a correct convergence in Z3\mathbb Z_3. And so on.

If you buy the analogy that Zp\mathbb Z_p is generating functions with base pp, then all the olympiad generating functions you might be used to have pp-adic analogs. For example, you can prove more generally that:

Theorem 19 (Generalized binomial theorem)

If xZpx \in \mathbb Z_p and xp<1\left\lvert x \right\rvert_p < 1, then for any rQr \in \mathbb Q we have the series convergence n0(rn)xn=(1+x)r.\sum_{n \ge 0} \binom rn x^n = (1+x)^r.

(I haven’t defined (1+x)r(1+x)^r, but it has the properties you expect.) The proof is as in the real case; even the theorem statement is the same except for the change for the extra subscript of pp. I won’t elaborate too much on this now, since pp-adic exponentiation will be described in much more detail in the next post.

3.4. Completeness

Note that the definition of p\left\lvert \bullet \right\rvert_p could have been given for Q\mathbb Q as well; we didn’t need Qp\mathbb Q_p to introduce it (after all, we have νp\nu_p in olympiads already). The big important theorem I must state now is:

Theorem 20 (Qp\mathbb Q_p is complete)

The space Qp\mathbb Q_p is the completion of Q\mathbb Q with respect to p\left\lvert \bullet \right\rvert_p.

This is the definition of Qp\mathbb Q_p you’ll see more frequently; one then defines Zp\mathbb Z_p in terms of Qp\mathbb Q_p (rather than vice-versa) according to Zp={xQp:xp1}.\mathbb Z_p = \left\{ x \in \mathbb Q_p : \left\lvert x \right\rvert_p \le 1 \right\}. (Remark for experts: Qp\mathbb Q_p is a field with νp\nu_p a non-Arcihmedian valuation; then Zp\mathbb Z_p is its valuation ring.)

Let me justify why this definition is philosophically nice.

Suppose you are a numerical analyst and you want to estimate the value of the sum S=112+122++1100002S = \frac{1}{1^2} + \frac{1}{2^2} + \dots + \frac{1}{10000^2} to within 0.0010.001. The sum SS consists entirely of rational numbers, so the problem statement would be fair game for ancient Greece. But it turns out that in order to get a good estimate, it really helps if you know about the real numbers: because then you can construct the infinite series n1n2=16π2\sum_{n \ge 1} n^{-2} = \frac16 \pi^2, and deduce that Sπ26S \approx \frac{\pi^2}{6}, up to some small error term from the terms past 1100012\frac{1}{10001^2}, which can be bounded.

Of course, in order to have access to enough theory to prove that S=π2/6S = \pi^2/6, you need to have the real numbers; it’s impossible to do serious analysis in the non-complete space Q\mathbb Q, where e.g. the sequence 11, 1.41.4, 1.411.41, 1.4141.414, … is considered “not convergent” because 2Q\sqrt2 \notin \mathbb Q. Instead, all analysis is done in the completion of Q\mathbb Q, namely R\mathbb R.

Now suppose you are an olympiad contestant and want to estimate the sum fp(x)=k=1p11(px+k)2f_p(x) = \sum_{k=1}^{p-1} \frac{1}{(px+k)^2} to within mod p3p^3 (i.e. to within p3p^{-3} in p\left\lvert \bullet \right\rvert_p). Even though fp(x)f_p(x) is a rational number, it still helps to be able to do analysis with infinite sums, and then bound the error term (i.e. take mod p3p^3). But the space Q\mathbb Q is not complete with respect to p\left\lvert \bullet \right\rvert_p either, and thus it makes sense to work in the completion of Q\mathbb Q with respect to p\left\lvert \bullet \right\rvert_p. This is exactly Qp\mathbb Q_p.

4. Solving USA TST 2002/2

Let’s finally solve Example 1, which asks to compute fp(x)=k=1p11(px+k)2(modp3).f_p(x) = \sum_{k=1}^{p-1} \frac{1}{(px+k)^2} \pmod{p^3}. Armed with the generalized binomial theorem, this becomes straightforward.

fp(x)=k=1p11(px+k)2=k=1p11k2(1+pxk)2=k=1p11k2n0(2n)(pxk)n=n0(2n)k=1p11k2(xk)npnk=1p11k22x(k=1p11k3)p+3x2(k=1p11k4)p2(modp3). \begin{aligned} f_p(x) &= \sum_{k=1}^{p-1} \frac{1}{(px+k)^2} = \sum_{k=1}^{p-1} \frac{1}{k^2} \left( 1 + \frac{px}{k} \right)^{-2} \\ &= \sum_{k=1}^{p-1} \frac{1}{k^2} \sum_{n \ge 0} \binom{-2}{n} \left( \frac{px}{k} \right)^{n} \\ &= \sum_{n \ge 0} \binom{-2}{n} \sum_{k=1}^{p-1} \frac{1}{k^2} \left( \frac{x}{k} \right)^{n} p^n \\ &\equiv \sum_{k=1}^{p-1} \frac{1}{k^2} - 2x \left( \sum_{k=1}^{p-1} \frac{1}{k^3} \right) p + 3x^2 \left( \sum_{k=1}^{p-1} \frac{1}{k^4} \right) p^2 \pmod{p^3}. \end{aligned}

Using the elementary facts that p2kk3p^2 \mid \sum_k k^{-3} and pk4p \mid \sum k^{-4}, this solves the problem.