# Extended Trigonometric Pythagorean Identities: The Proof

I recently posted on Extended Trigonometric Pythagorean Identities and a “supercharged” version of them, which allows to simplify certain sums of shifted sine functions raised to integer powers. In particular, the claim was that

$$\sum_{n=0}^{N-1} \sin^2\left(x+n\frac{\pi}{N}\right) = \frac{N}{2}$$

or more generally for any integer $k$ and $N\geq k+1$:

$$\sum_{n=0}^{N-1} \sin^{2k}\left(x+n\frac{\pi}{N}\right) = N \frac{(2k)!}{(k!)^2 2^{2k}} = \frac{N}{\sqrt{\pi}} \frac{\Gamma(k+1/2)}{\Gamma(k+1)}$$

However, in the initial TPI post, I struggled a bit with the proof. It took a while to realize that it is actually quite simple using (a) the algebraic series, i.e.,

$$\sum_{n=0}^{N-1} q^n = \frac{1-q^N}{1-q}$$

for any $q \in \compl_{\neq 0,1}$ and (b) the fact that $\sin(x) = \frac{1}{2\jmath}\left({\rm e}^{\jmath x} – {\rm e}^{-\jmath x}\right)$. Let us use this relation to prove the following Lemma:

Lemma 1: For any $M \in \mathbb{Z}$, we have

$$\sum_{n=0}^{N-1}{\rm e}^{\jmath \frac{2\pi}{N} \cdot M \cdot n} = \begin{cases} N & M = k \cdot N, \, k\in \mathbb{Z} \\ 0 & {\rm otherwise}. \end{cases}$$

Proof: The proof is simple by realizing that the sum is in fact an arithmetic series with $q={\rm e}^{\jmath \frac{2\pi}{N} \cdot M}$. Obviously, if $M$ is an integer multiple of $N$ we have $q=1$ and the sum is equal to $N$. Otherwise, by the above identity, the series is equal to

$$\frac{1-{\rm e}^{\jmath 2\pi \cdot M}}{1-{\rm e}^{\jmath \frac{2\pi}{N} \cdot M}} = \frac{{\rm e}^{\jmath \pi \cdot M}}{{\rm e}^{\jmath \frac{\pi}{N} \cdot M}}\cdot \frac{{\rm e}^{-\jmath \pi \cdot M}-{\rm e}^{\jmath \pi \cdot M}}{{\rm e}^{-\jmath \frac{\pi}{N} \cdot M}-{\rm e}^{\jmath \frac{\pi}{N} \cdot M}}= {\rm e}^{\jmath \frac{\pi}{N}M(N-1)} \cdot \frac{\sin(\pi M)}{\sin(\frac{\pi}{N}M)} = 0,$$
since the enumerator is zero (and the denominator is not).

Piece of cake.

Now, we can proceed to prove the TPI for $2k=2$:

\begin{align}
\sum_{n=0}^{N-1} \sin^2\left(x+n\frac{\pi}{N}\right)
& = \sum_{n=0}^{N-1}  \left(\frac{1}{2\jmath} {\rm e}^{\jmath(x+n\frac{\pi}{N})}- \frac{1}{2\jmath} {\rm e}^{-\jmath(x+n\frac{\pi}{N})}\right)^2\\
& = -\frac{1}{4}\sum_{n=0}^{N-1} {\rm e}^{2\jmath(x+n\frac{\pi}{N})} + {\rm e}^{-2\jmath(x+n\frac{\pi}{N})} – 2 {\rm e}^{\jmath(x+n\frac{\pi}{N})-\jmath(x+n\frac{\pi}{N})} \\
& = -\frac{1}{4} {\rm e}^{2\jmath x} \sum_{n=0}^{N-1} {\rm e}^{\jmath 2n\frac{\pi}{N}}
-\frac{1}{4} {\rm e}^{-2\jmath x} \sum_{n=0}^{N-1} {\rm e}^{-\jmath 2n\frac{\pi}{N}}
-\frac{1}{4} \sum_{n=0}^{N-1} (-2) \\
& = -\frac{1}{4} \cdot 0 -\frac{1}{4}\cdot 0 -\frac{1}{4}\cdot(-2N) = \frac{N}{2}
\end{align}

where we have used Lemma 1 for $M=1$ and $M=-1$ (which for the Lemma to work requires $M\neq N$ and thus $N\geq 2$). Isn’t that simple? I wonder why I didn’t see it earlier.

Even better yet, this technique allows to extend the proof to other values of $k$. Let’s try $2k=4$:

\begin{align}
\sum_{n=0}^{N-1} \sin^4\left(x+n\frac{\pi}{N}\right)
& = \sum_{n=0}^{N-1}  \left(\frac{1}{2\jmath} {\rm e}^{\jmath(x+n\frac{\pi}{N})}- \frac{1}{2\jmath} {\rm e}^{-\jmath(x+n\frac{\pi}{N})}\right)^4\\
& = \frac{1}{16} \sum_{n=0}^{N-1} {\rm e}^{4 \jmath(x+n\frac{\pi}{N})}
-4 {\rm e}^{3\jmath(x+n\frac{\pi}{N}) -\jmath(x+n\frac{\pi}{N})}
+6 {\rm e}^{2\jmath(x+n\frac{\pi}{N}) -2 \jmath(x+n\frac{\pi}{N})} \\ &
-4 {\rm e}^{\jmath(x+n\frac{\pi}{N}) -3\jmath(x+n\frac{\pi}{N})}
+ {\rm e}^{-4 \jmath(x+n\frac{\pi}{N})} \\
& = \frac{1}{16}{\rm e}^{4 \jmath x} \sum_{n=0}^{N-1} {\rm e}^{4 \jmath n\frac{\pi}{N}}
– \frac{4}{16}{\rm e}^{2\jmath x} \sum_{n=0}^{N-1}{\rm e}^{2 \jmath n\frac{\pi}{N}}
+ \frac{6}{16}\sum_{n=0}^{N-1} {\rm e}^{0} \\ &
– \frac{4}{16}{\rm e}^{-2\jmath x} \sum_{n=0}^{N-1}{\rm e}^{-2 \jmath n\frac{\pi}{N}}
+ \frac{1}{16}{\rm e}^{-4 \jmath x} \sum_{n=0}^{N-1} {\rm e}^{-4 \jmath n\frac{\pi}{N}} \\
& = \frac{1}{16} \cdot 0 – \frac{4}{16} \cdot 0 + \frac{6}{16} \cdot N – \frac{4}{16} \cdot 0 + \frac{1}{16} \cdot 0 = \frac{3}{8} N,
\end{align}

where this time we have used Lemma 1 for $M=2, 1, -1, -2$ and thus need $N\geq 3$. This already shows the pattern: The polynomic expansion creates mostly terms with vanishing sums except for the “middle” term where the exponents cancel. The coefficient in front of this term is $\frac{1}{2^{2k}}$ (from the $\frac{1}{2\jmath}$ that comes with expanding the sine) times ${2k \choose k}$ (from the binomial expansion). This explains where the constant $N \cdot \frac{(2k)!}{(k!)^2 2^{2k}}$ comes from.

Formally, we have

\begin{align}
\sum_{n=0}^{N-1} \sin^{2k}\left(x+n\frac{\pi}{N}\right) & =
\sum_{n=0}^{N-1} \left( \frac{1}{2\jmath}{\rm e}^{\jmath(x+n\frac{\pi}{N})}
– \frac{1}{2\jmath}{\rm e}^{-\jmath(x+n\frac{\pi}{N})} \right)^{2k} \\
& =
\sum_{n=0}^{N-1} \frac{1}{(2\jmath)^{2k}} \sum_{\ell = 0}^{2k} {2k \choose \ell} (-1)^\ell
{\rm e}^{(2k-\ell) \jmath (x+n\frac{\pi}{N})}{\rm e}^{-\ell \jmath (x+n\frac{\pi}{N})} \\
& =
\sum_{n=0}^{N-1} \frac{(-1)^k}{2^{2k}} \sum_{\ell = 0}^{2k} (-1)^\ell {2k \choose \ell}
{\rm e}^{2(k-\ell) \jmath (x+n\frac{\pi}{N})}\\
& = \frac{(-1)^k}{2^{2k}} \sum_{\ell = 0}^{2k} (-1)^\ell {2k \choose \ell}
{\rm e}^{2(k-\ell) \jmath x} \sum_{n=0}^{N-1}
{\rm e}^{2(k-\ell) \jmath n\frac{\pi}{N}} \\
& = \frac{1}{2^{2k}} {2k \choose k} N,
\end{align}

where in the last step all terms $\ell \neq k$ vanish due to Lemma 1 applied for $M=k, k-1, …, 1, -1, …, -k+1, -k$. This requires $N\geq k+1$.

Eh voila.

# Trigonometric Pythagorean Identity, supercharged

You know how they say good things always come back? Well, I recently stumbled over something that reminded me a lot on a post I had made about generalizations of the Trigonometric Pythagorean Identity. In short, the well-known identity $\sin^2(x)+\cos^2(x)=1$ can be generalized to a sum of $N\geq 2$ terms that are uniformly shifted copies of the sine function, which yields

$$\sum_{n=0}^{N-1} \sin^2\left(x+n\frac{\pi}{N}\right) = \frac{N}{2}$$

Well, I now came across a sum of fourth powers of shifted sine functions and much to my initial surprise, these admit very similar simplifications. In fact, it works for any integer power! Look at what I found:

$$\sum_{n=0}^{N-1} \sin^{2k}\left(x+n\frac{\pi}{N}\right) = N \frac{(2k)!}{(k!)^2 2^{2k}} = \frac{N}{\sqrt{\pi}} \frac{\Gamma(k+1/2)}{\Gamma(k+1)} \; k \in \mathbb{N}$$

for $N\geq k+1$. Isn’t this fascinating? No matter to which even power we raise the shifted sines, their sums will always give a constant in the form $c_k \cdot N$ and this constants $c_k$ can be computed analytically.

Here are some examples: sum of squares ($k=1$): $c_1 = 1/2$, sum of fourth powers ($k=2$): $c_2=3/8$, $k=3: 5/16$, $k=4: 35/128$ and so on. Moreover, I think I know how to prove even the “supercharged” version of the TPI for any $k$. I’ll write about it in another blog post.

*Update*: And here is the proof!

*Update2*: Just another small addition: The coefficients $c_k$ satisfy an interesting recurrence relation since you can compute $c_k$ as

$$c_k = \frac{2k+1}{2k+2} c_{k-1}$$

with $c_0 = 1$. This makes clear what structure they actually have: $c_1 = \frac{1}{2}$, $c_2 = \frac{1 \cdot 3}{2 \cdot 4}$, $c_3 = \frac{1 \cdot 3 \cdot 5}{2\cdot 4\cdot 6}$, and so on. Each $c_k$ is equal to the product of the first $k$ odd numbers divided by the product of the first $k$ even numbers. If you like, you can write them with double factorials via

$$c_k = \frac{(2k-1)!!}{(2k)!!}.$$

They are highly related to Wallis’ integrals $W_n$. Maybe this is not too surprising since they are defined as

$$W_n = \int_{0}^{\frac{\pi}{2}} \cos^n(x) {\rm d}x$$

and satisfy

$$W_{2n} = \frac{(2n-1)!!}{(2n)!!} \frac{\pi}{2}.$$

So what the generalized TPI above shows is that the equispaced $N$-term sum delivers somehow the same value as the integral, no matter where we start the sum. Kind of cool I think.