# Finite sum $\sum_{k=1}^{p-1} \frac{1-\cos\left(\frac{2\pi k r}{p}\right)}{1-\cos\left(\frac{2\pi k s}{p}\right)}$ for $\gcd(p,rs)=1$.

I am wondering if there is a closed form to the following finite sum:

$$\sum_{k=1}^{p-1} \frac{1-\cos\left(\frac{2\pi k r}{p}\right)}{1-\cos\left(\frac{2\pi k s}{p}\right)},$$

where $\gcd(p,rs)=1$ and $r,s,p$ are positive integers, and if so how would I go about figuring out the closed form?

EDIT: I arrived at this sum as I am investigating the value of the $T_2$-norm of units in the cyclotomic ring $\mathbb{Z}(\zeta_{p})$ for prime $p$. The $T_2$-norm of an element $x \in K$ for some number field $K$ of degree $n$ is defined:

$$||x|| = \left(\sum_{i=1}^n |\sigma_i(x)|^2\right)^{1/2},$$

where $\{\sigma_1, \dots, \sigma_n\}$ are the embeddings of $K$ and $|x|^2 = x\bar{x}$ where the bar represents complex conjugation.

Lemma: For $\gcd{(rs,p)}=1$, $\frac{\zeta^r -1}{\zeta^s -1}$ is a unit of $\mathbb{Z}(\zeta_p)$.

Proof: Let $r \equiv st \mod p$. Then $\frac{\zeta^r-1}{\zeta^s-1} = 1 + \zeta^s + \dots + \zeta^{s(t-1)} \in \mathbb{Z}(\zeta_p)$, and its inverse is also in $\mathbb{Z}(\zeta_p)$ by the same logic.

So for unit $u$ of the aforementioned form, we have:

$$|u|^2 = \frac{\zeta^r-1}{\zeta^s-1} \frac{\zeta^{-r}-1}{\zeta^{-s}-1} = \frac{2-(\zeta^r + \zeta^{-r})}{2-(\zeta^{s} + \zeta^{-s})} = \frac{1-\cos(\frac{2\pi r}{p})}{1-\cos(\frac{2\pi s}{p})}.$$

Since $\sigma_k(\zeta_p) = \zeta_p^k$, we have:

$$||u||^2 = \sum_{k=1}^{p-1} \frac{1-\cos(\frac{2\pi k r}{p})}{1-\cos(\frac{2\pi k s}{p})}.$$

• Already the fact that the result is integer is interesting. (+1) How did you find the expression?
– user
Apr 18 '18 at 19:41
• What do you know about Ramanujan sums? Apr 18 '18 at 21:08
• By the way, write \gcd to generate $\gcd$ as opposed to $gcd$ :) Apr 19 '18 at 1:31
• Hi @user, thanks for the upvote! I'm investigating the absolute value of units over cyclotomic fields of the form $\mathbb{Q}(\zeta_{p^a})$ and then summing these absolute values (squared) over all the embeddings, which results in the sum above. Apr 19 '18 at 8:51
• It could be useful if you sketch in the question how you arrived at the sum.
– user
Apr 19 '18 at 9:24

I believe to find a closed form for the sum:

$$\forall r,s,p:\quad\gcd(r s, p)=1:\quad \sum_{k=1}^{p-1} \frac{1-\cos\frac{2\pi k r}{p}}{1-\cos\frac{2\pi k s}{p}}=q(p-q),\tag{1}$$ with $$q=r s^{\phi(p)-1}\text{ mod }p\tag{2},$$ where $\phi(p)$ is Euler's totient function.

The proof of the expression (1) outlined by Jack D'Aurizio can be completed in the following way:

Observing that (1) is a linear combination of Fejér kernels, $F_q(x)$, rewrite it as: $$\sum_{k=1}^{p-1} \left(\frac{\sin\frac{\pi k q}{p}}{\sin\frac{\pi k}{p}} \right)^2 =\sum_{k=1}^{p-1} qF_q\left(\frac{2\pi k}{p}\right) =\sum_{k=1}^{p-1}\sum_{|l|\leq q}\left(q-|l|\right)e^{\frac{lk}{p}2\pi i} =\sum_{|l|\leq q}\left(q-|l|\right)\Phi(l,p),$$ with $$\Phi(l,p)=\sum_{k=1}^{p-1}e^{\frac{lk}{p}2\pi i}= p\delta_{l0}-1.\tag{3}$$ The proof of (3) for $l\ne 0$ follows from the observation that $$\sum_{k=0}^{p-1}e^{\frac{lk}{p}2\pi i}=0,$$ as the sum runs over all roots of the polynomial $z^\frac{p}{\gcd(l,p)}-1$ (each of the roots entering the sum $\gcd(l,p)$ times).

Thus $$\sum_{|l|\leq q}\left(q-|l|\right)\Phi(l,p)=q(p-1)-2\sum_{l=1}^{q-1}l =q(p-1)-q(q-1)=q(p-q),$$ as claimed.

• I'm not sure if it helps, but we have: $$\sum_{k=1}^{p-1} \frac{1-\cos\left(\frac{2\pi k r}{p}\right)}{1-\cos\left(\frac{2\pi k s}{p}\right)} = \frac{\sum_{k=1}^{p-1} \sin^2\left(\frac{\pi k r}{p}\right) \prod_{j \neq k} \sin^2\left(\frac{2 \pi j s}{p}\right)}{\prod_{j=1}^{p-1} \sin^2\left(\frac{\pi j s}{p}\right)} =\frac{\sum_{k=1}^{p-1} \sin^2\left(\frac{\pi k r}{p}\right) \prod_{j \neq k} \sin^2\left(\frac{2 \pi j s}{p}\right)}{p^2},$$ so it would suffice to show the top of the fraction is equal to $p^2 q(p-q)$. Apr 21 '18 at 11:08
• $2\pi$ in the product on the numerator is meant to be $\pi$. Apr 21 '18 at 11:16
• @Chris I have added the proof of the expression.
– user
Apr 23 '18 at 8:05
• Perfect - marked as correct answer. Thank you for all your help Apr 23 '18 at 12:28

First, we can focus on the case where $(r,s) \leq p-1$, as for other cases we just consider the operation $\mod p$.

With a simple trigonometric manipulation, the sum above becomes

$$\sum_{k=1}^{p-1} \left(\frac{\sin(\frac{\pi k r}{p})}{\sin(\frac{\pi k s}{p})} \right)^2 = \sum_{k=1}^{p-1} \left(\frac{ e^{\frac{i\pi k r}{p}} - e^{- \frac{i\pi k r}{p}}}{ e^{\frac{i\pi k s}{p}} - e^{- \frac{i\pi k s}{p}}} \right)^2 = \frac{1}{2} \sum_{k=1}^{\frac{p-1}{2}} \left(\frac{ e^{\frac{i\pi k r}{p}} - e^{- \frac{i\pi k r}{p}}}{ e^{\frac{i\pi k s}{p}} - e^{- \frac{i\pi k s}{p}}} \right)^2.$$

I guess at this point it is possible to apply Ramanujan sums as suggested above, but I am not sure how.

It is interesting to notice that this sum (by simulations) is always an integer number.

The hypothesis ensure that both $r$ and $s$ are invertible in $\mathbb{Z}/(p\mathbb{Z})^*$, hence $$\sum_{k=1}^{p-1} \left(\frac{\sin(\frac{\pi k r}{p})}{\sin(\frac{\pi k s}{p})} \right)^2 = \sum_{k=1}^{p-1} \left(\frac{\sin(\frac{\pi k a}{p})}{\sin(\frac{\pi k}{p})} \right)^2$$ where $a= rs^{-1}\pmod{p}$, by reindexing. By the Fejér kernel $$\left(\frac{\sin\frac{nx}{2}}{\sin\frac{x}{2}}\right)^2=\sum_{|j|\leq n}\left(n-|j|\right) e^{ijx}$$ hence by setting $x=\frac{2\pi k}{p}$, $n=a$ and summing over $k\in[1,p-1]$

$$\sum_{k=1}^{p-1} \left(\frac{\sin(\frac{\pi k a}{p})}{\sin(\frac{\pi k}{p})} \right)^2 = \sum_{k=1}^{p-1}\sum_{|j|\leq a}\left(a-|j|\right) \exp\left(\frac{2\pi ijk}{p}\right)$$ The fact that such sums leads to integers now is straightforward by exchanging $\sum_{k}$ and $\sum_{|j|}$: for any fixed value of $j$, the sum $\sum_{k=1}^{p-1}\exp\left(\frac{2\pi ijk}{p}\right)$ belongs to $\mathbb{Z}$.

• is there an explicit form for the integer value though? I arrived at this result too by the unit expansion I showed when showing the context for my question. Apr 22 '18 at 11:37
• @Chris: well, the explicit form can be derived from computing $\sum_{k}\exp(2\pi i j k/p)$ and exploiting Ramanujan sums. Apr 22 '18 at 16:53
• Thanks for all your help - much appreciated Apr 23 '18 at 12:28