Cosine Expansions

$ \def \half {\frac{1}{2}} \def \hieruit {\quad \Longrightarrow \quad} \def \EN {\quad \mbox{and} \quad} $ The following formula will be considered well known. It has been mentioned in the good old Trigonometry classes, for sure: $$ \cos(2 x) = \cos^2(x) - \sin^2(x) = 2\,\cos^2(x) - 1 $$ Maybe the reverse of this is somewhere on your background memory too: $$ \cos^2(x) = \half + \half\,\cos(2 x) $$

Multiple to Powers

It is questioned whether such a formula, where the cosine of the double angle is expressed as a polynomial in the cosines of the single angle, could also be derived for the triple angle case: $$ \cos(3 x) = \cos(2 x)\,\cos(x) - \sin(2 x)\,\sin(x) = $$ $$ \left[ 2\,\cos^2(x) - 1 \right] \,\cos(x) - 2\,\sin(x)\,\cos(x)\,\sin(x) = $$ $$ 2\,\cos^3(x) - \cos(x) - 2\,\cos(x) \left[ 1 - \cos^2(x) \right] $$ So the answer is yes: $$ \cos(3 x) = 4\,\cos^3(x) - 3\,\cos(x) $$ Such a thing can also be done for the case of four times an angle: $cos(4 x) =$ $$ 2\,\cos^2(2 x) - 1 = 2\left[ 2\,\cos^2(x) - 1 \right]^2 - 1 = 2\left[ 4\,\cos^4(x) - 4\,\cos^2(x) + 1 \right] - 1 $$ $$ \hieruit \cos(4x) = 8\,\cos^4(x) - 8\,\cos^2(x) + 1 $$ And for five times the angle: $$ \cos(5 x) = \cos(4 x)\,\cos(x) - \sin(4 x)\,\sin(x) = $$ $$ \left[ 2\,\cos^2(2 x) - 1 \right] \cos(x) - 2\,\sin(2 x)\,\cos(2 x)\,\sin(x) $$ $$ \left[ 2\,\left\{ 2\,\cos^2(x) - 1 \right\}^2 - 1 \right] \cos(x) - 2.2\,\sin(x)\,\cos(x)\,\left\{ 2\,\cos^2(x) - 1 \right\}\,\sin(x) = $$ $$ \left[ 2\,\left\{ 2\,\cos^2(x) - 1 \right\}^2 - 1 \right] \cos(x) - 4\,\left\{1 - \cos^2(x)\right\} \cos(x) \left\{ 2\,\cos^2(x) - 1 \right\} $$ With a little help of MAPLE:
> s := (2*(2*u^2-1)^2-1)*u-4*(1-u^2)*u*(2*u^2-1);
> series(s,u);
We find: $$ \cos(5 x) = 5\,\cos(x) - 20\,\cos^3(x) + 16\,\cos^5(x) $$ The conjecture may be rised whether this pattern is a general phenomenon: that is, whether any cosine of a multiple of an angle $x$ can be expressed as a polynomial of cosines of the single angle $x$ . The answer will turn out to be confirmative. In order to prove this, the famous formula by Euler will be employed: $$ e^{i.n.x} = \cos(n.x) + i.\sin(n.x) $$ In addition, one has Newton's binomial formula: $$ e^{i.n.x} = \left( e^{i.x} \right)^n = \left[ \cos(x) + i.\sin(x) \right]^n = \sum_{k=0}^n C(n,k)\,\cos^{n-k}(x)\,\left[i.\sin(x)\right]^k $$ Where $C(n,k)$ is the number of $k$ combinations out of $n$ : $$ C(n,k) = \frac{n!}{(n-k)!\,k!} $$ We are, of course, only interested in the real part of the expressions with the complex exponentials. Now the factor $\left[i.\sin(x)\right]^k$ is not imaginary if and only if $k$ is even, say $k = 2m$ . In this case we can write: $$ \left[i.\sin(x)\right]^{2m} = (-1)^m\,\left[\sin^2(x)\right]^m = (-1)^m\,\left[1-\cos^2(x)\right]^m $$ Thus we are left with a series of cosine functions only: $$ \cos(n.x) = \sum_{m=0}^{n/2} C(n,2m)\,\cos^{n-2m}(x)\,(-1)^m\,\left[1-\cos^2(x)\right]^m $$ Strictly spoken, our conjecture is already proved herewith. But let's take a closer look at the result: $$ \cos(n.x) = \sum_{m=0}^{n/2} C(n,2m)\,\cos^{n-2m}(x)\,(-1)^m \sum_{k=0}^m C(m,k) (-1)^{-k}\,\cos^{2k}(x) $$ $$ = \sum_{m=0}^{n/2} \sum_{k=0}^m (-1)^{m-k} C(n,2m)\,C(m,k)\,\cos^{n-2m+2k}(x) $$ It makes no difference if, meanwhile, there is a subtle change of sign introduced with $(-1)^k \rightarrow (-1)^{-k}$ . For a good reason, because now we can define a new variable $L = m-k \rightarrow (k=m-L)$ in: $$ \cos(n.x) = \sum_{m=0}^{n/2} \sum_{L=0}^m (-1)^L C(n,2m)\,C(m,m-L)\,\cos^{n-2L}(x) $$ And exchange summations: $$ = \sum_{L=0}^{n/2} \sum_{m=L}^{n/2} (-1)^L C(n,2m)\,C(m,m-L)\,\cos^{n-2L}(x) $$ Giving the polynomial, at last: $$ \cos(n.x) = \sum_{L=0}^{n/2} (-1)^L \left[ \sum_{m=L}^{n/2} C(n,2m)\,C(m,L) \right] \cos^{n-2L}(x) $$ Where high powers of the cosine are formed first.

Power to Multiples

Now prepare for the reverse: when powers of $\cos(x)$ are given, is it also possible then to construct the accompanying, and equivalent, $\cos(k x)$ terms? The answer is, again, confirmative. A sample run with the accompanying Delphi program zagreb.dpr gives as a result: \begin{eqnarray*} \cos(0 x) &=& 1 \\ \cos(1 x) &=& \cos(x) \\ \cos(2 x) &=& - 1 + 2.\cos^2(x) \\ \cos(3 x) &=& - 3.\cos(x) + 4.\cos^3(x) \\ \cos(4 x) &=& + 1 - 8.\cos^2(x) + 8.\cos^4(x) \\ \cos(5 x) &=& + 5.\cos(x) - 20.\cos^3(x) + 16.\cos^5(x) \\ \cos(6 x) &=& - 1 + 18.\cos^2(x) - 48.\cos^4(x) + 32.\cos^6(x) \\ \cos(7 x) &=& - 7.\cos(x) + 56.\cos^3(x) - 112.\cos^5(x) + 64.\cos^7(x) \end{eqnarray*} In matrix form: $$ \left[ \begin{array}{c} \cos(0 x) \\ \cos(1 x) \\ \cos(2 x) \\ \cos(3 x) \\ \cos(4 x) \\ \cos(5 x) \\ \cos(6 x) \\ \cos(7 x) \\ \end{array} \right] = \left[ \begin{array}{rrrrrrrr} +1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & +1 & 0 & 0 & 0 & 0 & 0 & 0 \\ -1 & 0 & +2 & 0 & 0 & 0 & 0 & 0 \\ 0 & -3 & 0 & +4 & 0 & 0 & 0 & 0 \\ +1 & 0 & -8 & 0 & +8 & 0 & 0 & 0 \\ 0 & +5 & 0 & -20 & 0 & +16 & 0 & 0 \\ -1 & 0 & +18 & 0 & -48 & 0 & +32 & 0 \\ 0 & -7 & 0 & +56 & 0 &-112 & 0 & +64 \end{array} \right] \left[ \begin{array}{c} \cos^0(x) \\ \cos^1(x) \\ \cos^2(x) \\ \cos^3(x) \\ \cos^4(x) \\ \cos^5(x) \\ \cos^6(x) \\ \cos^7(x) \end{array} \right] $$ It is seen that the equations to be solved are already in lower triangular form. Thus it is sufficient to pivot only the lower triangle. Furthermore, the matrix can be "blocked out", as follows: $$ \left[ \begin{array}{c} \cos(0 x) \\ \cos(2 x) \\ \cos(4 x) \\ \cos(6 x) \\ \cos(1 x) \\ \cos(3 x) \\ \cos(5 x) \\ \cos(7 x) \\ \end{array} \right] = \left[ \begin{array}{rrrrrrrr} +1 & 0 & 0 & 0 & & & & \\ -1 & +2 & 0 & 0 & & & & \\ +1 & -8 & +8 & 0 & & & & \\ -1 & +18 & -48 & +32 & & & & \\ & & & & +1 & 0 & 0 & 0 \\ & & & & -3 & +4 & 0 & 0 \\ & & & & +5 & -20 & +16 & 0 \\ & & & & -7 & +56 &-112 & +64 \end{array} \right] \left[ \begin{array}{c} \cos^0(x) \\ \cos^2(x) \\ \cos^4(x) \\ \cos^6(x) \\ \cos^1(x) \\ \cos^3(x) \\ \cos^5(x) \\ \cos^7(x) \end{array} \right] $$ Hence the above matrix splits into two halve matrices to be inverted, meaning that pivoting can be done for all even and for all odd entries separately: $$ A = \left[ \begin{array}{rrrr} +1 & 0 & 0 & 0 \\ -1 & +2 & 0 & 0 \\ +1 & -8 & +8 & 0 \\ -1 & +18 & -48 & +32 \end{array} \right] \EN B = \left[ \begin{array}{rrrr} +1 & 0 & 0 & 0 \\ -3 & +4 & 0 & 0 \\ +5 & -20 & +16 & 0 \\ -7 & +56 &-112 & +64 \end{array} \right] $$ These submatrices are small enough to allow pivoting by hand. For matrix $A$ : $$ \left[ \begin{array}{rrrr} 1 & & & \\ -1 & 2 & & \\ 1 & -8 & 8 & \\ -1 & 18 & -48 & 32 \end{array} \right] \left[ \begin{array}{rrrr} 1 & & & \\ 0 & 1 & & \\ 0 & 0 & 1 & \\ 0 & 0 & 0 & 1 \end{array} \right] $$ $$ \left[ \begin{array}{rrrr} 1 & & & \\ 0 & 2 & & \\ 0 & -8 & 8 & \\ 0 & 18 & -48 & 32 \end{array} \right] \left[ \begin{array}{rrrr} 1 & & & \\ 1 & 1 & & \\ -1 & 0 & 1 & \\ 1 & 0 & 0 & 1 \end{array} \right] $$ $$ \left[ \begin{array}{rrrr} 1 & & & \\ 0 & 2 & & \\ 0 & 0 & 8 & \\ 0 & 0 & -48 & 32 \end{array} \right] \left[ \begin{array}{rrrr} 1 & & & \\ 1 & 1 & & \\ 3 & 4 & 1 & \\ -8 & -9 & 0 & 1 \end{array} \right] $$ $$ \left[ \begin{array}{rrrr} 1 & & & \\ 0 & 2 & & \\ 0 & 0 & 8 & \\ 0 & 0 & 0 & 32 \end{array} \right] \left[ \begin{array}{rrrr} 1 & & & \\ 1 & 1 & & \\ 3 & 4 & 1 & \\ 10 & 15 & 6 & 1 \end{array} \right] $$ $$ \left[ \begin{array}{rrrr} 1 & & & \\ 0 & 1 & & \\ 0 & 0 & 1 & \\ 0 & 0 & 0 & 1 \end{array} \right] \left[ \begin{array}{rrrr} 1 & & & \\ 1/2 & 1/2 & & \\ 3/8 & 4/8 & 1/8 & \\ 10/32&15/32& 6/32&1/32 \end{array} \right] $$ Hence: $$ \left[ \begin{array}{rrrr} 1 & & & \\ -1 & 2 & & \\ 1 & -8 & 8 & \\ -1 & 18 & -48 & 32 \end{array} \right]^{-1} = \left[ \begin{array}{rrrr} 1 & & & \\ 1/2 & 1/2 & & \\ 3/8 & 1/2 & 1/8 & \\ 5/16&15/32& 3/16&1/32 \end{array} \right] $$ When performing the same kind of work for matrix $B$, we find: $$ \left[ \begin{array}{rrrr} 1 & & & \\ -3 & 4 & & \\ 5 & -20 & 16 & \\ -7 & 56 &-112 & 64 \end{array} \right]^{-1} = \left[ \begin{array}{rrrr} 1 & & & \\ 3/4 & 1/4 & & \\ 5/8 & 5/16& 1/16& \\ 35/64&21/64& 7/64&1/64\end{array} \right] $$ Herewith we finally find (nontrivial results only): \begin{eqnarray*} \cos^2(x) &=& \half + \half\,\cos(2 x) \\ \cos^3(x) &=& \frac{3}{4}\,\cos(x) + \frac{1}{4}\,\cos(3 x) \\ \cos^4(x) &=& \frac{3}{8} + \half\,\cos(2 x) + \frac{1}{8}\,\cos(4 x) \\ \cos^5(x) &=& \frac{5}{8}\,\cos(x) + \frac{5}{16}\,\cos(3 x) + \frac{1}{16}\,\cos(5 x) \\ \cos^6(x) &=& \frac{5}{16} + \frac{15}{32}\,\cos(2 x) + \frac{3}{16}\,\cos(4 x) + \frac{1}{32}\,\cos(6 x) \\ \cos^7(x) &=& \frac{35}{64}\,\cos(x) + \frac{21}{64}\,\cos(3 x) + \frac{7}{64}\,\cos(5 x) + \frac{1}{64}\,\cos(7 x) \end{eqnarray*} More general forms of these relationships are coded as a Delphi Pascal Unit, the source of which is called croatia.pas. The class Cosines has only two methods: Multiple2Powers and Power2Multiples. Each of these methods has an integer $n$ as its input and a $(n+1)\times (n+1)$ matrix as its output. These matrices contain many zeroes, since economization on space has not been on the list of our priorities.
And, oh yeah, the program names croatia.pas and zagreb.dpr stem from the fact that Internet references on this subject were mainly from the Ministry of Science and Technology in Croatia (with Zagreb as its capital city). It is very unlikely, though, that 1991 would be the year of discovery of these formulas. I suppose they must be much older. One reason being that they have been implemented in Computer Algebra Systems, such as MAPLE and Mathematica, for quite some time.