$n$th derivative of $e^x \sin x$ 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!
 A: Yes, your work is correct. But there is an easier way. Put $g(x)= e^{(1+i)x}$ and note that $f(x)$ is the imaginary part of $g(x)$ for real $x$. Now $g^{(n)}(x) =(1+i)^n e^{(1+i)x}$. Since $1+i=2^{1/2} e^{\pi i/4}$, we have $g^{(n)}(x) =2^{n/2}e^{n\pi i/4}e^{(1+i)x}=2^{n/2}e^{x + i(x +n\pi /4)}$. Thus $f^{(n)}(x)$ is the imaginary part of $g^{(n)}(x)$, which is $2^{n/2}e^x \sin (x +n\pi /4)$ as desired.
A: There is a nice point that tells $$D^n\{e^{kx}f(x)\}=e^{kx}(D+k)^nf(x)$$ It can be proved by an inductive approach on $n$. By using it we get: $$D\left(e^x\sin x\right)=e^x(D+1)\sin x=e^x(\cos x+\sin x)=\sqrt{2}e^x\sin(x+\pi/4)\\D^2\left(e^x\sin x\right)=D(\sqrt{2}e^x\sin(x+\pi/4))=\sqrt{2}e^x(D+1)\sin(x+\pi/4)=\sqrt{2}e^x[\cos(x+\pi/4)+\sin(x+\pi/4)]=(\sqrt{2})^2e^x\sin(x+2\pi/4)$$ So we can guess that $D^n(e^x\sin x)=(\sqrt{2})^ne^x\sin(x+n\pi/4)$. What is remained is to prove it by induction on $n$. If $D^k(e^x\sin x)=(\sqrt{2})^ke^x\sin(x+k\pi/4)$ then $$D^{k+1}(e^x\sin x)=D[(\sqrt{2})^ke^x\sin(x+k\pi/4)]=(\sqrt{2})^ke^x(D+1)\sin(x+k\pi/4)=\cdots=(\sqrt{2})^{k+1}e^x\sin(x+(k+1)\pi/4)$$
A: 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}
$$
