Let be coprime integers. Begin with the line of rational slope
, drawn from
to
.

This small geometric object already contains several familiar reciprocity laws. Eisenstein’s lattice proof of quadratic reciprocity studies the lattice points on one side of this line and extracts only a parity from the count.
Dedekind reciprocity comes from keeping much more information: one records the entire staircase of lattice points just below the line and studies how that staircase deviates from the straight segment. The geometry is the same in both cases. What changes is the resolution at which we observe it.
The condition is what makes the picture clean. If the line passed through an interior lattice point, then for some
we would have
. This would imply
, hence
because
and
are coprime, which is impossible. Thus the segment from
to
meets no lattice point in the interior of the rectangle. There are therefore no boundary ambiguities: every interior lattice point lies strictly above or strictly below the line.

For each , put
. The number
is the height of the lower staircase in the
-th vertical column. More concretely, the lattice points
with
are exactly the positive-height lattice points in that column which lie below the line. Hence
counts all interior lattice points below the diagonal segment. The most elementary symmetry in the picture comes from replacing
by
. Since
is never an integer for
, we have
.

Pairing the columns gives the basic rational-triangle count

This identity says that the interior lattice points of the rectangle divide equally between the two open triangles cut out by the rational line. Eisenstein’s argument uses a carefully chosen half-rectangle and then retains only the parity of a related count. Dedekind sums will instead remember where every step of the lower staircase occurs and how far it sits below the line.
The floor sum knows only the total number of points below the line. It forgets the shape of the staircase. To retain that shape, introduce formal variables and
, and define the Carlitz polynomial
The monomial labels the lattice point
. Its
-exponent records horizontal position and its
-exponent records vertical position. It is useful to think of
not as a generating function for every lattice point below the line, but as a generating function for the horizontal edges of the lower staircase. Indeed, multiplying one monomial by
gives
. These two terms correspond to the right and left endpoints of the horizontal edge at height
.
The staircase also has vertical edges. Define for
. The vertical edge at level
goes from
to
, so its contribution is
. Summing these vertical edges produces
, where the variables are reversed because transposing the picture exchanges horizontal and vertical coordinates.
The horizontal and vertical edges fit together into one monotone lattice path from to
. The reason is that
precisely when
, or equivalently
. Thus the horizontal edges at height
occur consecutively between the appropriate vertical edges. No gaps occur, and no edge is repeated. When all oriented edges are added, every interior vertex appears once with positive sign and once with negative sign. The intermediate vertices cancel exactly. Only the first and last vertices survive, giving the Dedekind–Carlitz reciprocity identity
This is already a reciprocity law. The ordinary statement that two rational triangles complement one another inside a rectangle has become a weighted identity. Instead of assigning the weight to each lattice point, we have assigned each step a monomial that remembers its exact position. The cancellation remains the same, but it now happens edge by edge and monomial by monomial.
For example, take and
. Then the staircase heights are
, so
. On the transposed side one has
. The identity becomes
. Geometrically, this is the telescoping path
: every middle vertex cancels, leaving only the initial and terminal ones.
The Carlitz identity contains the original floor-sum relation as a very low-order consequence. Differentiate once with respect to and once with respect to
, then set
. For a horizontal-edge monomial, one obtains
.
Similarly, the vertical contribution gives . Thus the differentiated Carlitz identity becomes
This is simply the statement that the two open triangles fill the interior of the rectangle. The first derivative therefore recovers an unweighted count. Higher derivatives recover more refined data: sums of horizontal coordinates, sums of heights, mixed coordinate sums, and eventually the centered mixed statistic that defines the Dedekind sum. In this sense, the floor-sum identity is the lowest-order shadow of a richer finite generating-function identity.
There is also a useful cone interpretation. For a lattice set , write
. The first quadrant has generating function
.
Split the quadrant along the ray through . The upper cone is generated by
and
, while the lower half-open cone is generated by
and
. Their fundamental parallelograms contain, respectively, the lattice points
for
, and
for
. Since coprimality gives
, the two cone series are
The cone series of the ray joining and
is
. The sum of all these three cone series is the generating function of the first quadrant. Clearing denominators gives the Carlitz identity again. Thus the finite staircase relation is also the numerator identity produced by decomposing a rational cone into two simpler cones. This viewpoint is useful because the same pattern persists in higher-dimensional lattice-point geometry.
To pass from an unweighted lattice count to Dedekind reciprocity, we must stop measuring only the heights and instead measure the error between the line and the staircase. Write
for the fractional part, and define the sawtooth function by

For coprime , the Dedekind sum is
Neither nor
is an integer in this range, so the sawtooth factors are simply centered fractional parts. Put
and
. Since
, we can write
This formula explains the geometric content of the Dedekind sum. The quantity is the centered horizontal location of the
-th step. The quantity
is the centered vertical discrepancy between the line and the staircase at that step. Their product measures whether a step lying to one side of the midpoint tends to lie above or below its typical vertical error. Thus
is a covariance-like mixed second moment of position and deviation. It is not merely a second moment of the raw staircase heights. The centering by
removes the average linear behavior and isolates the oscillatory arithmetic part of the staircase.
To make this statistic emerge from the Carlitz polynomial, introduce the centered exponential transform
This is the generating function of the centered data. It is related to by a simple shear of coordinates. Set
and
. Then the monomial
has exponent
. Multiplication by the fixed factor
changes this exactly into
. Therefore
The meaning of the substitution is important. The original -variable measured raw vertical height. The new
-variable measures vertical error relative to the line. A horizontal movement of one unit carries a compensating
vertical contribution, so the quantity that remains is
, namely the fractional part of
. The coordinate system has been sheared to align with the rational slope.
Multiplication by permutes the nonzero residue classes modulo
. Consequently, the values
for
are merely a rearrangement of
. Hence
and
. The two square sums agree, and their common value is
The vanishing of the linear terms means that the first nontrivial information in the Taylor expansion of occurs at quadratic order. Expanding the exponential term by term gives
where denotes terms of total degree at least
. The coefficient of
is exactly
. Thus Dedekind’s sum is literally encoded in the quadratic Taylor expansion of the centered staircase transform.
The Carlitz identity is exact, so after the change of variables it remains exact. Let . The choice of
is forced by the transposed staircase: it makes the variables in
become the variables defining
. Substituting the centered transforms into the Carlitz identity gives
This formula may look complicated, but its meaning is simple. It is still the same path identity: horizontal edges plus vertical edges telescope to the two endpoints. The only change is that the coordinates have been sheared and centered so that the quadratic terms measure Dedekind sums rather than raw staircase heights. Write and
. The quadratic expansions are
To obtain reciprocity, compare the coefficient of in the exact identity. This is the first coefficient at which both
and
occur. In the first term, write
. The relevant contributions come from
, from
, and from the cubic term
. Their total is
.
For the second term, the degree-one part of is
. Since
, the coefficient of
in the quadratic part
equals
. Multiplying by
gives the corresponding contribution. There is also a contribution from the constant term
in
: the coefficient of
in
is
. The right side contributes
. Thus coefficient comparison gives
Now substitute and
. The remaining calculation is a simplification of rational functions in
and
. After collecting terms, one obtains
Equivalently, in the standard symmetric form,
This is Dedekind-sum reciprocity. The formula has emerged from the same finite staircase that gave the elementary floor-sum identity. The difference is that we no longer look merely at the number of lattice points below the line; we retain the centered mixed second-order information contained in the staircase.
Eisenstein’s proof of quadratic reciprocity and the present argument should therefore be viewed as two readings of the same rational lattice picture. Eisenstein counts suitable points in a half-rectangle and retains a parity-sensitive quantity; Gauss’s lemma then turns that parity into a quadratic-residue sign. The Dedekind-sum argument keeps the full lower staircase. The Carlitz polynomial records its horizontal and vertical edges one by one, and the centered transform measures both the horizontal position of each step and the fractional error between the step and the rational line. More precisely, Eisenstein’s argument records a parity-sensitive lattice count, whereas Dedekind reciprocity records the centered covariance between position and slope error.
This is why lattice paths, rational cones, generating functions, and reciprocity laws belong together. A rational line cuts a rectangle into complementary lattice regions. The common boundary is a finite staircase. The path identity gives a polynomial reciprocity law. Low derivatives recover ordinary lattice counts, while centered quadratic terms recover Dedekind sums. In higher-dimensional cone decompositions, the same mechanism produces higher Dedekind sums, Todd-polynomial corrections, and Ehrhart-type reciprocity formulas.