Simplifying $\sum_{{}^{m=1}_{m\ne n}}^N(1+(-1)^{m+n})\frac{\sin\frac{\pi mk}{N+1}\sin\frac{\pi m}{N+1}}{\cos\frac{\pi n}{N+1}-\cos\frac{\pi m}{N+1}}$

calculussummationtrigonometric seriestrigonometry

I am writing perturbation theory for some linear operator, finding the first-order corrections to the components of eigenvectors boils down to the following sum:
$$\sum\limits_{{}^{m=1}_{m\ne n}}^{N} (1 + (-1)^{m+n}) \frac{\sin \left( \frac{\pi m k}{N+1} \right) \sin \left( \frac{\pi m}{N+1} \right)}{\cos\left(\frac{\pi n}{N+1}\right) – \cos\left(\frac{\pi m}{N+1}\right)},$$
where $k,n=1,2,\ldots,N$, and $N$ are integers. It is really desirable that this answer has a simple analytical expression, as otherwise it has no use, but at the moment it does not look like exactly summable.

Does anyone have ideas on how to approach this? Even the answer in the limit of large $N \gg 1$ would be nice.

UPDATE: I think this is impossible. Here is why. Let us just ignore the factor in front for simplicity (it will erase half of the terms simply), and our goal is to get rid from this difference in the denominator. Assume the part of the sum for which $m>n$. In this case $\cos(\pi n/(N+1))>\cos(\pi m/(N+1))$, and we can write:

$$ \frac{1}{\cos\left(\frac{\pi n}{N+1}\right)} \sum\limits_{m=n+1}^{N} \sin \left( \frac{\pi m k}{N+1} \right) \sin \left( \frac{\pi m}{N+1} \right) \frac{1}{1 – \frac{\cos\left(\frac{\pi m}{N+1}\right)}{\cos\left(\frac{\pi n}{N+1}\right)}} = \\\frac{1}{\cos\left(\frac{\pi n}{N+1}\right)} \sum\limits_{l=0}^{\infty} \cos^{-l}\left(\frac{\pi n}{N+1}\right) \sum\limits_{m=n+1}^{N} \sin \left( \frac{\pi m k}{N+1} \right) \sin \left( \frac{\pi m}{N+1} \right) \cos^l\left(\frac{\pi m}{N+1}\right).$$
Obviously, for $n>m$ one has to do the inverse, and perform a similar expansion of the $\frac{1}{1-x}$ function.

The only option one has is to convert all trigonometric functions into exponents. $\cos^l\left(\frac{\pi m}{N+1}\right) = \frac{1}{2^l} \sum\limits_{p=0}^{l} C(l,p) e^{i m (l-p) \phi } e^{-i p m \phi },$ where $C(l,p)$ are the binomial coefficients. So, one can get rid of the summation over $m$, but will be left with other two (over $p$, and $l$), and it does not look like any special function or smth like this.

UPDATE OF 27.07.2021:
As metamorphy has proven, I was wrong, and it is possible to find a closed-form solution :). The final answer is:

$$ – \sin\left( \dfrac{\pi n k}{N+1} \right) \cot\left( \dfrac{\pi n}{N+1}\right) – (2k-N-1) \cos\left( \dfrac{\pi n k}{N+1} \right) $$

Best Answer

Using $2\sin A\sin B=\cos(A-B)-\cos(A+B)$, we see that the sum is $$\frac12\big(S_{N+1,n,k-1}-S_{N+1,n,k+1}+(-1)^n(S_{N+1,n,N+k}-S_{N+1,n,N+k+2})\big)$$ where, for $0<n<N$ and $0\leqslant k\leqslant 2N$, $$S_{N,n,k}=\sum_{\substack{0<m<N\\m\neq n}}\frac{\cos(mk\pi/N)}{\cos(n\pi/N)-\cos(m\pi/N)}.$$

Here are steps to get a closed form of the latter. In this answer I show that $$\sum_{m=0}^{N-1}\frac{\exp(2mk\pi i/N)}{1-2z\cos(2m\pi/N)+z^2}=\frac{N(z^k+z^{N-k})}{(1-z^2)(1-z^N)}$$ for $0\leqslant k\leqslant N$ and $z\in\mathbb{C}$ not a singularity. Now we replace $N$ by $2N$, put $z=e^{it}$, and use $\sum_{m=0}^{2N-1}a_m=a_0+a_N+\sum_{m=1}^{N-1}(a_m+a_{2N-m})$. This gives (for $0\leqslant k\leqslant 2N$ now) $$\sum_{m=1}^{N-1}\frac{\cos(mk\pi/N)}{\cos t-\cos(m\pi/N)}=\frac12\left(\frac1{1-\cos t}-\frac{(-1)^k}{1+\cos t}\right)-N\frac{\cos(N-k)t}{\sin t\cdot\sin Nt}.$$ To get $S_{N,n,k}$, subtract the term with $m=n$ and take the limit as $t\to n\pi/N$.

Related Question