COMPUTING DEDEKIND SUMS USING THE EUCLIDEAN ALGORITHM Anita Buckley University of Ljubljana, Department of Mathematics 1000 Ljubljana, Jadranska 19, Slovenia [email protected](Anita Buckley) Abstract This paper presents an algorithm for computing Dedekind sums σi 1r (a1 , . . . , an ) by using the Euclidean algorithm and algebraic properties of σi . In Theorem 2.2 an explicit relation between a polynomial α with rational coefficients, which is obtained by the Euclidean algorithm, and σ0 , σ1 , . . . , σr−1 will be determined. The main advantage of the algorithm is that by knowing α all σi can be calculated simultaneously. When a1 , . . . , an are relatively prime to r, the algorithm can be put in a particularly simple and compact form. Several examples are explicitly computed by using Mathematica. Definition 0.1 Fix positive integers r and a1 , . . . , an . The sums σi are defined by X 1 εi σi = , a1 ) · · · (1 − εan ) r (1 − ε ε∈µr (1) εai 6=1 ∀i=1,...,n where ε runs over rth roots of unity. It is obvious that σi = σr+i . Therefore we only need to consider σi for i = 0, 1, . . . , r − 1 and call it the ith Dedekind sum. If we want to stress that not all a1 , . . . , an are relatively prime to r, then σi is called the ith generalised Dedekind sum. When a1 , . . . , an are relatively prime to r the above sum is taken over all rth roots of unity. Let n Y 1 − tr A= (1 − tai ) and B = . (2) 1−t i=1 Then by the Euclidean algorithm there exist polynomials α, β ∈ Q(t) such that B . (3) 1 = αA + β hcf (A, B) Qn 1−tr r−1 ai . This way obtained α is called the Inverse of i=1 (1 − t ) modulo 1−t = 1 + t + · · · + t Keywords: Dedekind sums, Euclidean algorithm, computing. Presenting Author’s Biography Anita Buckley. Her main research area is algebraic geometry. Currently a teaching assistant for mathematics at the University of Ljubljana. Completed PhD in Mathematics at the University of Warwick, England in 2003. Graduated in theoretical mathematics at the University of Ljubljana, Slovenia in 1998. 1 Introduction There is an abundant amount of literature on Dedekind sums, appearing in many areas of mathematics such as analytic number theory [5], topology [7], combinatorial geometry [10], algorithmic complexity [8] and singularity theory [11, 4]. Dedekind sums were among many others studied also by Berndt, Carlitz, Grosswald, Knuth, Rademacher and Zagier. In a recent book [2] on this topic, the authors Beck and Robins connect the Dedekind sums to the ’coin exchange problem’ and also to the number of lattice points inside a certain polyhedra. From here the discrete volume and the normal (or continuous) volume of polyhedra and polytopes can be computed. Recent research is focused on finding properties and relations among Dedekind sums that would simplify their computation [1]. The existing methods for evaluating such sums are factorisation, multisection and third most powerful method of partial fractions [6]. The main objective of this paper is to describe an algorithm for computing Dedekind sums using the Euclidean algorithm. The Sequential arithmetic time and Parallel arithmetic complexity of the Euclidean algorithm are well understood [3]. In practice the fast Fourier transform (FFT) algorithm is used. In this section we will relate the Inverse function to Dedekind sums. More precisely, we will find an equality connecting the polynomials and r−1 X i i ξi t an arbitrary B hcf(A,B) . Then P X σr−i ti . (4) i=0 Remark 2.1 Running the Euclidean algorithm on a computer gives α supported on monomials 1, t, . . . , tr−2−deg hcf(A,B) . Note also that α with such support is unique. We begin with two obvious equalities among Dedekind sums: ξi σi = 0, P i since i ξi ε = 0 for all ε ∈ µr such that ai ε 6= 1 ∀i = 1, . . . , n. This follows directly from the definitions of B and σi . In particular, if applied Pr−1 on B then i=0 σi = 0 always holds. We proceed by giving an alternative description of the Inverse function α. For all ε ∈ µr define Aε = 1 (1−εa1 )···(1−εan ) , 0, if εai = 6 1 ∀i = 1, . . . , n if εai = 1 for some i. The expression Aε can be written as a polynomial in ε with coefficients in Q. Moreover, in the proof of Theorem 2.2 a polynomial P (t) will be constructed such that P (ε) = Aε for all ε ∈ µr . Observe that whenever εai 6= 1 for all i = 1, . . . , n also For example, when r is prime one can simply substitute ε with t in the polynomial expression of Aε to obtain α. Theorem 2.2 Fix Qn positive integers r andr a1 , . . . , an . The Inverse of i=1 (1 − tai ) modulo 1−t 1−t denoted by α equals Pr−1 i=0 σr−i ti modulo the polynomial hcf ( r−1 Qn 1+t+···+t ai ),1+···+tr−1 . ) i=1 (1−t P ROOF From now on fix a generator ε ∈ µr and denote the polynomial r−1 X = σi Aεj tj j=1 1 r εi ε∈µr , εai 6=1 (1−εa1 )···(1−εan ) = ε−i ε∈µr , εai 6=1 (1−ε−a1 )···(1−ε−an ) = P P P (−1)n r1 ε∈µr , εai 6=1 εa1 +···+an −i (1−εa1 )···(1−εan ) (−1)n σa1 +···+an −i and (5) i (i) 1 r multiple of the α(ε) = Aε = P (ε) holds by (3). 2 The main theorem α (ii) Denote by polynomial = by p(t). Then p(0) = 0, p(1) = rσ0 , .. . p(εi ) = rσi , .. . p(εr−1 ) = rσr−1 . (6) The above formulae can be considered as a linear system of r equations in Aεj and variable ε 0 1 1 1 ... 1 Aε ε ε2 . . . εr−1 1 2 4 2(r−1) Aε2 ε ε ... ε 1 .. ... ... ... ... . r−1 1 ε ... ... ε Aεr−1 = r σ0 σ1 σ2 .. . σr−1 . Since the Vandermonde matrix is invertible, we can solve the system and obtain Aεk = = Pr−1 σi εk(r−i) i=0 Pr−1 i=0 σr−i εki for k = 1,2, . . . ,r − 1. 3 The computing algorithm The Euclidean algorithm and Theorem 2.2 will be used to calculate σi r1 (a1 , . . . , an ) for i = 0, 1, . . . , r − 1. We will split the description of our method into three steps. As before denote A= n Y (1 − tai ) i=1 A B hcf (A, B) and A1 = Aε0 = σi = α(t) = r−1 X σr−i ti + γ(t) (8) Lemma 3.1 Equalities (i) and (ii) uniquely determine γ. σr−i = 0. P ROOF Write This proves that for all ε ∈ µr the polynomial P (t) = B . hcf (A, B) i=0 i=0 r−1 X to obtain α. Step II) Recall that by Remark 2.1 thus obtained polynomial α(t) is spanned on 1, t, . . . , tr−2−deg hcf(A,B) . By Theorem 2.2 there exists a unique polynomial γ(t) ∈ Q(t) of degree hcf (A, B) such that Moreover, by (ii) r−1 X 1 − tr . 1−t Step I) Run the Euclidean algorithm on i=0 r−1 X B= and σr−i t i α(t) = (7) r−1 X αi ti . (9) i=0 i=0 evaluated in ε equals Aε . Since we are working over algebraically closed C, our polynomial P (t) is uniquely determined by its r values and support 1, t, . . . , tr−1 . On the other hand recall that for all We will separate cases for n odd or even. ε ∈ µr such that εai 6= 1 ∀i = 1, . . . , n the Inverse function α(ε) equals Aε = P (ε). This means that α(t) − P (t) (t − ε∈µr εai 6=1 ∀i=1,...,n σi = (−1)n σa1 +···+an −i . ε) 1−tr ai i=1 (1−t ), 1−t Qn −σa1 +···+an −r+i = − αr−a1 +···+an +i − γ) . From this ) for somepolynomial γ with rational coefficients of deQn 1−tr ai gree hcf i=1 (1 − t ) , 1−t . In other words 1−tr 1−t α(t) ≡ P (t) modulo hcf Q n i=1 (10) Therefore αi − γ = σr−i equals = 1−tr 1−t ( When n is odd compare the coefficients at ti and tr−a1 +···+an +i in (8), where denotes the smallest nonnegative residue mod r. Recall from (i) that = Q γ(t) γ(t) hcf For the sake of simpler notation we will restrict the proof to hcf (A, B) = 1 which holds if and only if a1 , . . . , an are relatively prime to r. In this case γ is a constant. The general case can be proved in the same way by using equalities (i) and (ii) and comparing the coefficients in (8). r (1 − tai ) , 1−t 1−t . γ= 1 αi + αr−a1 +···+an +i 2 (11) for any and thus for all i = 0, . . . , r − 1. When n is even we use equality (ii) to determine γ: r−1 X i=0 αi − rγ = r−1 X i=0 σi = 0 implies γ= r−1 1X r αi . (12) i=0 Step III) By (8) the ith coefficient of the above obtained B polynomial α − γ hcf(A,B) is exactly σr−i . 4 Examples In the following examples it will be shown how to use Mathematica to compute the polynomials α and γ. In this way all Dedekind sums σi are calculated simultaneously. In[1] := PolynomialExtendedGCD[ (1 − t4 )(1 − t5 )2 (1 − t7 )(1 − t10 )(1 − t14 ), PolynomialQuotient[1 − t33 , 1 − t, t]] 2 3 4 40 t t 7t Out[1] := {1, { 113 + 3711t + 568 27 + 11 297 + 11 1135 t6 30 t7 15 t8 541 t9 47 t5 + 11 + 297 + 11 + 11 + 297 + 4 t10 t12 15 t13 30 t14 1135 t15 47 t16 +4 t11 + 541 297 18 + 11 19 + 11 20 + 297 21 + 1123 17 t t 37 t 40 t 113 t + 711 + 568 + 2911t 297 + 1125 + 1126 + 27 28 41 t 40 t 161 t27 1054 t24 + 297 + 11 + 11 − 297 + 4011t 29 30 31 t + 4111t + 1054 + 2911t , 297 44 134 t 3 t2 53 t42 271 t43 86 − 27 − 297 + 11 +· · ·− 297 − 297 − 2911t }}. In step II) γ is calculated using (4) since n = 6 is even. Thus Load the standard package << Algebra‘PolynomialExtendedGCD‘. Example 4.1 We start with examples where a1 , . . . , an are relatively prime to r. 1 (4, 5, 12) : 23 In step I) α and β are calculated by γ= 31 1 2431 1 X 221 αi = = . 33 i=0 33 27 81 Step III) yields σi as the coefficient at t33−i in In[2] := • σi α − γ PolynomialQuotient[ 1 − t33 , 1 − t, t] 118 809 t 566 t2 727 t3 1864 t4 81 5+ 891 + 8917 − 891 8− 891 9 6 t t t t t + 1376 + 974 − 891 − 1216 − 808 891 891 891 13 89114 11 12 10 t 1216 t t − 891 + 10381t + 10381t − 808 891 − 891 974 t15 1376 t16 1864 t17 727 t18 566 t19 + 891 + 891 − 891 − 891 + 891 22 t20 118 t21 t23 t24 + 809 − 22181t − 82891 + 731 891 + 81 89128 26 27 25 809 t 2914 t t t + 809 + 890 891 29+ 891 30− 891 891 890 t 731 t 82 t31 221 t32 + 891 + 891 − 891 − 81 . Out[2] := In[1] := PolynomialExtendedGCD[ (1 − t4 )(1 − t5 )(1 − t12 ), PolynomialQuotient[1 − t23 , 1 − t, t]] 2 3 4 5 5 t Out[1] := {1, {− 23 − 323t − 23 − 623t − 223t + 423t 5 t6 6 t7 13 t8 3 t10 11 t11 t12 t13 + 23 − 23 − 23 + 23 − 23 − 323 − 323 15 16 17 19 20 14 t t t t21 t − 923 − 623 + 723 − 1123t − 1023t − 423 , + 523 2 3 4 5 6 28 25 t 2t 5t 9t 9t 3t 8 t7 − − + − − + + 23 8 23 9 23 10 23 23 23 23 2314 12 t t11 t13 t + 623t + 223t + 223 + 223 − 2623t + 423 + 423 11 t16 11 t17 t18 6 t19 4 t20 3 t15 − 23 + 23 + 23 − 23 − 23 − 23 }}. In step II) γ is calculated using (3) since n = 3 is odd. Thus γ= 1 (4, 5, 5, 7, 10, 14) : 33 Step I) computes α by • σi 1 1 3 α0 + α23−4+5+12 = (α0 + α2 ) = − . 2 2 23 In step III) we obtain σi as the coefficient at t23−i in In[2] := α − γ PolynomialQuotient[ 1 − t23 , 1 − t, t] Out[2] := 2 3 4 It is easy to verify that σ0 = −σ21 , σ22 = −σ22 = 0, . . . as expected. 5 6 t 2 + 223t − 323t + 23 + 723t + 823t − 23 7 8 9 t10 t11 − 323t − 1023t + 323t + 623 − 823 14 15 16 17 t t t t18 + 823 − 623 − 323 + 1023t + 323 21 t20 t22 t19 − 723 − t23 + 323 . − 823 Example 4.2 In the following examples we consider two generalised Dedekind sums, where not all a1 , . . . , an are relatively prime to r. In this case γ(t) is a polynomial of degree hcf (A, B) which will be computed by generalising the proof of Lemma 3.1. 1 (1, 2, 3) : 12 In this case hcf (A, B) = (1 + t)(1 + t + t2 ). Thus in step I) α is obtained by running the Euclidean algorithm on In[1] := PolynomialExtendedGCD[ (1 − t)(1 − t2 )(1 − t3 ), PolynomialQuotient[ 1 − t12 , (1 − t)(1 + t)(1 + t + t2 ), t]] • σi 2 4 5 6 7 7 Out[1] :={1, { 12 + 512t − t4 + t4 + t2 − t3 + 1112t , 19 7t 11 t2 4 t3 t4 11 t5 12 + 12 − 12 − 3 − 3 + 12 }}. In step II) we determine γ = γ0 + γ1 t + γ2 t2 + γ3 t3 . From (i) it follows σ0 = −σ6 σ1 = −σ5 σ7 = −σ11 σ3 = −σ3 = 0 σ2 = −σ4 σ8 = −σ10 σ9 = −σ9 = 0. Moreover, (ii) and Since 11 X 1 − t12 = 1 − t + t 2 + t6 − t7 + t8 (1 − t)(1 + t)(1 + t + t2 ) σ12−i ti i=0 equals imply α−γ σ0 − σ1 + σ2 + σ6 − σ7 + σ8 = 0. By comparing the coefficients in 11 X σ12−i ti and α − γ i=0 we get 7 σ0 = − 12 − γ0 1 + γ0 − γ1 σ11 = − 12 σ10 = 41 + γ1 − γ2 5 − γ0 + γ2 − γ3 σ9 = − 12 5 σ8 = − 12 − γ1 + γ3 − γ4 5 + γ0 − γ2 + γ4 − γ5 σ7 = 12 σ6 = −γ0 + γ1 − γ3 + γ5 σ5 = −γ1 + γ2 − γ4 σ4 = −γ2 + γ3 − γ5 σ3 = −γ3 + γ4 σ2 = −γ4 + γ5 σ1 = −γ5 . 1 − t12 (1 − t)(1 + t)(1 + t + t2 ) the above translates into the following system of equations 7 − γ0 = 31 + γ0 − 12 11 12 −γ0 + γ1 − γ2 = γ2 − γ3 + γ0 − γ1 = γ3 −γ1 + γ2 − γ3 = 0 and 7 1 1 1 − −γ0 +γ3 −γ2 +γ3 − −γ0 − +γ3 + −γ2 +γ3 = 0. 12 3 2 4 Its solution is Next apply (ii) on the following multiples of In step III) we obtain σi as the coefficient at t12−i in α − γ PolynomialQuotient[ 1 − t12 , (1 − t)(1 + t)(1 + t + t2 ), t] − 81 − Out[2] := • σi In this case hcf (A, B) = = 2 5t 24 Recall that by (i) σi = σ1+2+3+4−i = σ10−i holds for i = 0, 1, . . . , 11. 11 t 11 t2 7 t3 γ=− + + + . 24 6 24 24 In[2] := 4 5 B hcf(A,B) = B hcf(A,B) : 1−t12 (1−t)(1+t)(1+t2 )(1+t+t2 ) 3 5 6 =1−t+t −t +t , B hcf(A,B) (1 + t + t 2 ) = 1 + t4 + t8 , 6 t t − 12 + 12 + 524t + t8 7 8 10 t11 + 724t + t6 − t6 − 724 . = B 2 hcf(A,B) (1 + t)(1 + t ) B 2 3 hcf(A,B) (1 + t + t + t ) 3 6 9 = 1+t +t +t 1 (1, 2, 3, 4) : 12 and B. Therefore (1 + t)(1 + t2 )(1 + t + t2 ) σ0 − σ1 + σ3 − σ5 + σ6 = 0, σ0 + σ4 + σ8 = 0, σ0 + σ3 + σ6 + σ9 = 0, P11 i=0 σi = 0. (1 + t + t2 )(1 + t + t2 + t3 ). Step I) calculates α by running the Euclidean algorithm on In[1] := PolynomialExtendedGCD[ (1 − t)(1 − t2 )(1 − t3 )(1 − t4 ), PolynomialQuotient[ 1 − t12 , (1 − t)(1 + t)(1 + t2 )(1 + t + t2 ), t]] 2 1 − t12 (1 − t)(1 + t)(1 + t2 )(1 + t + t2 ) 3 4 5 7 t Out[1] := {1, {− 12 − 12 + t4 − 512t − 512t + 512t , 3 4 5 13 t t2 19 − 5 6t − 5 3t − t3 12 + 126 + 6 7 8 9 t t + t6 + 56t + 512 − 512 }}. In step II) we determine γ = γ0 + γ1 t + γ2 t2 + γ3 t3 + γ4 t4 + γ5 t5 . The system of the above equations has a unique solution γ=− 37 11 t 5 t2 t3 t4 7 t5 − − + + + . 72 24 36 18 8 72 Finally, in step III) we obtain σi as the coefficient at t12−i in In[2] := α−γPolynomialQuotient[ 1 − t12 , (1 − t)(1 + t)(1 + t2 )(1 + t + t2 ), t] Out[2] := 2 3 4 5 t 5 − 536t − 572t − 772t − 36 + 572t − 72 7 t7 7 t8 5 t9 t10 t11 7 t6 . + 72 + 36 + 72 + 72 − 36 − 772 5 References [1] M. Beck. Dedekind Sums: A Geometric Viewpoint. www.math.sfsu.edu/beck, (2006). [2] M. Beck and S. Robins. Computing the Continuous Discretely. Undergraduate Texts in Mathematics XVIII, Springer Verlag (2007). [3] D. Bini and V. Pan. Polynomial and Matrix Computations. Vol. 1, Progress in Theoretical Computer Science, Birkhäuser (1994). [4] A. Buckley and B. Szendroi. Orbifold Riemann-Roch for threefolds with an application to Calabi-Yau geometry. J. Algebraic Geom. 14 (2005), 601-622. [5] R. Dedekind. Erlauterung zu den Fragmenten XXVIII. B. Riemann, Ges. Math. Werke, Leipzig, (1892), SS. 466-478; Dedekind’s Ges. Werke I, (1930), SS. 159-172. [6] I. M. Gessel. Generating functions and generalised Dedekind sums. The Electronic Journal of Combinatorics 4, no. 2 (1997). [7] F. Hirzebruch and D. Zagier. The AtiyahSinger Theorem and Elementary Number Theory. Mathematics Lecture Series 3 (1974), Publish or Perish, Boston. [8] D. E. Knuth. The art of computer programming. volume 2, 2nd edition, Addison-Wesley, Reading, Massachusetts, (1981). [9] C. Meyer. Uber einige Anwendungen Dedekindscher Summen. Journal für r. u. a. Mathematik 198, 143–203 (1957). [10] L. J. Mordell. Lattice points in a tetrahedron and generalized Dedekind sums. J. Indian Math. 15 (1951), 41–46. [11] M. Reid. Young person’s guide to canonical singularities. Algebraic Geometry, Bowdoin 1985, ed. S. Bloch, Proc. of Symposia in Pure Math. 46, A.M.S. (1987), vol. 1, 345–414.
© Copyright 2026 Paperzz