Generalizing trig-sum to product using complex exponentials

Solution 1:

In more general terms we are being asked to express a product of sines and cosines as a sum of sines and cosines. So let us begin with the easiest case, that of a product of cosines and then see how to manipulate the answer in that case to deal with the product of sines case.

So let $\theta_1,\theta_2,\dots,\theta_n\in\mathbb{R}$ be the angles. We want to find a simplification for $$ \prod_{k=1}^{n}\cos\theta_k=\frac{1}{2^n}\prod_{k=1}^{n}\left(\exp (i\theta_k)+\exp(-i\theta_k)\right). $$ The difficulty is keeping track of the signs, so we introduce the notation $\epsilon=(\epsilon_1,\dots,\epsilon_n)$, where each $\epsilon_k\in\{-1,+1\}$. For convenience let us write $\theta:=(\theta_1,\dots,\theta_n)$. We then can sensibly use the compact notation $\epsilon\cdot\theta=\sum_{k=1}^{n}\epsilon_k\theta_k$. It is also convenient to use the compact notation $(-1)^\epsilon:=\epsilon_1\dots \epsilon_n$.

With this notation in place we see at once that $$ \prod_{k=1}^{n}\left(\exp (i\theta_k)+\exp(-i\theta_k)\right)= \sum_{\epsilon} \exp(i \epsilon\cdot\theta), $$ where the sum is over the $2^n$ choices of $\epsilon$.

As the left hand side is real we need only take the real part of the right hand side, and so in fact have $$ \prod_{k=1}^{n}\left(\exp (i\theta_k)+\exp(-i\theta_k)\right)= \sum_{\epsilon} \cos(\epsilon\cdot\theta), $$ or $$ \prod_{k=1}^{n}\cos\theta_k=\frac{1}{2^n}\sum_{\epsilon} \cos(\epsilon\cdot\theta). $$

To transform $\cos\theta_k$ to $\sin\theta_k$ we need only apply the operator $-\frac{\partial}{\partial\theta_k}$; and so we have $$ \prod_{k=1}^{n}\sin\theta_k=\frac{(-1)^n}{2^n}\frac{\partial^n}{\partial\theta_1\dots\partial\theta_n}\sum_{\epsilon} \cos(\epsilon\cdot\theta). $$

For the moment let us write $\cos^{(n)}(x)$ for the $n$-derivative of $\cos x$. Then we have $$ \prod_{k=1}^{n}\sin\theta_k=\frac{(-1)^n}{2^n}\sum_{\epsilon}(-1)^{\epsilon} \cos^{(n)}(\epsilon\cdot\theta). $$ Recall that $\cos'=-\sin$ and $\sin'=\cos$, which means that our answer depends on the congruence class of $n$ modulo $4$. So write $n=4m+r$ with $0\leqslant r<4$.

Finally we have that $$ \textrm{ when $r=0$, } \prod_{k=1}^{n}\sin\theta_k=\frac{1}{2^n}\sum_{\epsilon}(-1)^{\epsilon} \cos(\epsilon\cdot\theta); $$ $$ \textrm{ when $r=1$, } \prod_{k=-1}^{n}\sin\theta_k=\frac{1}{2^n}\sum_{\epsilon}(-1)^{\epsilon} \sin(\epsilon\cdot\theta); $$ $$ \textrm{ when $r=2$, } \prod_{k=-1}^{n}\sin\theta_k=\frac{-1}{2^n}\sum_{\epsilon}(-1)^{\epsilon} \cos(\epsilon\cdot\theta); $$ $$ \textrm{ when $r=3$, } \prod_{k=-1}^{n}\sin\theta_k=\frac{-1}{2^n}\sum_{\epsilon}(-1)^{\epsilon} \sin(\epsilon\cdot\theta). $$

The technique can be adapted to describe a product of $s$ cosines with $(n-s)$ sines; the problem is fixing on a compact enough notation to keep track of the sign changes and the $\cos/\sin$ swaps.

Solution 2:

This seems the most natural choice of generalization I could come up with of a product $N$ sines. Let's begin!

$$\prod_{n=0}^{N-1} \sin(\theta_n)$$

$$\frac{1}{2^Ni^N}\prod_{n=0}^{N-1} (e^{i \theta_n}-e^{-i\theta_n})$$

Now we have to be a bit careful and expand this product into a sum of $2^N$ terms by noticing that I can imagine each term in the sum as coming from picking either the $e^{i \theta_n}$ term or the $-e^{-i\theta_n}$ term. We can put the first term as a $0$ digit and the second term as a $1$ digit for counting them in terms of the base $2$ expansion of our numbers from $0$ to $2^N-1$, specifically this is nice because it means we can encode the negative sign that appears as a coefficient and exponent as $(-1)^0$ or $(-1)^1$.

I'll write out an example with 2 terms to help illustrate the idea if you need the stepping stone,

$$((-1)^0e^{i(-1)^0\theta_0}+(-1)^1e^{i(-1)^1\theta_0})((-1)^0e^{i(-1)^0\theta_1}+(-1)^1e^{i(-1)^1\theta_1})$$

$$(-1)^{0+0}e^{i((-1)^0\theta_0+(-1)^0\theta_1)}+(-1)^{1+0}e^{i((-1)^1\theta_0+(-1)^0\theta_1)}+(-1)^{0+1}e^{i((-1)^0\theta_0+(-1)^1\theta_1)}+(-1)^{1+1}e^{i((-1)^1\theta_0+(-1)^1\theta_1)}$$

Hopefully it's clear to make out where the binary number digits of 00, 01, 10, and 11 are appearing.

Now the fully general version, specifically I'll be using the indices written in binary as: $k=\sum_{t=0}^{N-1}k_t2^t$.

$$\frac{1}{2^Ni^N}\sum_{k=0}^{2^N-1} (-1)^{\sum_{t=0}^{N-1}k_t} e^{i\sum_{t=0}^{N-1}(-1)^{k_t}\theta_t}$$

Now I want to highlight another trick with binary that we'll need to reform these exponentials back into trig functions. We want to pair up the exponentials that have the same angle, only negative. In terms of the binary digits, this means taking their complement, i.e. exchanging 0s and 1s. Thankfully this is a very simple operation, the complement of $k$ is $2^N-1 - k$. This is easily seen by the geometric series that $2^N-1 = \underset{\text{N times}}{\underbrace{11\dots11}}$ and so by subtracting $k\le 2^N-1$ we are simply removing the $1$s to get the complement. I will denote the $t$th digit of the complement as $\bar k_t$. Now we sum halfway and double up terms:

$$\frac{1}{2^Ni^N}\sum_{k=0}^{2^{N-1}-1} (-1)^{\sum_{t=0}^{N-1}k_t} e^{i\sum_{t=0}^{N-1}(-1)^{k_t}\theta_t}+ (-1)^{\sum_{t=0}^{N-1}\bar k_t} e^{i\sum_{t=0}^{N-1}(-1)^{\bar k_t}\theta_t}$$

Let's focus the two terms where the complement came in. In particular we'll use the fact that $(-1)^{\bar k_t} = (-1)^{k_t+1}$, which just says that $k_t$ and its complement digit have opposite parity, I'll work out the first occurrence here:

$$(-1)^{\sum_{t=0}^{N-1}\bar k_t} = \prod_{t=0}^{N-1} (-1)^{\bar k_t} = \prod_{t=0}^{N-1} (-1)^{k_t+1} = (-1)^N\prod_{t=0}^{N-1} (-1)^{k_t}$$

Plugging this back in with the other occurrence to put the $\bar k_t$ in terms of $k_t$ gets,

$$\frac{1}{2^Ni^N}\sum_{k=0}^{2^{N-1}-1} (-1)^{\sum_{t=0}^{N-1}k_t} e^{i\sum_{t=0}^{N-1}(-1)^{k_t}\theta_t}+ (-1)^N(-1)^{\sum_{t=0}^{N-1}k_t} e^{-i\sum_{t=0}^{N-1}(-1)^{k_t}\theta_t}$$

$$\frac{1}{2^{N-1}i^N}\sum_{k=0}^{2^{N-1}-1} (-1)^{\sum_{t=0}^{N-1}k_t} \left(\frac{e^{i\sum_{t=0}^{N-1}(-1)^{k_t}\theta_t}+ (-1)^Ne^{-i\sum_{t=0}^{N-1}(-1)^{k_t}\theta_t}}{2}\right)$$

Now if $N$ is even we get,

$$\prod_{n=0}^{N-1} \sin(\theta_n) = \frac{1}{2^{N-1}(-1)^\frac{N}{2}}\sum_{k=0}^{2^{N-1}-1} (-1)^{\sum_{t=0}^{N-1}k_t} \cos\left(\sum_{t=0}^{N-1}(-1)^{k_t}\theta_t\right)$$

And if $N$ is odd we get,

$$\prod_{n=0}^{N-1} \sin(\theta_n) = \frac{1}{2^{N-1}(-1)^\frac{N-1}{2}}\sum_{k=0}^{2^{N-1}-1} (-1)^{\sum_{t=0}^{N-1}k_t} \sin\left(\sum_{t=0}^{N-1}(-1)^{k_t}\theta_t\right)$$


We're done! But let's do a quick sanity check for the case when $N=2$ to see if we get what we know to be true.

$$\sin(\theta_0)\sin(\theta_1) = \frac{1}{-2}\sum_{k=0}^1(-1)^{\sum_{t=0}^1 k_t} \cos\left(\sum_{t=0}^1(-1)^{k_t}\theta_t\right)$$

$$=\frac{1}{-2}\left((-1)^{0+0}\cos((-1)^0\theta_0+(-1)^0\theta_1)+(-1)^{1+0}\cos((-1)^1\theta_0+(-1)^0\theta_1)\right)$$

$$=\frac{1}{2}\left(-\cos(\theta_0+\theta_1)+\cos(-\theta_0+\theta_1)\right)$$

This is exactly what we were expecting, that's a relief. If you need me to explain any parts more, just ask I'm happy to elaborate.