Finding the $n$-th derivative of $f(x)=e^{x}\sin(x)$

I am trying to find the general form for the $n$-th derivative of $f(x)=e^{x}\sin(x)$.

I have calculated the derivatives up to $5$, but I am having trouble coming up with a general rule. Here is my work so far:

f^{(1)}(x)&=e^{x}\cos(x) + e^{x} \sin(x)\\
f^{(2)}(x)&= 2e^{x}\cos(x)= e^{x}(\sin(x)+ \cos(x)) + e^{x}(\cos(x)- \sin(x))\\
f^{(3)}(x)&=2e^{x}\cos(x) -2e^{x} \sin(x)\\
f^{(5)}(x)&=-4e^{x}\cos(x) -4e^{x} \sin(x)\\

I am having trouble spotting the pattern to derive the formula for the nth derivative of this function. Any help would be greatly appreciated.

Solutions Collecting From Web of "Finding the $n$-th derivative of $f(x)=e^{x}\sin(x)$"

The pattern is already visible —
observe that $f^{4}(x)=-4f(x)$, thus

$$f^{(n)}(x)=(-4)^{[n/4]}f^{(n \bmod 4)}(x)$$

You can also observe that
$$ e^x\sin x = e^x\frac{e^{ix}-e^{-ix}}{2i} = \tfrac12 i e^{(1-i)x} – \tfrac12 i e^{(1+i)x} $$
which is easy to differentiate $n$ times term for term.

Write $$f(x) = e^x \sin x = \frac{1}{2i} e^x (e^{ix} – e^{-ix}) = \frac{1}{2i} (e^{(1+i)x} – e^{(1-i)x}).$$ Then we immediately have $$f^{(n)}(x) = \frac{d^n}{dx^n}\left[e^x \sin x\right] = \frac{1}{2i} \left((1+i)^n e^{(1+i)x} – (1-i)^n e^{(1-i)x}\right).$$ All that remains is to rewrite this in terms of real valued functions. We note $1 + i = \sqrt{2} e^{\pi i/4}$ and $1-i = \sqrt{2} e^{-\pi i /4}$, so $$f^{(n)}(x) = \frac{e^x}{2i} 2^{n/2} \left( e^{ix + \pi i n/4} – e^{-(ix + \pi i n/4)} \right) = e^x 2^{n/2} \sin \left(x + \frac{n\pi}{4}\right).$$

All these expressions are of the form


Let us establish a recurrence relation.


So $$c_{n+1}=c_n+s_n,\\s_{n+1}=s_n-c_n.$$

We can eliminate $s$ by

$$c_{n+2}=c_{n+1}+s_{n+1}=c_{n+1}+s_n-c_n=2c_{n+1}-c_n,$$ or


We know that such recurrences have geometric sequences for solutions, and after finding the roots of the characteristic polynomial, $a=\sqrt2-1$ and $b=-\sqrt2-1$,


From there,


With the given starting conditions,

$$c_0=0,s_0=1,$$ we find


Finally, the general expression