Rademacher’s reciprocity law for shifted Dedekind Sums

Let h,k\ge1 be coprime. We want to prove the classical reciprocity law

\displaystyle s(h,k)+s(k,h)=-\frac14+\frac1{12}\Big(\frac{h}{k}+\frac{k}{h}+\frac1{hk}\Big),

where the Dedekind sum s(h, k) is defined by

\displaystyle s(h,k):=\sum_{r=1}^{k-1}\Big(\Big(\frac{r}{k}\Big)\Big)\Big(\Big(\frac{hr}{k}\Big)\Big).

Here ((t))=\{t\}-\frac12 for nonintegral t , and ((t))=0 for integral t .

Let h,k\ge1 be coprime integers. We use the periodic first Bernoulli function B_1(t):=\{t \}-\frac12, defined for every real t . In particular, \displaystyle B_1(n)=-\frac12 when n\in\mathbb Z . This is slightly different from the usual sawtooth function ((t)) , which is assigned the value 0 at integers. The advantage of B_1 is that there is no exceptional convention inside finite residue sums: every residue class is treated by exactly the same formula. We also use the periodic second Bernoulli function B_2(t):=\{t\}^2-\{t\}+\frac16. The function B_2 is continuous and periodic, has mean zero on one period, and satisfies \displaystyle B_2'(t)=2B_1(t) whenever t\notin\mathbb Z . This derivative relation explains why B_2 appears in the reciprocity formula: the shifted Dedekind sums are built from products of B_1 , while the reciprocity identity is obtained by integrating the resulting first-order variation.

For real x,y , define

\displaystyle s(h,k;y,x):=\sum_{r=0}^{k-1}B_1\Big(\frac{h}{k}(r+x)+y\Big)B_1\Big(\frac{r+x}{k}\Big).

This is the shifted Dedekind–Rademacher sum. The first factor measures the centered fractional part of the shifted point on the line of slope h/k , while the second measures the centered horizontal position. Thus the sum is a shifted version of the usual correlation between horizontal position and vertical staircase error. The reciprocity law with the shifts is

\displaystyle \begin{aligned} s(h,k;y,x)+s(k,h;x,y) &=B_1(x)B_1(y)\\ &\quad+\frac12\Big (\frac{h}{k}B_2(x)+\frac1{hk}B_2(hx+ky)+\frac{k}{h}B_2(y)\Big ).\end{aligned}

The three B_2 terms correspond to the three boundary directions in the translated rational staircase picture: the horizontal shift x , the vertical shift y , and the shifted diagonal coordinate hx+ky . The product B_1(x)B_1(y) is the corner correction.

Proof:

Distribution Identity: We use the following elementary formula to prove the shifted reciprocity formula.

\displaystyle \sum_{r=0}^{m-1}B_1\Big(z+\frac{r}{m}\Big)=B_1(mz).

To prove this, write z=n+\theta , where n\in\mathbb Z and 0\le\theta<1 . Periodicity lets us replace z by \theta . Put q:=\lfloor m\theta\rfloor . Among the numbers \theta,\theta+1/m,\dots,\theta+(m-1)/m , precisely q cross the integer 1 and wrap around modulo 1 . Therefore

\displaystyle \sum_{r=0}^{m-1}\Big \{\theta+\frac{r}{m}\Big \}=m\theta+\frac{m-1}{2}-q=\Big\{m\theta\Big \}+\frac{m-1}{2}.

After subtracting m/2 , we get

\displaystyle \sum_{r=0}^{m-1}B_1\Big(\theta+\frac{r}{m}\Big)=\Big \{m\theta\Big \} -\frac12=B_1(m\theta)=B_1(mz).

This identity says that averaging the m equally spaced translates of the periodic sawtooth recreates the same sawtooth at scale m . It is the finite mechanism that turns the original one-dimensional shifted sums into one symmetric sum over a k\times h rectangle.

Symmetric Expression:

Set \xi_r:=\frac{r+x}{k}, \eta_s:=\frac{s+y}{h},~ 0\le r\le k-1, 0\le s\le h-1. Apply the distribution identity with m=h to the first factor in s(h,k;y,x) . Since h(\xi_r+\frac{s+y}{h})=\frac{h}{k}(r+x)+s+y, and adding the integer s does not change B_1 , we obtain

\displaystyle B_1\Big(\frac{h}{k}(r+x)+y\Big)=\sum_{s=0}^{h-1}B_1(\xi_r+\eta_s).

Therefore s(h,k;y,x)=\sum_{r=0}^{k-1}\sum_{s=0}^{h-1}B_1(\xi_r+\eta_s)B_1(\xi_r). Applying the same argument with h and k exchanged gives s(k,h;x,y)=\sum_{r=0}^{k-1}\sum_{s=0}^{h-1}B_1(\xi_r+\eta_s)B_1(\eta_s). Thus their sum is the symmetric rectangular expression

\displaystyle F(x,y):=s(h,k;y,x)+s(k,h;x,y)=\sum_{r=0}^{k-1}\sum_{s=0}^{h-1}B_1(\xi_r+\eta_s)\Big(B_1(\xi_r)+B_1(\eta_s)\Big).

This is the main structural step. Each shifted staircase sum originally follows one family of steps. After unfolding, the two reciprocal sums become one expression over the entire residue rectangle. The symmetry between h and k is now visible.

Both sides of the desired identity are periodic in x and y with period 1 . For example, replacing x by x+1 in the defining sum simply reindexes r by r+1 . We may therefore work first in the open square 0<x<1 , 0<y<1 . Define \displaystyle R(x,y):=B_1(x)B_1(y)+\frac12\Big(\frac{h}{k}B_2(x)+\frac1{hk}B_2(hx+ky)+\frac{k}{h}B_2(y)\Big). We will show that F-R is constant, and then determine that constant by averaging over one period square.

Away from the finitely many lines where one of the Bernoulli arguments is an integer, we may differentiate term by term. Write \displaystyle S(x,y):=s(h,k;y,x) . Differentiating its defining sum gives

\displaystyle \frac{\partial S}{\partial x}=\sum_{r=0}^{k-1}\Big [\frac{h}{k}B_1\Big (\frac{r+x}{k}\Big)+\frac1kB_1\Big (\frac{h}{k}(r+x)+y\Big)\Big].

The distribution identity gives \sum_{r=0}^{k-1}B_1\Big(\frac{r+x}{k}\Big)=B_1(x). Also, because multiplication by h permutes the residue classes modulo k , \sum_{r=0}^{k-1}B_1\Big(\frac{h}{k}(r+x)+y\Big)=B_1(hx+ky). Hence

\displaystyle \frac{\partial S}{\partial x}=\frac{h}{k}B_1(x)+\frac1kB_1(hx+ky).

Differentiating with respect to y is simpler:

\displaystyle \frac{\partial S}{\partial y}=\sum_{r=0}^{k-1}B_1\Big(\frac{r+x}{k}\Big)=B_1(x).

Now write \displaystyle T(x,y):=s(k,h;x,y) . Interchanging the two roles gives

\displaystyle \frac{\partial T}{\partial x}=B_1(y),\qquad \frac{\partial T}{\partial y}=\frac{k}{h}B_1(y)+\frac1hB_1(hx+ky).

Adding these four identities yields

\displaystyle \frac{\partial F}{\partial x}=\frac{h}{k}B_1(x)+\frac1kB_1(hx+ky)+B_1(y),

\displaystyle \frac{\partial F}{\partial y}=B_1(x)+\frac1hB_1(hx+ky)+\frac{k}{h}B_1(y).

On the other hand, \displaystyle B_2'(t)=2B_1(t) away from integers, so direct differentiation of R gives exactly the same two formulas:

\displaystyle \frac{\partial R}{\partial x}=\frac{h}{k}B_1(x)+\frac1kB_1(hx+ky)+B_1(y),

\displaystyle \frac{\partial R}{\partial y}=B_1(x)+\frac1hB_1(hx+ky)+\frac{k}{h}B_1(y).

Thus F-R has zero derivative in both variables wherever the displayed derivatives exist.

There is one small continuity point to check. In the open unit square, each \xi_r and \eta_s lies strictly between 0 and 1 . Hence the only possible discontinuity in a summand of F occurs when \xi_r+\eta_s=1 . But there

\displaystyle B_1(\xi_r)+B_1(\eta_s)=\Big(\xi_r-\frac12\Big)+\Big(\eta_s-\frac12\Big)=0.

Thus the possible jump in B_1(\xi_r+\eta_s) is multiplied by zero. The summand, and hence F , is continuous across every such line. The function R is also continuous, because B_2 is continuous and x,y are not integers inside the open square. Therefore the locally constant function F-R extends across all the dividing lines and is constant throughout 0<x,y<1 .

It remains only to determine this constant. We average both sides over one unit square. The first Bernoulli function has mean zero:

\displaystyle \int_0^1B_1(t) dt=\int_0^1\Big(t-\frac12\Big)dt=0.

Similarly,

\displaystyle \int_0^1B_2(t)dt=\int_0^1\Big(t^2-t+\frac16\Big)dt=0.

Using the rectangular representation of F and making the changes of variables \xi=(r+x)/k and \eta=(s+y)/h , we get

\displaystyle  \int_0^1\int_0^1F(x,y)dxdy =hk\int_0^1\int_0^1 B_1(\xi+\eta)\Big(B_1(\xi)+B_1(\eta) \Big) d\xi d\eta.

For fixed \xi , periodicity gives \displaystyle \int_0^1B_1(\xi+\eta)d\eta=0 . Thus the term involving B_1(\xi) integrates to zero. The term involving B_1(\eta) also integrates to zero after integrating first in \xi . Hence

\displaystyle \int_0^1\int_0^1F(x,y)dxdy=0.

The same is true for R . The product B_1(x)B_1(y) has zero average because each factor has zero mean. The separate B_2(x) and B_2(y) terms also have zero average. Finally, for each fixed y ,

\displaystyle \int_0^1B_2(hx+ky) dx=\frac1h\int_{ky}^{ky+h}B_2(t) dt=0,

because h is an integer and B_2 has mean zero on every period. Therefore

\displaystyle \int_0^1\int_0^1R(x,y)dxdy=0.

Since F-R is constant and has average zero, that constant is zero. Hence F(x,y)=R(x,y) on the open unit square. Periodicity then extends the identity to all real x,y . We have proved

\displaystyle  \begin{aligned} s(h,k;y,x)+s(k,h;x,y) = &B_1(x)B_1(y)+\\ & \frac12\Big(\frac{h}{k}B_2(x)+\frac1{hk}B_2(hx+ky)+\frac{k}{h}B_2(y)\Big). \end{aligned}

Set x=y=0 . Since \displaystyle B_1(0)=-\frac12 and \displaystyle B_2(0)=\frac16 , the periodic-Bernoulli formula gives

\displaystyle s(h,k;0,0)+s(k,h;0,0)=\frac14+\frac1{12}\Big(\frac{h}{k}+\frac1{hk}+\frac{k}{h}\Big).

Now let s(h,k) denote the usual Dedekind sum formed with the sawtooth convention ((0))=0 . In the periodic-Bernoulli sum, the only extra term occurs at the zero residue r=0 , where both factors equal -1/2 . Therefore

\displaystyle s(h,k;0,0)=s(h,k)+\frac14.

Applying this to both shifted sums and subtracting 1/2 yields the classical reciprocity law

\displaystyle s(h,k)+s(k,h)=-\frac14+\frac1{12}\Big(\frac{h}{k}+\frac{k}{h}+\frac1{hk}\Big).

The difference between the constants 1/4 and -1/4 is entirely an endpoint convention. In the periodic Bernoulli normalization, B_1(0)=-1/2 ; in the usual sawtooth normalization, ((0))=0 .

The ordinary Dedekind sum is attached to a rational staircase beginning at a lattice corner. The shifted sum moves the staircase away from that corner. The distribution identity spreads the one-dimensional staircase data into a k\times h residue rectangle, where the reciprocal pair of sums becomes symmetric. The derivative calculation then shows that the entire interior contribution is determined by its boundary variation. The functions B_2(x) , B_2(y) , and B_2(hx+ky) are precisely the three periodic quadratic boundary primitives forced by that variation, while B_1(x)B_1(y) is the corner term.

There is a geometric generating-function form of the shifted proof which explains why the Bernoulli terms on the right side of Rademacher’s formula have exactly the shape they do. Consider the translated rational line \displaystyle Y=\frac{h}{k}X+y , together with the horizontal displacement x . In the unshifted picture, the line begins at a lattice vertex and the lattice points below it form the familiar finite rational staircase. After translation, the slope is unchanged, but the staircase is displaced relative to the lattice. Its first and final vertices need no longer be lattice points. For 0\le r\le k-1 , the height of the translated lower staircase above the shifted horizontal position r+x is \left\lfloor\frac{h}{k}(r+x)+y\right\rfloor . Thus the appropriate shifted Carlitz polynomial is

\displaystyle C_{h,k}^{x,y}(u,v):=\sum_{r=0}^{k-1}u^{\Big \lfloor \Big(\frac{h}{k}(r+x)+y \Big ) \Big \rfloor}v^r.

This polynomial records the horizontal edges of the translated staircase. The exponent of v records the horizontal column, while the exponent of u records the staircase height. Multiplication by u-1 turns every monomial into the signed difference of the two endpoints of its horizontal edge. There is a corresponding polynomial for the vertical edges, obtained by interchanging h and k and transforming the shifts in the corresponding transposed coordinates. Multiplication by v-1 turns those monomials into oriented vertical edges. As in the ordinary Carlitz identity, every interior staircase vertex then occurs once with positive sign and once with negative sign, so all interior contributions cancel exactly. The difference is that the translated path no longer begins and ends at lattice vertices. Consequently, the surviving boundary contribution is no longer just the simple endpoint expression from the unshifted identity; it consists of several rational boundary terms which record the horizontal shift, the vertical shift, and the position of the translated diagonal.

To extract the arithmetic content of this shifted cone identity, one passes from monomials to exponential variables and uses a sheared coordinate system adapted to the rational line. One sets \displaystyle u=e^X and \displaystyle v=e^Y , after changing variables so that X measures centered horizontal position and Y measures centered vertical error from the translated line rather than raw height. In these coordinates, the coefficient of XY in the Taylor expansion of the shifted staircase transform is precisely

\displaystyle \sum_{r=0}^{k-1}B_1\left(\frac{r+x}{k}\right)B_1\Big(\frac{h}{k}(r+x)+y\Big)=s(h,k;y,x).

The reciprocal staircase contributes s(k,h;x,y) . The interior of the two paths still cancels; therefore the coefficient of XY is determined entirely by the endpoint rational functions. Their expansion produces the corner term B_1(x)B_1(y) together with the three quadratic boundary terms \displaystyle \frac{h}{k}B_2(x) , \displaystyle \frac1{hk}B_2(hx+ky) , and \displaystyle \frac{k}{h}B_2(y) . Thus Rademacher’s reciprocity law is the XY coefficient of the translated Carlitz cone identity. In the unshifted case x=y=0 , the cone apex lies at a lattice point, the translated boundary corrections collapse to constants, and—after replacing B_1 by the usual sawtooth convention—the formula becomes the classical term.

Thus Rademacher’s shifted reciprocity law is not a separate miracle from ordinary Dedekind reciprocity. It is the same rational-staircase cancellation after the corner has been translated off the lattice. The shift makes the boundary visible, and the periodic Bernoulli functions record those boundary contributions without any ad hoc correction terms.

Leave a comment