Estimation of sum of series with cosine Prove the following:
$$
\sum_{{\large j = 1} \atop {\large j \neq k}}^{n}
{1 \over \left\vert\cos\left(k\pi/ n\right) -
\cos\left(j\pi/n\right)\right\vert} \leq cn^{2}
\qquad\mbox{where}\quad 1 \leq k \leq n\quad\mbox{is fixed.}
$$
I was able to get the upper bound to be $cn^{3}$.
Any method can be used for getting the desired bound.
I also tried taking the upper bound in terms of an integral.
I will appreciate any suggestions.
 A: Since on $(0,\pi/2)$ we have $\frac{2}{\pi}x<\sin x<x$ it follows that
$$ S(n) = \sum_{1\leq j<k\leq n}\frac{1}{\left|\sin\frac{\pi(k-j)}{2n}\sin\frac{\pi(k+j)}{2n}\right|}\sim n\sum_{1\leq j<k\leq n}\frac{1}{(k-j)\sin\frac{\pi(k+j)}{2n}} $$
and by letting $k-j=d$ we get
$$ S(n)\sim n\sum_{d=1}^{n-1}\frac{1}{d}\sum_{j=1}^{n-d}\frac{1}{\sin\frac{\pi(d+2j)}{2n}}$$
where the innermost sum can be regarded as a Riemann sum. Since
$$ \int_{\frac{\pi d}{2n}}^{\pi-\frac{\pi d}{2n}}\frac{dx}{\sin x}=2\log\cot\frac{\pi d}{4n}\sim 2\log\frac{4n}{\pi d} $$
we have
$$ S(n) \sim n^2\cdot  \frac{1}{n}\sum_{d=1}^{n-1}\frac{-2\log\frac{\pi d}{4n}}{\pi \frac{d}{n}}\sim n^2\log^2(n) $$
always by Riemann sums. We cannot improve the bound beyond this since the existence of a constant $c$ such that $S(n)\leq cn^2$ would imply the integrability of $\frac{1}{\left|\cos(x)-\cos(y)\right|}$ over $(0,\pi)^2$, which does not hold.
Numerical experiments confirm that $S(n)$ is not $O(n^2)$. In the following graph we have $\frac{1}{n^2}S(n)$ in blue and $1+\frac{1}{4}\log^2(n)$ in yellow:
$\hspace{2cm}$
If $k\in[1,n]$ is fixed, the same techniques can be applied to
$$ S_k(n) = \sum_{j\neq k}\frac{1}{\left|\sin\frac{\pi(k-j)}{2n}\sin\frac{\pi(k+j)}{2n}\right|}\sim n\sum_{j\neq k}\frac{1}{|k-j|\sin\frac{\pi(k+j)}{2n}}.$$
It is reasonable to expect that the $S_k$s do not differ really much from each other, such that, optimistically, $S_k(n)\ll n\log^2(n)$. By letting $d=k-j$ as before we have
$$S_k(n)\sim n\sum_{\substack{d=k-n\\d\neq 0}}^{k-1}\frac{1}{|d|\sin\frac{\pi(2k-d)}{2n}}$$
and by using $\sin(x)\sim\min(x,\pi-x)$ (for $x\in(0,\pi)$) we have
$$S_k(n)\sim n^2\sum_{\substack{d=k-n\\d\neq 0}}^{k-1}\frac{1}{|d|\min\left(2k-d,2n-2k+d\right)}$$
which can be estimated through
$$ \sum_{d=1}^{k-1}\frac{1}{d(2k-d)}=\frac{1}{2k}\sum_{d=1}^{k-1}\left(\frac{1}{d}+\frac{1}{2k-d}\right)=\frac{H_{2k-1}-\frac{1}{k}}{2k}\ll\frac{\log(k)}{k}\ll\frac{\log(n)}{n}, $$
$$ \sum_{d=1}^{k-1}\frac{1}{d(2n-2k+d)}=\frac{1}{2n-2k}\left[H_{k-1}-H_{2n-k-1}+H_{2n-2k+1}\right]\ll\frac{\log\left(\frac{k(2n-2k)}{2n-k}\right)}{n-k}$$
and the corresponding sums for negative values of $d$. All things considered, $S_k(n)$ really is $\ll n\log^2(n)$.
A simpler alternative is to exploit $\sin(x)\sim x(\pi-x)$ on $(0,\pi)$ and the fact that
$$\tilde{S}_k(n) = \frac{16n^4}{\pi^4}\sum_{j\neq k}\frac{1}{\left|(k-j)(k+j)(2n-k+j)(2n-k-j)\right|}$$
can be computed in explicit terms through partial fraction decomposition and harmonic numbers.
A: By sum-to-product formulae, the sum $S(n)$ equals
$$S(n)=\frac12\sum^n_{j=1}\left|\csc\frac{(j+k)\pi}{2n}\csc\frac{(j-k)\pi}{2n}\right|$$
By Cauchy-Schwarz inequality,
$$S(n)\le\frac12\sqrt{
\underbrace{\sum^n_{j=1}\csc^2\frac{(j+k)\pi}{2n}}_{S_1}
\cdot\underbrace{\sum^n_{j=1}\csc^2\frac{(j-k)\pi}{2n}}_{S_2}}$$
Regarding $S_1$,
$$
\begin{align}
S_1
&=\sum^n_{j=1}\csc^2\frac{(j+k)\pi}{2n} \\
&=\sum^{n+k}_{j=k+1}\csc^2\frac{\pi}{2}\frac jn \\
&=\sum^{n}_{j=k+1}\csc^2\frac{\pi}{2}\frac jn +\sum^{n+k}_{j=n+1}\csc^2\frac{\pi}{2}\frac jn\\
&=\sum^{n}_{j=k+1}\csc^2\frac{\pi}{2}\frac jn +\sum^{k}_{j=1}\csc^2\frac{\pi}{2}\left(1+\frac jn\right)\\
&=\sum^{n}_{j=k+1}\csc^2\frac{\pi}{2}\frac jn +\sum^{k}_{j=1}\sec^2\frac{\pi}{2}\frac jn\\
&\le \sum^{n}_{j=k+1}\csc^2\frac{\pi}{2}\frac jn+k \sec^2\frac{k\pi}{2n}\\
&\le \sum^{n}_{j=k+1}\frac{n^2}{j^2}+k \sec^2\frac{k\pi}{2n} \qquad\text{NB: }x\csc\frac{\pi x}{2}\le1 \text{ for }|x|\le 1\\
&\le\frac{\pi^2}{6}n^2+k \sec^2\frac{k\pi}{2n}
\end{align}
$$
Thus, $S_1=O(n^2)$.
Regarding $S_2$,
$$
\begin{align}
S_2
&=\sum^{k-1}_{j=1}\csc^2\frac{(k-j)\pi}{2n}+\sum^n_{j=k+1}\csc^2\frac{(j-k)\pi}{2n} \\
&=\sum^{k-1}_{j=1}\csc^2\frac{\pi j}{2n}+\sum^{n-k}_{j=1}\csc^2\frac{\pi j}{2n} \\
&\le\sum^{k-1}_{j=1}\frac{n^2}{j^2}+\sum^{n-k}_{j=1}\frac{n^2}{j^2} \\
&\le \frac{\pi^2}{3}n^2
\end{align}
$$
Hence, $S_2=O(n^2)$. Therefore,
$$S(n)=\sqrt{O(n^2)\cdot O(n^2)}=O(n^2)$$
