TITLE: $n$th derivative of $e^x \sin x$
QUESTION [10 upvotes]: Can someone check this for me, please? The exercise is just to find a expression to the nth derivative of $f(x) = e^x \cdot \sin x$. I have done the following:
Write $\sin x = \dfrac{e^{ix} - e^{-ix}}{2i}$, then we have $f(x) = \dfrac{1}{2i} \cdot (e^{(1+i)x} - e^{(1-i)x})$. 
Taking the derivatives: $f^{(n)}(x) = \dfrac{1}{2i} \cdot ((1+i)^n e^{(1+i)x} - (1-i)^n e^{(1-i)x})$
Now, I use that: $$ (1+i)^n = {\sqrt{2}}^n \cdot \left(\cos\dfrac{n \pi}{4} + i \sin\dfrac{n \pi}{4}\right) \\(1 - i)^n = \sqrt{2}^n \cdot \left( \cos \dfrac{-n \pi}{4} + i \sin \dfrac{-n \pi}{4} \right)$$
Plugging that mess, I get: $$f^{(n)}(x) = \dfrac{e^x}{2i} \sqrt{2}^n \cdot \left(\left(\cos \dfrac{n \pi}{4} + i \sin \dfrac{n \pi}{4}\right) e^{ix} - \left(\cos \dfrac{-n \pi}{4} + i \sin \dfrac{- n \pi}{4}\right) e^{-ix} \right)$$
But, $e^{ix} = \cos x + i \sin x$, and using Moivre's theorem, that makes: $$f^{(n)}(x) = \dfrac{e^x}{2i} \sqrt{2}^n \cdot \left(\cos \left( x + \frac{n \pi}{4}\right) + i \sin \left( x + \frac{n \pi}{4}\right) - \left(\cos \left( - x  - \frac{n \pi}{4}\right) + i \sin \left( -x -\frac{ n \pi}{4}\right)\right)\right)$$
and since $\cos$ is an even function, and $\sin$ is odd, we get: $$f^{(n)}(x) = \dfrac{e^x}{2i} \sqrt{2}^n \cdot 2i \sin \left(x + \dfrac{n \pi}{4}\right)$$
Simplifying, the answer would be $f^{(n)}(x) = e^x \cdot \sqrt{2}^n \cdot \sin\left(x + \dfrac{n \pi}{4}\right)$. I'm almost positive that this is it, but I just want to be sure. Thank you in advance!

REPLY [4 votes]: Yes. Your derivation is correct. Here is a distillation that might make it simpler to see what is going on:
$$
\begin{align}
\frac{\mathrm{d}^n}{\mathrm{d}x^n}e^x\sin(x)
&=\frac{\mathrm{d}^n}{\mathrm{d}x^n}\frac1{2i}\left(e^{(1+i)x}-e^{(1-i)x}\right)\\
&=\frac1{2i}\left((1+i)^ne^{(1+i)x}-(1-i)^ne^{(1-i)x}\right)\\
&=\frac1{2i}2^{n/2}\left(e^{in\pi/4}e^{(1+i)x}-e^{-in\pi/4}e^{(1-i)x}\right)\\[4pt]
&=2^{n/2}e^x\sin(x+n\pi/4)
\end{align}
$$