If $y=\mathrm{e}^x\big(a\sin x+b\cos x\big)$, then express $y^{(n)}$ in terms of $y$ and $y'$. Let $y=e^x(a\sin x+b\cos x)$.  Show $y''=py'+ qy$ for some constants $p$ and $q$; and express all higher derivatives as linear combinations of $y'$ and $y$.
I got to $y''=2y'-2y$, but I'm not sure how to do the linear combinations part, I don't know how to reduce the $n$th derivative to just $y'$ and $y$.
 A: Take $n$ derivatives of the ODE and call the $n$'th derivative $y^{(n)} = a_n$ to get the recurrence relation $$a_{n+2} = pa_{n+1} + q a_n,~~~\text{with}~~~a_0 = y~~~\text{and}~~~a_1 = y'.$$
This can be solved using the standard method: First solve the characteristic equation $r^2 = pr + q$ to get the two roots $r_{\pm}$ and (assuming they are distinct) then the solution is $a_n = Ar_+^n + Br_-^n$ (otherwise if $q = -(p/2)^2$ then $a_n = Ar_+^n + B n r_+^n$) for some constants $A,B$. Plugging in $n=0,1$ and applying the initial conditions one can solve for the free constants $A,B$:
$$a_0 = y = A + B~~~\text{and}~~~a_1 = y' = Ar_+ + Br_-.$$
A: From $y''=2y'-2y$ we get $y'''=2y''-2y'=2(2y'-2y)-2y'=2y'-4y$.
Can you proceed ?
A: Observe that
$$
y=c_1\mathrm{e}^{(1+i)x}+c_2\mathrm{e}^{(1-i)x}
$$ 
where $c_1,c_2$ can be obtain from
$$
y=c_1\mathrm{e}^{(1+i)x}+c_2\mathrm{e}^{(1-i)x}=\mathrm{e}^x(a\sin x+b\cos x)
$$
i.e.,
$$
c_1=\frac{b-ai}{2},\quad  c_2=\frac{b+ai}{2}.
$$
Next,
$$
y^{(n)}=c_1(1+i)^n\mathrm{e}^{(1+i)x}+c_2(1-i)^n\mathrm{e}^{(1-i)x} \\=2^{n/2}\mathrm{e}^{x}\big(c_1\mathrm{e}^{ix+n\pi i/4}+c_2\mathrm{e}^{-ix+n\pi i/4}\big)=2^{n/2}\mathrm{e}^{x}\big(a\sin(x+n\pi/4)+b\cos(x+n\pi/4)\big)
$$ 
To get $y^{(n)}$ as a linear combination of $y$ and $y'$ can be done according to:
$$
y''-(a+b)y'+aby=0\quad\Longrightarrow\quad y^{(n)}=c_1a^n+c_2b^n
$$
In our case $a=1+i,\,b=1-i$ and
$$
c_1=\frac{1}{2}\big((1-i)y-iy'\big),\quad c_2=\frac{1}{2}\big((1+i)y+iy'\big)
$$
Altogether
$$
y^{(n)}=\frac{1}{2}\left(\big((1-i)y-iy'\big)(1+i)^n+\big((1+i)y+iy'\big)(1-i)^n)\right) \\ = \big((1+i)^{n-1}+(1-i)^{n-1}\big)y-i\big((1+i)^{n}-(1+i)^{n}\big)y \\= 2^{(n+1)/2}\cos\Big(\frac{(n-1)\pi}{4}\Big)\,y+2^{(n+2)/2}\sin\Big(\frac{n\pi}{4}\Big)\,y'
$$
