Finding the $n$-th derivative of $f(x) =e^x \sin x$, solving the recurrence relation

Note that $S_{n+4} = -4 S_n$ and $C_{n+4} =-4 C_n$. So $S_{4k+j} = (-4)^k S_j$ and $C_{4k+j} = (-4)^k C_j$. List the cases $j = 0$ to $3$ and you're done.


\begin{align} \left( \begin{array}{r} S_n\\C_n\\ \end{array} \right) &= \left( \begin{array}{rr} 1 &-1\\ 1 &1\\ \end{array} \right) \left(\begin{array}{c} S_{n-1}\\C_{n-1}\\ \end{array} \right)\\ &=\left( \begin{array}{rr} 1 &-1\\ 1 &1\\ \end{array} \right)^n \left(\begin{array}{c} S_{0}\\C_{0}\\ \end{array} \right) \end{align}

Approach 1: Compute eigen-decomposition of the matrix and continue.

Approach 2: Eigenvalues are $(1+i)$ and $(1-i)$. Therefore, $S_n$ must be of the form $A(1+i)^n+B(1-i)^n$. Now, use values of $S_0$ and $S_1$ to compute $A$ and $B$. $A=B=1/2$.

After further simplification, we get $$S_n = \sqrt{2^n} \cos \frac{n\pi}{4}, C_n = \sqrt{2^n} \sin \frac{n\pi}{4}$$


The recurrence $S_n=S_{n-1}-2S_{n-3}$ can be solved mechanically. Its auxiliary equation is $x^3-x^2+2=0$. By inspection $-1$ is a solution, so $x+1$ is a factor of the cubic: $$x^3-x^2+2=(x+1)(x^2-2x+2)\;.$$ The other roots are $$\frac{2\pm\sqrt{-4}}2=1\pm i\;,$$ so the solution is of the form $S_n=A(-1)^n+B(1+i)^n+C(1-i)^n$. From the initial values $S_0=S_1=1$ and $S_2=0$ we get

$$\left\{\begin{align*} &A+B+C=1\\ &-A+B+C+Bi-Ci=1\\ &A+2Bi-2Ci=0 \end{align*}\right.$$

This system has the solution $A=0,B=C=\frac12$, so $$S_n=\frac12\left((1+i)^n+(1-i)^n\right)$$ and $$C_n=(1+i)^{n-2}+(1-i)^{n-2}\;.$$

Now $1+i=\sqrt2 e^{i\pi/4}$ and $1-i=\sqrt2 e^{-i\pi/4}$, so

$$\left\{\begin{align*} &S_n=2^{(n-2)/2}\left(e^{in\pi/4}+e^{-in\pi/4}\right)=2^{n/2}\cos\frac{n\pi}4\\ &C_n=2^{(n-2)/2}\left(e^{i(n-2)\pi/4}+e^{-i(n-2)\pi/4}\right)=2^{n/2}\cos\frac{(n-2)\pi}4=2^{n/2}\sin\frac{n\pi}4\;. \end{align*}\right.$$