Extreme simplification: $\frac{\sin(Nx)\sin((N+1)x)\sin(Mx)\cos((M+1)x)}{\sin^2(x)}$

sequences-and-seriestrigonometric seriestrigonometry

I am trying to simplify the function $$f_{N,M}(x)=\frac{\sin(Nx)\sin((N+1)x)\sin(Mx)\cos((M+1)x)}{\sin^2(x)},\qquad N,M\in\Bbb N$$
to the form $$f_{N,M}(x)=\sum_{k}\alpha_k^{(N,M)}\sin(2kx).$$
The reason I expect this to be possible is the $(N,M)=(3,5)$ case:
$$f_{3,5}(x)=-\frac12\sin 2x-\frac12\sin4x+\sin8x+\frac32\sin10x+\frac32\sin12x+\sin14x+\frac12\sin16x,$$
and the unexplained answer here. The $(N,M)=(3,5)$ case, included in an answer to the linked question, is apparently due to the formula for the sine $\sin x=\frac1{2i}(u-1/u)$, where $u=e^{ix}$. I've tried to apply this to the general case at hand:
$$\begin{align}
f_{N,M}(x)&=\frac{\sin(Nx)\sin((N+1)x)\sin(Mx)\cos((M+1)x)}{\sin^2(x)}\\
&=\frac{2^{-1}(2i)^{-3}(u^{N}-u^{-N})(u^{N+1}-u^{-N-1})(u^M-u^{-M})(u^{M+1}+u^{-M-1})}{(2i)^{-2}(u-1/u)^2}\\
&=\frac1{4i}\frac{(u^{N}-u^{-N})(u^{N+1}-u^{-N-1})(u^M-u^{-M})(u^{M+1}+u^{-M-1})}{(u-1/u)^2}.
\end{align}$$

Then I defined the functions
$$\begin{align}
a_j(x)&=x^j-\frac1{x^j}\\
r_j(x)&=x^j+\frac1{x^j}
\end{align}$$

so that $$4if_{N,M}(x)=\frac{a_N(u)a_{N+1}(u)a_M(u)r_{M+1}(u)}{a_1^2(u)}.$$
Letting the numerator be $\eta$, we note that
$$r_N(u)r_{N+1}(u)=a_{2N+1}(u)-a_1(u)$$
as well as
$$r_M(u)a_{M+1}(u)=r_{2M+1}(u)-r_1(u)$$
so that
$$\eta=a_{2N+1}(u)r_{2M+1}(u)-a_{2N+1}(u)r_1(u)-a_1(u)r_{2M+1}(u)+a_1(u)r_1(u).$$
We see that $$a_p(u)r_q(u)=4i\cos(px)\sin(qx)=2i(s_{q+p}+s_{q-p}),\qquad s_K=\sin Kx$$
so that
$$\frac{\eta}{2i}=s_{2M+2N+2}+s_{2M-2N}+s_{2N}+s_2-(s_{2N+2}+s_{2M+2}+s_{2M}).$$
This almost seems like something I'm looking for, except for the denominator of $4if_{N,M}$, namely $\sin^2x$, which I can't seem to get rid of. Could I have some help? Thanks.

Best Answer

Introducing the Chebyshev polynomials of the second kind: \begin{equation} U_n(\cos(x))=\frac{\sin\left( \left( n+1 \right)x \right)}{\sin x} \end{equation} the terms of the summation can be written as \begin{align} f_{N,M}(x)&=\frac{\sin(Nx)\sin((N+1)x)\sin(Mx)\cos((M+1)x)}{\sin^2(x)}\\ &=\cos((M+1)x)\sin(x)U_{N-1}\left( \cos(x)\right)U_N\left( \cos(x)\right)U_{M-1}\left( \cos(x)\right) \end{align} From the product decomposition: \begin{equation} U_n(z)U_m(z)=\sum_{p=0}^nU_{m-n+2p}(z)\quad\text{ for }m\ge n \end{equation} we deduce \begin{equation} U_{N-1}\left( \cos(x)\right)U_N\left( \cos(x)\right)=\sum_{p=0}^{N-1}U_{2p+1}(\cos x) \end{equation} To evaluate \begin{equation} U_{N-1}\left( \cos(x)\right)U_N\left( \cos(x)\right)U_{M-1}\left( \cos(x)\right)=\sum_{p=0}^{N-1}U_{2p+1}(\cos x)U_{M-1}\left( \cos(x)\right) \end{equation} using the above decomposition formula for the product, care must be taken to the relative values of the indices of the polynomials. As $1\le 2p+1\le 2N-1$, if $M\ge 2N$, we have $M-1\ge2p+1$ and thus \begin{equation} U_{N-1}\left( \cos(x)\right)U_N\left( \cos(x)\right)U_{M-1}\left( \cos(x)\right)=\sum_{p=0}^{N-1}\sum_{q=0}^{2p+1}U_{M-2p+2q-2}\left( \cos(x)\right) \end{equation} which gives \begin{align} f_{N,M}(x)&=\cos((M+1)x)\sin(x)\sum_{p=0}^{N-1}\sum_{q=0}^{2p+1}U_{M-2p+2q-2}\left( \cos(x)\right)\\ &=\sum_{p=0}^{N-1}\sum_{q=0}^{2p+1}\cos((M+1)x)\sin\left( \left( M-2p+2q-1 \right) x\right)\\ &=\frac{1}{2}\sum_{p=0}^{N-1}\sum_{q=0}^{2p+1}\left[ \sin\left( \left( 2M-2p+2q \right)x \right)-\sin\left( \left( 2p-2q+2 \right) x\right) \right] \end{align} the proposed decomposition in terms of $\sin\left( 2kx \right)$ holds.

When $M<2N$, two contributions must be taken into account: \begin{align} U_{N-1}\left( \cos(x)\right)U_N\left( \cos(x)\right)U_{M-1}\left( \cos(x)\right)&=\sum_{p=0}^{\lfloor M/2\rfloor-1}U_{2p+1}(\cos x)U_{M-1}\left( \cos(x)\right)\\ &\,\quad+\sum_{p=\lfloor M/2\rfloor}^{N-1}U_{2p+1}(\cos x)U_{M-1}\left( \cos(x)\right)\\ &=\sum_{p=0}^{\lfloor M/2-1\rfloor}\sum_{q=0}^{2p+1}U_{M-2p+2q-2}\left( \cos(x)\right)\\ &\,\quad +\sum_{p=\lfloor M/2\rfloor}^{N-1}\sum_{q=0}^{M-1}U_{2p+2q-M+2}\left( \cos(x)\right) \end{align} Proceeding as above, we find \begin{align} f_{N,M}(x)&=\sum_{p=0}^{\lfloor M/2-1\rfloor}\sum_{q=0}^{2p+1}\sin\left( \left(M-2p+2q-1 \right)x \right)\cos((M+1)x)\\ &\,\quad +\sum_{p=\lfloor M/2\rfloor}^{N-1}\sum_{q=0}^{M-1}\sin\left( \left( 2p+2q-M+3 \right)x \right)\cos((M+1)x)\\ &=\frac{1}{2}\sum_{p=0}^{\lfloor M/2-1\rfloor}\sum_{q=0}^{2p+1}\left[\sin\left( \left(2M-2p+2q \right)x \right)- \sin\left( \left(2p-2q+2 \right)x \right) \right]\\ &\,\quad +\frac{1}{2}\sum_{p=\lfloor M/2\rfloor}^{N-1}\sum_{q=0}^{M-1}\left[\sin\left( \left( 2p+2q+4 \right)x \right)+\sin\left( \left( 2p+2q-2M+2 \right)x \right) \right] \end{align} Here again, the proposed decomposition holds.