Finding the $ n $-th derivative of $ {\cos^{n}}(x) $. 
Problem. Find the $ n $-th derivative of $ {\cos^{n}}(x) $.

What I’m doing is substituting $ t = \cos(x) $ and then finding the $ n $-th derivative of the new function, but I’ve a feeling that this is wrong. Could anyone please point out the correct method? Thank you!
 A: $$ cos(x) = \frac{e^{ix}+e^{-ix}}{2} $$
$$ cos^n(x) = \left(\frac{e^{ix}+e^{-ix}}{2}\right)^n = \frac1{2^n}\sum_{k=0}^n \dbinom{n}{k} e^{ikx}e^{-i(n-k)x}$$
$$ cos^n(x) = \frac1{2^n}\sum_{k=0}^n \dbinom{n}{k} e^{i(2k-n)x}$$
$$ \frac{d^n}{dx^n}cos^n(x) = \frac{i^n}{2^n}\sum_{k=0}^n \dbinom{n}{k} (2k-n)^n e^{i(2k-n)x}$$
A: Doing it directly is likely to lead to a messy computation. 
From trigonometry, we know that
\begin{align*}
2^{n-1}\cos^n x = \cos nx +\binom{n}{1} \cos(n-2)x + \binom{n}{2}\cos(n-4)x + \cdots
\end{align*}
Now, we calculate $\dfrac{d^n}{dx^n}(\cos kx)$ for an arbitrary $k$ as follows:
\begin{align*}
\frac{d}{dx}(\cos kx) &= -k\sin kx = k \cos\left(\frac{\pi}{2}+kx\right) \\
\frac{d^2}{dx^2}(\cos kx) &= \frac{d}{dx}\left( k \cos\left(\frac{\pi}{2}+kx\right)\right) \\
&= -k^2 \sin\left(\frac{\pi}{2}+kx\right) \\
&= k^2 \cos\left(2\cdot\frac{\pi}{2}+kx\right)
\end{align*}
Hence, more generally,
\begin{align*}
\frac{d^n}{dx^n}(\cos kx) &=k^n \cos\left(n\cdot\frac{\pi}{2}+kx\right)
\end{align*}
Thus,
\begin{align*}
2^{n-1}\frac{d^n}{dx^n}(\cos^n x) &= n^n \cos\left(n \cdot \frac{\pi}{2} + nx\right)+\binom{n}{1}(n-2)^n \cos\left(n \cdot \frac{\pi}{2} +(n-2)x\right)+\binom{n}{2}(n-4)^n \cos\left(n \cdot \frac{\pi}{2} +(n-4)x\right)\cdots
\end{align*}
