Finding the $n$th derivative of trigonometric function.. My maths teacher has asked me to find the $n$th derivative of $\cos^9(x)$. He gave us a hint which are as follows:
if $t=\cos x + i\sin x$,
   $1/t=\cos x - i\sin x$,
   then $2\cos x=(t+1/t)$.
How am I supposed to solve this? Please help me with explanations because I am not good at this. And yes he's taught us Leibniz Theorem. Thanks.
 A: De Moivre taught us that if $t=\cos x + i\sin x$ then $t^n = \cos(nx) + i\sin(nx)$ and $t^{-n} = \cos(nx) - i\sin(nx)$ so
$$
t^n + \frac 1 {t^n} = 2\cos(nx).
$$
Then, letting $s=1/t$, we have
\begin{align}
& (2\cos x)^9 =(t+s)^9 \\[10pt]
= {} & t^9 + 9t^8 s + 36t^7 s^2 + 84 t^6 s^3 + 126 t^5 s^4 + 126 t^4 s^5 + 84 t^3 s^6 + 36 t^2 s^7 + 9 t s^8 + s^9 \\
& {}\qquad \text{(binomial theorem)} \\[10pt]
= {} & t^9 + 9t^7 + 36 t^5 + 84 t^3 + 126 t + 126 \frac 1 t + 84 \frac 1 {t^3} + 36 \frac 1 {t^5} + 9 \frac 1 {t^7} + \frac 1 {t^9} \\[10pt]
= {} & \left( t^9 + \frac 1 {t^9} \right) + 9\left( t^7 + \frac 1 {t^7} \right) + 36\left( t^5 + \frac 1 {t^5} \right) + 84 \left( t^3 + \frac 1 {t^3} \right) + 126\left( t + \frac 1 t \right) \\[10pt]
= {} & 2\cos(9x) + 18 \cos(7x) + 72\cos(5x) + 168\cos(3x) + 252\cos x.
\end{align}
Now find the first, second, third, etc. derivatives and see if there's a pattern that continues every time you differentiate one more time.
A: Using his hint, you get
\begin{align*}
[\cos x]^9
&= \left[ \frac12 \left( t + \frac1t \right) \right]^9 \\
&= \frac{1}{2^9} \sum_{k=0}^9 {9 \choose k} (t)^k \left( \frac1t \right)^{9-k} \\
&= \frac{1}{2^9} \sum_{k=0}^9 {9 \choose k} t^{2k-9}. \tag{1}
\end{align*}
Also,
$$
\frac{dt}{dx} = -\sin x + i \cos x = i(\cos x + i \sin x) = it;
$$
Therefore,
$$
\frac{d}{dx} t^n = n t^{n-1} (it) = in t^n;
$$
it follows that
$$
\frac{d^N}{dx^N} t^n = (in)^N t^n.
$$
Applying this to (1),
\begin{align*}
\frac{d^N}{dx^N} [\cos x]^9
&= \frac{d^N}{dx^N} \frac{1}{2^9} \sum_{k=0}^9 {9 \choose k} t^{2k-9} \\
&= \frac{1}{2^9} \sum_{k=0}^9 {9 \choose k} \frac{d^N}{dx^N} t^{2k-9} \\
&= \frac{1}{2^9} \sum_{k=0}^9 {9 \choose k} (2k-9)^N i^N t^{2k-9} \\
&= \frac{1}{2^{10}}
\left[ \sum_{k=0}^9 {9 \choose k} (2k-9)^N i^N t^{2k-9}
 + \sum_{k=0}^9 {9 \choose {9-k}} (2(9-k)-9)^N i^N t^{2(9-k)-9} \right] \\
&= \frac{1}{2^{10}}
\left[ \sum_{k=0}^9 {9 \choose k} \left( (2k-9)^N i^N t^{2k-9}
  + (9-2k)^N i^N t^{9-2k} \right) \right] \\
&= \frac{1}{2^{10}}
\left[ \sum_{k=0}^9 {9 \choose k} (2k-9)^N i^N \left( t^{2k-9}
  + (-1)^N t^{9-2k} \right) \right] \\
&= \begin{cases}
\frac{1}{2^9}
\sum_{k=0}^9 {9 \choose k} (2k-9)^N i^N \cos((2k-9)x)
&N \text{ even} \\
\frac{1}{2^9}
\sum_{k=0}^9 {9 \choose k} (2k-9)^N i^{N+1} \sin((2k-9)x)
&N \text{ odd} \\
\end{cases} \\
&= \begin{cases}
\frac{1}{2^9}
\sum_{k=0}^9 {9 \choose k} (2k-9)^N (-1)^{N/2} \cos((2k-9)x)
&N \text{ even} \\
\frac{1}{2^9}
\sum_{k=0}^9 {9 \choose k} (2k-9)^N (-1)^{(N+1)/2} \sin((2k-9)x)
&N \text{ odd}. \\
\end{cases}
\end{align*}
A: The trick is to decompose $\cos^9(x)$ in its Fourier series, i.e. a linear combination of $\cos(kx)$ and $\sin(kx)$ terms, which we know how to derive $N$ times.
Using the hint and the Binomial development (row $9$ of Pascal's triangle), $$\cos^9(x)=\left(\frac{t+t^{-1}}2\right)^9\\
=\frac{t^9+t^{-9}+9(t^7+t^{-7})+36(t^5+t^{-5})+84(t^3+t^{-3})+126(t+t^{-1})}{512}\\
=\frac{\cos(9x)+9\cos(7x)+36\cos(5x)+84\cos(3x)+126\cos(x)}{256}.$$
Now the derivatives of $\cos(kx)$ are
$$\cos(kx),-k\sin(kx),-k^2\cos(kx),k^3\sin(kx),k^4\cos(kx)\cdots$$
hence
$$\frac{9^Ng_N(9x)+9\cdot7^Ng_N(7x)+36\cdot5^Ng_N(5x)+84\cdot3^Ng_N(3x)+126g_N(x)}{256}$$
where $g_N(x)$ is $\cos(x),-\sin(x),-\cos(x),\sin(x)$, depending on $N\bmod 4$.
