# Sum : $\sum \sin \left( \frac{(2\lfloor \sqrt{kn} \rfloor +1)\pi}{2n} \right)$.

Calculate : $$\sum_{k=1}^{n-1} \sin \left( \frac{(2\lfloor \sqrt{kn} \rfloor +1)\pi}{2n} \right).$$

-

Lemma Summation by Pasts (1) $$\sum_{k=a}^b f_k\Delta g_k=f_kg_k\Bigg|_{k=a}^{b+1}-\sum_{k=a}^b g_{k+1}\Delta f_k=f_{b+1}g_{b+1}-f_ag_a-\sum_{k=a}^b g_{k+1}\Delta f_k$$ $\displaystyle \text{with difference operator }\Delta :\qquad \Delta f_k=f_{k+1}-f_k$

My solution

$\text{Get }j=\left\lfloor \sqrt{kn}\right\rfloor\Rightarrow j\le \sqrt{kn}<j+1\Rightarrow \dfrac{j^2}{n}\le k<\dfrac{(j+1)^2}{n}$

Therefore if $\left\lfloor\dfrac{j^2}{n}\right\rfloor+1\le k\le \left\lfloor\dfrac{(j+1)^2}{n}\right\rfloor$ then $\sqrt{kn}=j$

Note:

$j=0\Rightarrow \left\lfloor\dfrac{j^2}{n}\right\rfloor+1=1$

$j=n-2\Rightarrow \left\lfloor\dfrac{(j+1)^2}{n}\right\rfloor=n-2$

$j=n-1\Rightarrow \left\lfloor\dfrac{(j+1)^2}{n}\right\rfloor=n>n-1$

So that sum became

\begin{align*}S&=\sum_{k=1}^{n-1}\sin\left(\dfrac{\left(2\lfloor\sqrt{kn}\rfloor+1\right)\pi}{2n}\right)\\ &=\sin\left(\dfrac{\left(2\lfloor\sqrt{(n-1)n}\rfloor+1\right)\pi}{2n}\right)+\sum_{k=1}^{n-2}\sin\left(\dfrac{\left(2\lfloor\sqrt{kn}\rfloor+1\right)\pi}{2n}\right)\\ &=\sin\left(\frac{(2n-1)\pi}{2n}\right)+\sum_{j=0}^{n-2}\left(\left\lfloor\frac{(j+1)^2}{n}\right\rfloor-\left\lfloor\frac{j^2}{n}\right\rfloor\right)\sin\left(\frac{(2j+1)\pi}{2n}\right)\\ &=\sin\left(\frac{\pi}{2n}\right)+\sum_{j=0}^{n-2}\Delta\left(\left\lfloor\frac{j^2}{n}\right\rfloor\right)\sin\left(\frac{(2j+1)\pi}{2n}\right)\end{align*} Using the 1, we get \begin{align*}S&=\sin\left(\frac{\pi}{2n}\right)+\left[\sin\left(\frac{(2j+1)\pi}{2n}\right)\left\lfloor\frac{j^2}{n}\right\rfloor\right]_{j=0}^{n-1}\\ &{}\quad -\sum_{j=0}^{n-2}\left\lfloor\frac{(j+1)^2}{n}\right\rfloor\left(\sin\left(\frac{(2j+3)\pi}{2n}\right)-\sin\left(\frac{(2j+1)\pi}{2n}\right)\right)\\ &=(n-1)\sin\left(\frac{\pi}{2n}\right)-2\sin\left(\frac{\pi}{2n}\right)\sum_{j=0}^{n-2}\left\lfloor\frac{(j+1)^2}{n}\right\rfloor\cos\left(\frac{(j+1)\pi}{n}\right)\\ &=(n-1)\sin\left(\frac{\pi}{2n}\right)-2\sin\left(\frac{\pi}{2n}\right)\underbrace{\sum_{j=1}^{n-1}\left\lfloor\frac{j^2}{n}\right\rfloor\cos\left(\frac{j\pi}{n}\right)}_{=A}\end{align*}

With sum A, using reverse summand property we get \begin{align*}A&=\sum_{j=1}^{n-1}\left\lfloor\frac{j^2}{n}\right\rfloor\cos\left(\frac{j\pi}{n}\right)\\ &=\sum_{j=1}^{n-1}\left\lfloor\frac{(n-j)^2}{n}\right\rfloor\cos\left(\frac{(n-j)\pi}{n}\right)\\ &=-\sum_{j=1}^{n-1}\left\lfloor n-2j+\frac{j^2}{n}\right\rfloor\cos\left(\frac{j\pi}{n}\right)\\ &=-A+\sum_{j=1}^{n-1}(2j-n)\cos\left(\frac{j\pi}{n}\right)\\ \Rightarrow A&=\frac{1}{2}\sum_{j=1}^{n-1}(2j-n)\cos\left(\frac{j\pi}{n}\right)\end{align*}

We get

$\displaystyle\cos\left(\frac{j\pi}{n}\right)=\dfrac{1}{2\sin\left(\frac{\pi}{2n}\right)}\left[\sin\left(\frac{(2j+1)\pi}{2n}\right)-\sin\left(\frac{(2j-1)\pi}{2n}\right)\right]=\dfrac{1}{2\sin\left(\frac{\pi}{2n}\right)}\Delta\left[\sin\left(\frac{(2j-1)\pi}{2n}\right)\right]$

continue using 1 :)

$\displaystyle A =\left.\dfrac{(2j-n)}{4\sin\left(\frac{\pi}{2n}\right)}\sin\left(\frac{(2j-1)\pi}{2n}\right)\right|_{j=1}^{n}-\dfrac{1}{4\sin\left(\frac{\pi}{2n}\right)}\sum_{j=1}^{n-1}2\sin\left(\frac{(2j+1)\pi}{2n}\right)$

\begin{align*}A&=\frac{n-1}{2}+\dfrac{1}{4\sin^2\left(\frac{\pi}{2n}\right)}\sum_{j=1}^{n-1}\Delta\left[\cos\left(\frac{j\pi}{n}\right)\right]\\ &=\frac{n-1}{2}+\dfrac{1}{4\sin^2\left(\frac{\pi}{2n}\right)}\cdot\left.\cos\left(\frac{j\pi}{n}\right)\right|_{j=1}^n\\ &=\frac{n-1}{2}-\dfrac{1+\cos\left(\frac{\pi}{n}\right)}{4\sin^2\left(\frac{\pi}{2n}\right)}\\&=\frac{n-1}{2}-\dfrac{2\cos^2\left(\frac{\pi}{2n}\right)}{4\sin^2\left(\frac{\pi}{2n}\right)}\end{align*}

Therefore:

\begin{align*}S&=(n-1)\sin\left(\frac{\pi}{2n}\right)-2\sin\left(\frac{\pi}{2n}\right)A\\ &=(n-1)\sin\left(\frac{\pi}{2n}\right)-(n-1)\sin\left(\frac{\pi}{2n}\right)+\dfrac{\cos^2\left(\frac{\pi}{2n}\right)}{\sin\left(\frac{\pi}{2n}\right)}\\ &=\boxed{\displaystyle\cot\left(\frac{\pi}{2n}\right)\cos\left(\frac{\pi}{2n}\right)}\end{align*}

-

Put $h^2=kn$ so that you sum is $\displaystyle \sum_{h=\lfloor \sqrt{n} \rfloor}^{\lfloor \sqrt{n(n-1)} \rfloor} \sin \left( \frac{(2h +1)\pi}{2n} \right)$.

Edit: first note that $\lfloor \sqrt{n(n-1)} \rfloor=n-1$ and that $\lfloor \sqrt{kn} \rfloor=h$ if and only if $\frac{h^2}n\leq k \leq \frac{h^2}n+\frac{2h}n$, so that the um became: $\displaystyle \sum_{h=\lfloor \sqrt{n} \rfloor}^{n-1} \left(\lceil\frac{h^2}n \rceil-\lfloor\frac{h^2+2h}n \rfloor+1\right)\sin \left( \frac{(2h +1)\pi}{2n} \right)$.

-
I don't think that this works because the floor makes the summand non-injective (but it is injective in your sum). – aziiri May 28 '13 at 8:49
You are right, I edit my answer. – Fabio Lucchini May 28 '13 at 9:15
Thank you, but the floor still there. – aziiri May 28 '13 at 9:24