We have already seen two ways to understand Dedekind reciprocity. The Carlitz generating-function proof starts with a rational line and follows its finite lattice staircase: horizontal and vertical edges cancel in pairs, leaving only endpoint terms. The direct Bernoulli proof unfolds the staircase into a finite rectangle and then determines the answer by its variation and average. The cotangent proof looks very different at first, because it uses a meromorphic function rather than lattice points. But it is really another encoding of the same cancellation. The finite Fourier transform converts the periodic sawtooth values along the staircase into cotangents. The two reciprocal Dedekind sums then appear as the residues from two families of nonzero poles, while the elementary rational term in the reciprocity law comes from the one common pole at the origin. Thus the pole at the origin plays exactly the role that the endpoint contribution played in the Carlitz identity.
Let be coprime positive integers. The ordinary Dedekind sum is
where when
, and
when
. We shall prove
The proof has two parts. First, we show that a Dedekind sum is a finite cotangent sum. Second, we put the two cotangent sums into one contour integral.
Define a function on the residue classes modulo by
. Thus
, while
for
. For
, use the finite Fourier transform
The coefficient at vanishes because the sawtooth values have mean zero. Now fix
, and put
. Then
and
. The finite geometric series and its derivative give
Consequently,
The important point is that the cotangent is not introduced mysteriously. It is simply the finite Fourier transform of the periodic linear function . The arithmetic oscillation of the sawtooth is being expressed in its frequency variables.
Apply finite Parseval to and
. Since multiplication by
permutes the residues modulo
, the Fourier transform of
is
, where
is an inverse of
modulo
. Reindexing the resulting sum gives
This is the cotangent form of the Dedekind sum. It is the exact analytic translation of the finite lattice statistic on the left.
Consider the function
The third cotangent factor is essential. It has no extra nonzero pole family inside one period strip, but at the origin it contributes exactly the term in the reciprocity formula. The function
is periodic with period
. Take a rectangle with vertical sides
and
, and horizontal sides
, where
is small. Inside this rectangle are the pole at
, the poles
for
, and the poles
for
.

The nonzero poles from the first two families do not overlap. Indeed, if , then
. Coprimality of
and
would force
, impossible when
. Thus all nonzero poles are simple. The vertical integrals cancel by
-periodicity. On the upper edge, each cotangent tends uniformly to
, so
. Since the upper edge is traversed from right to left, its limiting contribution is
. On the lower edge, each cotangent tends to
, so
; the lower edge is traversed from left to right, and its limiting contribution is again
. Therefore
The residue theorem now gives the basic bookkeeping identity
At a pole , only
is singular, and its residue is
. Hence
After summing over and using the cotangent formula, we get
Likewise, the poles at contribute
These two families are the analytic versions of the two reciprocal staircases in the Carlitz proof. Each family consists of the rational fractions associated with one denominator, and each total residue is exactly the corresponding Dedekind sum.
It remains to compute the residue at . The Laurent expansion is
To obtain the coefficient of in the product of the three cotangents, we must take the linear term from exactly one factor and the principal
terms from the other two. Taking the linear term from the
-factor contributes
The analogous choices from the -factor and the final factor contribute
and
. Thus
This is the analytic counterpart of the endpoint term in the Carlitz identity. All the complicated arithmetic has been assigned to the two nonzero pole families. The remaining correction is determined locally by the common corner .
Adding the residues from the two nonzero families and from the origin gives
Multiplying by proves
The Carlitz proof, the direct Bernoulli-averaging proof, and the cotangent-residue proof all have the same shape beneath their different notation. In the Carlitz identity, the two staircases meet along a path, and all interior vertices cancel. In the direct Bernoulli proof, the two sums unfold into a rectangle, and the interior variation is controlled by periodicity and averaging. In the residue proof, the two nonzero pole families produce the two boundary sums, while the common origin produces the endpoint correction. The three proofs are therefore three ways of saying the same thing: reciprocity is the exact identity left behind after the interior contributions cancel.