# Expansion of $\cos (x_1+x_2 + \cdots + x_n)$?

Which existing symbolism can we use? or should be suggested? in order to write a concise formula for $\cos (x_1+x_2 + \cdots + x_n)$.

Beginning from the trigonometric identities \eqalign{ \cos(a+b) &= \cos a \cos b - \sin a \sin b \cr \sin(a+b) &= \sin a \cos b - \cos a \sin b \cr } and in order to ease calculation, I considered the following BNF grammar: \eqalign{ 0 &\rightarrow 00 - 11 \cr 1 &\rightarrow 10 + 01 \cr } where $0$ is assumed to represent a $\cos$ and $1$ a $\sin$. I got this way : \eqalign{ \cos (a+b+c) &= \cos((a+b)+c) \cr &= (00-11)0-(10+01)1 \cr &= 000 - 110 - 101 - 011 \cr & which\ is\ interpreted \cr &::\ \cos a \cos b \cos c - \sin a \sin b \cos c - \sin a \cos b \sin c - \cos a \sin b \sin c \cr } Observing that from the set ${000,001,010,011,100,101,110,111}$ we take the elements with odd number of zeroes(cosines) $k$ and sign $(-)^{3-k}$. Continuing with $\cos (a+b+c+d)$ I got : \eqalign{ \cos (a+b+c+d) &= \cos((a+b)+(c+d)) \cr &= (00-11)(00-11) -(10+01)(10+01) \cr &= 0000 - 0011 - 1100 + 1111 - 1010 -1001 - 0110 -0101 \cr &::\ even\ number\ of\ 0's(cosines)=k,\ sign\ (-)^{k \over 2} \cr }

• How about using $\cos\theta = \Re(e^{i\theta})$? – Sangchul Lee Feb 21 '16 at 12:46

This might be helpful:$$\cos\left(x_{1}+\cdots+x_{n}\right)+i\sin\left(x_{1}+\cdots+x_{n}\right)=\prod_{k=1}^{n}\left(\cos x_{k}+i\sin x_{k}\right)$$

There's no great way to write this out symbolically.

One might try by defining for $S\subseteq \{1,2,\dots,n\}$, $$a_{S}=(-1)^{\lfloor |S|/2\rfloor}\prod_{i\in S} \sin x_i \prod_{i\not\in S} \cos x_i$$

Then:

$$\cos(x_1+\cdots x_n)=\sum_{|S|\text{ even}}a_S$$

Likewise:

$$\sin(x_1+\cdots x_n) = \sum_{|S|\text{ odd}}a_S$$

Note that the first formula gives us a formula for $\cos(nx)$ in terms of $\cos x$ because $-\sin^2(x)=\cos^2(x)-1$. So if $x_1=\cdots=x_n=x$, then:

$$\cos nx = \sum_{k=0}^{\lfloor n/2\rfloor}\binom{n}{2k}\left(\cos x\right)^{n-2k}(\cos^2 x-1)^k$$