# Algorithms for Various Trigonometric Power Sums
## 4 Basic Trigonometric Power Sums
The definition of a basic trigonometric power sum also includes those with alternating phase factors in the summands. Surprisingly, these have not been studied yet. Moreover, we shall require these sums in the next section. Therefore, the following lemma needs to be proved. **Lemma 1**. : _The alternating basic sine power sum, \(S_{\alpha,l}^{-}(m,n)\), stemming from the definition, \(S_{\alpha,l}^{\pm}(m,n)\doteq\sum_{k=1}^{n}(\pm 1)^{k}\sin^{2m}\bigl{(}(k+ \alpha)\pi/ln\bigr{)}\), has the following solutions for \(\alpha=0\). For the Dowker case or \(l\!=\!1\), we have_  
\[S_{0,1}^{-}(m,n)= \begin{cases}0,&n,\ \ \mathrm{odd},\\ (-1)^{m}2^{1-2m}\sum_{j=0}^{m}(-1)^{j}\binom{2m}{j}H_{2}(m,n,j)-2^{-2n}\binom{ 2m}{m},&n,\ \mathrm{even},\end{cases}  \tag{49}\]  
_where_  
\[H_{2}(m,n,j)= \begin{cases}n+1,&\exp\big{(}2i(m-j)\pi/n\bigr{)}=-1,\\ (1+(-1)^{n})/2,&\ \ \mathrm{for\ all\ other\ values\ of\ }j,m\ \mathrm{and}\ n.\end{cases}  \tag{50}\]  
_For the Gardner-Fisher case or \(l\!=\!2\), the sum has the following solution:_  
\[S_{0,2}^{-}(m,n)= \begin{cases}(-1)^{m}2^{1-2m}\sum_{j=0}^{m}(-1)^{j}\binom{2 m}{j}H_{1}(m,n,j),&n,\ \mathrm{odd},\\ (-1)^{m}2^{1-2m}\sum_{j=0}^{m}(-1)^{j}\binom{2m}{j}H_{1}(m,n,j)-2^{-2n}\binom{ 2m}{m},&n,\ \mathrm{even},\end{cases}  \tag{51}\]  
_where_  
\[H_{1}(m,n,j)= \begin{cases}n+1,&\exp\big{(}i(m-j)\pi/n\bigr{)}=-1,\\ (1+(-1)^{m+n-j})/2,&\ \ \mathrm{for\ all\ other\ values\ of\ }j,\ m\ \mathrm{and}\ n.\end{cases}  \tag{52}\]  
**Remark 1**. : _The conditions on \(H_{1}(m,n,j)\) and \(H_{2}(m,n,j)\) in the lemma mean that \(H_{1}(m,n,j)\) and \(H_{2}(m,n,j)\) are equal to \(n+1\), when \(2(m-j)/n\) and \((m-j)/n\), respectively, are odd numbers. Consequently, we shall find that the above results can only be implemented as algorithms/programs yielding rational values._  
Proof. : To prove the [PERSON] case for odd values of \(n\), we set \(n=2p+1\), where \(p\) is a non-negative integer, and write \(S_{0,1}^{-}(m,n)\) as  
\[S_{0,1}^{-}(m,n)=\sum_{k=1}^{p}(-1)^{k}\sin^{2m}\Bigl{(}\frac{k\pi}{2p+1} \Bigr{)}+\sum_{k=p+1}^{2p-1}(-1)^{k}\sin^{2m}\Bigl{(}\frac{k\pi}{2p+1}\Bigr{)}. \tag{53}\]  
In the second sum, we replace \(k\) by \(2p+1-k\). Then, \((-1)^{k}\) becomes \((-1)^{2p+1-k}\) or \((-1)^{k+1}\), while \(\sin(\pi-k\pi/(2p+1))=\sin(k\pi/(2p+1))\). Accordingly, the second sum becomes the negative of the first sum on the rhs (rhs) of (53), thereby yielding zero or the first result of (49). To prove the remaining results in the lemma, we use No. 17.4.5 of [26], which can be expressed as  
\[\sin^{2m}\Bigl{(}\frac{x}{2}\Bigr{)}=\frac{(-1)^{m}}{2^{2m-1}}\sum_{j=0}^{m} \frac{(-2m)_{j}}{j!}\cos\bigl{(}(m-j)x\bigr{)}-\frac{1}{2^{2m}}\binom{2m}{m}. \tag{54}\]  
For the Dowker case, we need to put \(x/2\) equal to \(k\pi/n\), while for the Gardner-Fisher case, we put \(x\!=\!k\pi\). Then, we multiply both sides of each resulting equation by \((-1)^{k}\), sum over \(k\) from zero to \(n\) and interchange the summations. Hence, for the Dowker case, we arrive at  
\[\sum_{k=0}^{n}(-1)^{k}\sin^{2m}\Bigl{(}\frac{k\pi}{n}\Bigr{)} =\frac{(-1)^{m}}{2^{2m-1}}\sum_{j=0}^{m}(-1)^{j}\frac{(-2m)_{j}} {j!}\sum_{k=0}^{n}(-1)^{k}\cos\Bigl{(}\frac{2(m-j)k\pi}{n}\Bigr{)}\] \[- \frac{1}{2^{2m}}\binom{2m}{m}\sum_{k=0}^{n}(-1)^{k}, \tag{55}\]while for the Gardner-Fisher case, we obtain  
\[\sum_{k=0}^{n}(-1)^{k}\sin^{2m}\Bigl{(}\frac{k\pi}{2n}\Bigr{)} = \frac{(-1)^{m}}{2^{2m-1}}\sum_{j=0}^{m}(-1)^{j}\frac{(-2m)_{j}}{j!} \sum_{k=0}^{n}(-1)^{k}\cos\[PERSON]{(}\frac{(m-j)k\pi}{n}\Bigr{)} \tag{56}\] \[- \frac{1}{2^{2m}}\binom{2m}{m}\sum_{k=0}^{n}(-1)^{k}.\]  
The second sum appearing on the rhs of both (55) and (56) simply yields \((1+(-1)^{n})/2\), which means, in turn, that it vanishes for odd values of \(n\) and gives unity when \(n\) is even. It provides the common term in the \(n\) even cases of (51) and (52). The first sum on the rhs of either (55) or (56) can be evaluated either in Mathematica or using the formula for a geometric series.