%trigDZ.tex: 
%%a Plain TeX file by  J,-P. Allouche and D.Zeilberger (10 pages)
%s section of the paper, written by DZ

%begin macros
\def\L{{\cal L}}
\baselineskip=14pt
\parskip=10pt
\def\halmos{\hbox{\vrule height0.15cm width0.01cm\vbox{\hrule height
  0.01cm width0.2cm \vskip0.15cm \hrule height 0.01cm width0.2cm}\vrule
  height0.15cm width 0.01cm}}
\font\eightrm=cmr8 \font\sixrm=cmr6
\font\eighttt=cmtt8
\magnification=\magstephalf
\def\P{{\cal P}}
\def\Q{{\cal Q}}
\def\1{{\overline{1}}}
\def\2{{\overline{2}}}
\parindent=0pt
\overfullrule=0in
\def\Tilde{\char126\relax}
\def\frac#1#2{{#1 \over #2}}
%\headline={\rm  \ifodd\pageno  \RightHead  \else  \LeftHead  \fi}
%\def\RightHead{\centerline{
%Title
%}}
%\def\LeftHead{ \centerline{Doron Zeilberger}}
%end macros
\centerline
{\bf Automated part of the Allouche-Zeilberger paper }
\bigskip

{\bf Note: This is a Plain TeX draft that will be incorporated in the main paper written in LaTex. Only for the use of J. -P. Allouche}

{\bf Automated proofs of Specific Finite Trigonometric Identities}

Given a multivariable polynomial $P$, any identity of the form, 

$$
P(\sin( \, \frac{\pi}{n} \, ) \, , \, \sin( \,\frac{2 \,\pi}{n} \, ) , \dots, sin(\, \frac{(n-1)\,\pi}{n} \, ) ) =0 \quad ,
\eqno(1)
$$
for a {\it specific}, positive integer $n$, is routinely provable by Maple, and (probably) any other computer algebra system. In Maple the command is {\tt simplify}.

For example the original `Morrie's law'[4], that Richard Feynman never forgot (also see [1])
$$
cos(20^{o}) \, cos(40^{o}) \, cos(80^{o}) \, = \, \frac{1}{8} \quad,
$$
can be automatically done (exactly!) by Maple. Just type

{\tt simplify(cos(Pi/9)*cos(2*Pi/9)*cos(4*Pi/9));}

and you will get right away {\tt 1/8}.

Nowadays you don't have to be a Gauss to (rigorously!) prove Gauss' identity at the beginning of this article, just enter, in Maple

{\tt simplify((-1+sqrt(17)+sqrt(34-2*sqrt(17))+2*sqrt(17+3*sqrt(17)-sqrt(170+38*sqrt(17))))/16-cos(2*Pi/17));}

and in one nano-second you would get {\tt 0}. 

To take another example, to prove the second identity on page 1, type

{\tt sin(3/7*Pi)**2/sin(2/7*Pi) - sin(2/7*Pi)**2/sin(1/7*Pi) + sin(1/7*Pi)**2/sin(3/7*Pi):} \hfill\break
{\tt simplify(\%);} \quad,

and you would immediately get  {\tt 0}.

The way Maple does it is to use Euler's formula
$$
\sin x = \frac{e^{ix}-e^{-ix}}{2i} \quad .
$$

Then in $(1)$ everything is a polynomial in $z:=e^{i\pi/n}$, getting, upon expansion, a polynomial in $z$ and making sure that it is divisible by $z^n+1$.
So numeric computations turn into routine, symbolic,  `high-school algebra' calculations that computer algebra systems excel at.

Nine such identities are proved, by `advanced' methods in [2]. See the output file

{\tt http://www.math.rutgers.edu/\~{}zeilberg/tokhniot/oTrigSums14.txt} \quad ,

for automatic, elementary ({\it high-school algebra}) proofs of all of them.


{\bf Automated Proofs of Infinite Families of Finite Trigonometric Sums}

More interesting are ``infinite families'' of finite trigonometric sums. We will describe how to automatically derive explicit polynomial expressions to the
following eight families.

Below $n$ and $k$ are  arbitrary positive integers.

{\bf Type Top}
$$
\sum_{j=1}^{n} \sin^{2k} (\frac{j\, \pi}{2n+1}) \quad .
$$



{\bf Type Ton}
$$
\sum_{j=1}^{n} \csc^{2k} (\frac{j\,\pi}{2n+1}) \quad .
$$


{\bf Type Tep}
$$
\sum_{j=1}^{n} \sin^{2k} (\frac{(2j-1)\,\pi}{4n}) \quad .
$$


{\bf Type Ten}
$$
\sum_{j=1}^{n} \csc^{2k} (\frac{(2j-1)\,\pi}{4n}) \quad .
$$



{\bf Type Uop}
$$
\sum_{j=1}^{n-1} \sin^{2k} (\frac{j\,\pi}{2n}) \quad .
$$



{\bf Type Uon}
$$
\sum_{j=1}^{n-1} \csc^{2k} (\frac{j\,\pi}{2n}) \quad .
$$


{\bf Type Uep}
$$
\sum_{j=1}^{n} \sin^{2k} (\frac{(2j-1)\,\pi}{4n+2}) \quad .
$$


{\bf Type Uen}
$$
\sum_{j=1}^{n} \csc^{2k} (\frac{(2j-1)\,\pi}{4n+2}) \quad .
$$

It turns out that to get closed-form expressions for general $n$ and $k$ for the four types {\bf Top,Tep,Uop, Uep}, (i.e. for sums of {\bf positive} even powers of the sines), one does not need
computers. These are easy human exercises. Let's just illustrate it with type {\bf Top}.

Define $z:=e^{\frac{i \pi}{2n+1}}$. Note that $z^{2n+1}=-1$. Then  $\sin(\frac{j\, \pi}{2n+1})=(z^j-z^{-j})/(2i)$. We have:
$$
\sum_{j=1}^{n} \sin^{2k} (\frac{j\, \pi}{2n+1}) \, = \,
\sum_{j=1}^{n}  \left ( (z^j -z^{-j})/(2i) \right )^{2k} \, = \,
\frac{(-1)^k}{4^k} \sum_{j=1}^{n} (z^j -z^{-j})^{2k} \quad.
$$

By the binomial theorem, this equals
$$
\frac{(-1)^k}{4^k} \sum_{j=1}^{n} \sum_{r=0}^{2k} (-1)^{r} \frac{(2k)!}{r!(2k-r)!} z^{-jr+j(2k-r)} \, = \,
\frac{(-1)^k}{4^k} \sum_{j=1}^{n} \sum_{r=0}^{2k} (-1)^{r} \frac{(2k)!}{r!(2k-r)!} z^{2j(k-r)}
$$
$$
= \, \frac{(-1)^k}{4^k} \cdot n \cdot (-1)^{k} \frac{(2k)!}{k!^2} +
\frac{(-1)^k}{4^k} \sum_{j=1}^{n} \sum_{r=0}^{k-1} (-1)^{r} \frac{(2k)!}{r!(2k-r)!} (z^{2j(k-r)}+z^{-2j(k-r)})
$$
$$
=\, \frac{n}{4^k} \frac{(2k)!}{k!^2} +
\frac{(-1)^k}{4^k}  \sum_{r=0}^{k-1} (-1)^{r}  \frac{(2k)!}{r!(2k-r)!} \sum_{j=1}^{n} (z^{2j(k-r)}+z^{-2j(k-r)}) \quad.
$$
Note that, by summing the geometric series and using $z^{2(2n+1)}=1$, we have:
$$
 \sum_{j=1}^{n} (z^{2j(k-r)}+z^{-2j(k-r)})=
 \sum_{j=-n}^{n} (z^{2(k-r)})^j -1 \, = \, 0-1 \, = \, -1 \quad.
$$
Going back to the above, we have that our desired sum equals
$$
=\frac{n}{4^k} \frac{(2k)!}{k!^2} +\frac{(-1)^{k+1}}{4^k}  \sum_{r=0}^{k-1} (-1)^{r}  \frac{(2k)!}{r!(2k-r)!} \quad.
$$
But (you prove it!)
$$
 \sum_{r=0}^{k-1} (-1)^{r}  \frac{(2k)!}{r!(2k-r)!}  = \frac{1}{2} (-1)^{k+1} \frac{(2k)!}{k!^2} \quad .
$$

We have just proved, {\it sans ordinateurs}, the general identity.

{\bf Theorem Top}:

$$
\sum_{j=1}^{n} \sin^{2k} (\frac{j\, \pi}{2n+1}) \, = \,\frac{1}{4^k} \frac{(2k)!}{k!^2} \left ( n+ \frac{1}{2} \right )  \quad .
$$

Similar things can be done with the other three positive families, and they are left to the reader.


{\bf Theorem Tep}:
$$
\sum_{j=1}^{n} \sin^{2k} (\frac{(2j-1)\,\pi}{4n}) \, = \, \frac{n}{2^{2k-1}} \, \frac{(2k-1)!}{(k-1)!k!} \quad .
$$


{\bf Theorem Uop}:
$$
\sum_{j=1}^{n-1} \sin^{2k} (\frac{j\,\pi}{2n}) 
\, = \, \frac{n}{4^k} \frac{(2k)!}{k!^2} - \frac{1}{2}  \quad .
$$


{\bf Theorem Uep}:
$$
\sum_{j=1}^{n} \sin^{2k} (\frac{(2j-1)\,\pi}{4n+2}) 
\, = \,
\frac{n}{4^k} \frac{(2k)!}{k!^2} +
\frac{1}{4^k} \frac{(2k-1)!}{k!(k-1)!} -\frac{1}{2} \quad.
$$

Note that in the above four theorems we have {\bf closed-form} expressions  for {\it general} $n$ {\bf and}  {\it general} $k$.


Much more interesting is to derive expressions for the sum of the even powers of the {\bf cosecants} (i.e. reciprocals of the sines). 
In this case there does not seem to be a general formula for $n$ {\bf and} $k$, but for each specific $k$, one can get an explicit expression,
as a polynomial in $n$ of degree $2k$, for any desired $k$. We went as far as $k \leq 60$, but readers are welcome to use
our accompanying Maple package {\tt TrigSums.txt}, available from the front of this article

{\tt https://sites.math.rutgers.edu/\~{}zeilberg/mamarim/mamarimhtml/trig.html} \quad ,

to get as far as one wishes.


We will illustrate it with the family of type {\bf Ton}. 

Recall that the {\bf Chebyshev polynomial of the first kind}, $T_n(x)$ may be defined by
$$
T_n(\cos t) = cos(n t) \quad.
$$
It is well-known and easy to see [3], that

$$
T_{n}(x) \, = \, \frac{n}{2} \sum_{k=0}^{\lfloor \frac{n}{2} \rfloor} \frac{(-1)^k 2^{n-2k} (n-k-1)!}{k! (n-2k)!} x^{n-2k} \quad .
$$

Hence
$$
\frac{T_{2n+1}(x)}{x} \, = \, (2n+1) \sum_{k=0}^{n} \frac{(-1)^k 4^{n-k} (2n-k)!}{k! (2n+1-2k)!} (x^2)^{n-k} \quad .
$$
Define the degree $n$ polynomial
$$
E_n(x):=\frac{T_{2n+1}(\sqrt{x})}{\sqrt{x}} \quad.
$$
Then

$$
E_n(x) \, = \, (2n+1) \sum_{k=0}^{n} \frac{(-1)^k 4^{n-k} (2n-k)!}{k! (2n+1-2k)!} x^{n-k} \quad .
$$

Note that the $n$ roots of $E_n(x)$ are  $\sin^2(\frac{j\,\pi}{2n+1})$, for $j=1, \dots,n$.

Define the {\it reciprocal polynomial} $\bar{E}_n(x):=x^nE_n(x^{-1})$. Then we have

$$
\bar{E}_n(x) \, = \, (-1)^n \, (2n+1) \sum_{k=0}^{n} \frac{(-1)^k 4^{k} (n+k)!}{(n-k)! (2k+1)!} x^{n-k} \quad .
$$

Note that the $n$ roots of $\bar{E}_n(x)$ are  $\csc^2(\frac{j\,\pi}{2n+1})$.

It follows immediately that, denoting, as usual, the degree $k$ elementary symmetric function of of $\alpha_1, \dots, \alpha_n$ by
$e_k(\alpha_1, \dots, \alpha_n)$, that

{\bf Lemma Top}:

$$
e_k(\{sin^2 (j\,\pi/(2n+1),j=1 \dots n)\}) \, = \,
\frac{4^{-k} \left(2 n -k \right)! \left(2 n +1\right)}{k ! \left(2 n -2 k +1\right)!}
$$


{\bf Lemma Ton}:

$$
e_k(\{\csc^2(j\,\pi/(2n+1)),j=1 \dots n)\}) \, = \,
\frac{\left(n +k \right)! 4^{k}}{\left(n -k \right)! \left(2 k +1\right)!} \quad.
$$

Now we use Newton's identities [5] (see [6] for a lovely combinatorial proof). Let  
$$
p_k(\alpha_1, \dots, \alpha_n):= \sum_{j=1}^{n} \alpha_j^k
$$ 

be the {\it power-sum functions}, then

$$
k e_k (\alpha_1, \dots, \alpha_n) )\, = \,
\sum_{i=1}^k (-1)^{i-1} e_{k-i}(\alpha_1, \dots, \alpha_n)  p_i(\alpha_1, \dots, \alpha_n)  \quad.
$$

This enables us (and our computers) to {\bf recursively} find explicit expressions for the power sums of both  $\{sin^2(j\,\pi/(2n+1)),j=1 \dots n)\}$ and $\{csc^2(j\,\pi/(2n+1)),j=1 \dots n)\}$.
Of course, for the former case we don't need it, since we have Theorem {\bf Top} above but it is still nice to know that it agrees up to $k=60$.

For types {\bf Tep} and {\bf Ten}, the underlying polynomial is $T_{2n}(\sqrt{x})$ whose roots are 
$$
\{ \sin^2((2j+1)\pi/(4n)) , j=1 \dots n)\} \quad ,
$$ 
and we have, analogously


{\bf Lemma Tep}:

$$
e_k(\{\sin^2((2j+1)\,\pi/(4n)),j=1 \dots n\} ) \, = \,
\frac{2n\,4^{-k} \left(2 n -k -1\right)!}{k ! \left(2 n -2 k \right)!} \quad  .
$$


{\bf Lemma Ten}:

$$
e_k(\{\csc^2 ((2j+1)\,\pi/(4n)),j=1 \dots n\} )\, = \,
\frac{n \left(n +k -1\right)! 4^{k}}{\left(n -k \right)! \left(2 k \right)!} \quad .
$$

For types {\bf Uop} and {\bf Uon}, the underlying polynomial is $U_{2n-1}(\sqrt{x})/\sqrt{x}$ whose roots are 
$$
\{ \sin^2(j\pi/(2n)) , j=1 \dots n-1)\} \quad 
$$ 
and we have, analogously


{\bf Lemma Uop}:

$$
e_k(\{\sin^2(j\,\pi/(2n)),j=1 \dots n-1\} )\, = \,
\frac{4^{-k} \left(2 n -k -1\right)!}{\left(2 n -2 k -1\right)! k !} \quad .
$$


{\bf Lemma Uon}:

$$
e_k(\{\csc^2(j\,\pi/(2n)),j=1 \dots n-1\}) \, = \,
\frac{4^{k} \left(n +k \right)! \left(n -1\right)!}{\left(2 k +1\right)! \left(n -k -1\right)! n !}  \quad .
$$



For types {\bf Uep} and {\bf Uen}, the underlying polynomial is $U_{2n}(\sqrt{x})$ whose roots are 
$$
\{ \sin^2 ((2j-1)\pi/(4n+2), j=1 \dots n)\} \quad,
$$ 
and we have, analogously


{\bf Lemma Uep}:

$$
e_k(\{\sin^2((2j-1)\,\pi/(4n+2)),j=1 \dots n\} )\, = \,
\frac{4^{-k} \left(2 n -k \right)!}{\left(2 n -2 k \right)! k !} \quad ,
$$

{\bf Lemma Uen}:

$$
e_k(\{\csc^2 ((2j-1)\,\pi/(4n+2)),j=1 \dots n\}) \, = \,
\frac{\left(n +k \right)! 4^{k}}{\left(2 k \right)! \left(n -k \right)!} \quad.
$$

From these, combined with Netwon's identities one can find as many sum-of-powers as one wishes.

{\bf Appendix by Shalosh B. Ekhad}

{\bf Type Ton}

{\bf  Proposition Ton[1]}
$$
\sum_{j=1}^{n} \csc^2(\frac{\pi j}{2n+1}) \, = \,
\frac{2 \left(n +1\right) n}{3} \quad .
$$


{\bf  Proposition Ton[2]}
$$
\sum_{j=1}^{n} \csc^4(\frac{\pi j}{2n+1}) \, = \,
\frac{8 \left(n +1\right) n \left(n^{2}+n +3\right)}{45}
$$



{\bf  Proposition Ton[3]}
$$
\sum_{j=1}^{n} \csc^6(\frac{\pi j}{2n+1}) \, = \,
\frac{8 \left(n +1\right) n \left(8 n^{4}+16 n^{3}+35 n^{2}+27 n +54\right)}{945} \quad .
$$



{\bf  Proposition Ton[4]}
$$
\sum_{j=1}^{n} \csc^8(\frac{\pi j}{2n+1}) \, = \,
\frac{128 \left(n +1\right) n \left(n^{2}+n +3\right) \left(3 n^{4}+6 n^{3}+7 n^{2}+4 n +15\right)}{14175} \quad .
$$


{\bf  Proposition Ton[5]}
$$
\sum_{j=1}^{n} \csc^{10}(\frac{\pi j}{2n+1}) \, = \,
\frac{64 \left(n +1\right) n \left(16 n^{8}+64 n^{7}+182 n^{6}+322 n^{5}+493 n^{4}+524 n^{3}+579 n^{2}+360 n +540\right)}{93555} \quad .
$$

For Propositions {\bf Ton[k]} for $6 \leq k \leq 50$, see the output file

{\tt https://sites.math.rutgers.edu/\~{}zeilberg/tokhniot/oTrigSums1.txt} \quad .

{\bf Type Ten}

{\bf  Proposition Ten[1]}
$$
\sum_{j=1}^{n} \csc^2(\frac{\pi (2j-1)}{4n}) \, = \,
2\,n^2 \quad .
$$


{\bf  Proposition Ten[2]}
$$
\sum_{j=1}^{n} \csc^4(\frac{\pi (2j-1)}{4n}) \, = \,
\frac{4 n^{2} \left(2 n^{2}+1\right)}{3}
\quad .
$$



{\bf  Proposition Ten[3]}
$$
\sum_{j=1}^{n} \csc^6(\frac{\pi (2j-1)}{4n}) \, = \,
\frac{8 n^{2} \left(8 n^{4}+5 n^{2}+2\right)}{15}
\quad .
$$


{\bf  Proposition Ten[4]}
$$
\sum_{j=1}^{n} \csc^8(\frac{\pi (2j-1)}{4n}) \, = \,
\frac{16 n^{2} \left(136 n^{6}+112 n^{4}+49 n^{2}+18\right)}{315}
\quad .
$$


{\bf  Proposition Ten[5]}
$$
\sum_{j=1}^{n} \csc^{10}(\frac{\pi (2j-1)}{4n}) \, = \,
\frac{32 n^{2} \left(992 n^{8}+1020 n^{6}+546 n^{4}+205 n^{2}+72\right)}{2835}
\quad .
$$



For Propositions {\bf Ten[k]} for $6 \leq k \leq 50$, see the output file

{\tt https://sites.math.rutgers.edu/\~{}zeilberg/tokhniot/oTrigSums5.txt} \quad .

{\bf Type Uon}

{\bf  Proposition Uon[1]}
$$
\sum_{j=1}^{n-1} \csc^2(\frac{j\,\pi }{2n}) \, = \,
\frac{2 \left(n +1\right) \left(n -1\right)}{3}
\quad .
$$


{\bf  Proposition Uon[2]}
$$
\sum_{j=1}^{n-1} \csc^4(\frac{j\,\pi }{2n}) \, = \,
\frac{4 \left(n +1\right) \left(n -1\right) \left(2 n^{2}+7\right)}{45}
\quad .
$$


{\bf  Proposition Uon[3]}
$$
\sum_{j=1}^{n-1} \csc^6(\frac{j\,\pi }{2n}) \, = \,
\frac{8 \left(n +1\right) \left(n -1\right) \left(8 n^{4}+29 n^{2}+71\right)}{945}
\quad .
$$


{\bf  Proposition Uon[4]}
$$
\sum_{j=1}^{n-1} \csc^8(\frac{j\,\pi }{2n}) \, = \,
\frac{16 \left(n +1\right) \left(n -1\right) \left(24 n^{6}+104 n^{4}+251 n^{2}+521\right)}{14175}
\quad .
$$



{\bf  Proposition Uon[5]}
$$
\sum_{j=1}^{n-1} \csc^{10}(\frac{j\,\pi }{2n}) \, = \,
\frac{32 \left(n +1\right) \left(n -1\right) \left(32 n^{8}+164 n^{6}+450 n^{4}+901 n^{2}+1693\right)}{93555}
\quad .
$$



For Propositions {\bf Uon[k]} for $6 \leq k \leq 50$, see the output file

{\tt https://sites.math.rutgers.edu/\~{}zeilberg/tokhniot/oTrigSums9.txt} \quad .

{\bf Type Uen}

{\bf  Proposition Uen[1]}
$$
\sum_{j=1}^{n} \csc^2(\frac{(2j-1)\,\pi }{4n+2}) \, = \,
2 \left(n +1\right) n
\quad .
$$


{\bf  Proposition Uen[2]}
$$
\sum_{j=1}^{n} \csc^4(\frac{(2j-1)\,\pi }{4n+2}) \, = \,
\frac{8 \left(n +1\right) n \left(n^{2}+n +1\right)}{3}
\quad .
$$



{\bf  Proposition Uen[3]}
$$
\sum_{j=1}^{n} \csc^6(\frac{(2j-1)\,\pi }{4n+2}) \, = \,
\frac{8 \left(n +1\right) n \left(8 n^{4}+16 n^{3}+19 n^{2}+11 n +6\right)}{15}
\quad .
$$


{\bf  Proposition Uen[4]}
$$
\sum_{j=1}^{n} \csc^8(\frac{(2j-1)\,\pi }{4n+2}) \, = \,
\frac{128 \left(n +1\right) n \left(n^{2}+n +1\right) \left(17 n^{4}+34 n^{3}+31 n^{2}+14 n +9\right)}{315}
\quad .
$$

{\bf  Proposition Uen[5]}
$$
\sum_{j=1}^{n} \csc^{10}(\frac{(2j-1)\,\pi }{4n+2}) \, 
$$
$$
= \,
\frac{64 \left(n +1\right) n \left(496 n^{8}+1984 n^{7}+4106 n^{6}+5374 n^{5}+4979 n^{4}+3316 n^{3}+1669 n^{2}+576 n +180\right)}{2835}
\quad .
$$


For Propositions {\bf Uen[k]} for $6 \leq k \leq 50$, see the output file

{\tt https://sites.math.rutgers.edu/\~{}zeilberg/tokhniot/oTrigSums12.txt} \quad .




\vfill\eject


{\bf References}

[1] J. Louck, W. Beyer, and D. Zeilberger,
{\it A generalization of a curiosity that Feynman remembered all his life},  `Math Bite', Math. Magazine, 69(1)(Feb. 1996), 43-44. \hfill\break
{\tt https://sites.math.rutgers.edu/\~{}zeilberg/mamarim/mamarimhtml/feynman.html}


[2] G. Vinay, H. T. Shwetha and K. N. Harshitha,  {\it Non-trivial trigonometric sums arising from some of Ramanujan Theta function identities},
Palestinian J. Mathematics 11(1)(2022), 130-134. 

[3] The Wikipedia Foundation, {\it Chebyshev polynomials}.

[4] The Wikipedia Foundation, {\it Morrie's Law} .


[5] The Wikipedia Foundation, {\it Newton's identities}.


[6] D. Zeilberger, {\it A combinatorial proof of Newton's identities}, Discrete Mathematics {\bf 49} (1984), 319. \hfill\break
{\tt https://sites.math.rutgers.edu/\~{}zeilberg/mamarimY/DZ1984.pdf}
\end



