How to solve $y''' - y = 2\sin(x)$

$$y''' - y = 2\sin(x)$$

I'm doing differential equations and know pretty much all methods of solving them, but I haven't come across anything of a higher order than second yet.

How do I go about solving this?


Instead of solving the given differential equation, I'll teach you how to fish.

Given $n\in \mathbb N$, given $a_0, \ldots ,a_n, \alpha, \beta\in \mathbb R$ and given the ODE $$a_ny^{(n)}+a_{n-1}y^{(n-1)}+\ldots + a_0y=f \tag{ODE}$$

if $\forall x\in \mathbb R\left(f(x)=P(x)e^{\alpha x}\cos(\beta x)+Q(x)e^{\alpha x}\sin(\beta x)\right)$, for some polynomials $P$ and $Q$, then a particular solution $y_p$ of $\text{ODE}$ is determined by $$\forall x\in \mathbb R\left[y_p(x)=x^k\left(R(x)e^{\alpha x}\cos(\beta x)+S(x)e^{\alpha x}\sin(\beta x)\right)\right],$$ where $R,S$ are polynomials such that $\deg\left(R\right)=\deg\left(S\right)=\max\left(\deg\left(P\right), \deg\left(Q\right)\right)$ and $k$ is the multiplicity of $\alpha +\beta i$ as a root of the characteristic polynomial of the homogeneous equation associated with $\text{ODE}$ ($a_n\lambda ^n+\ldots +a_1\lambda + a_0$), with the convention that $k=0$ if $\alpha +\beta i$ isn't a root of the polynomial.

Adding your favorite solution $y_h$ of the homogeneous equation, yields the family of solutions $y_h+y_p$.

Example: Consider the differential equation determined by $$y''(x)-y'(x)+9y(x)=3\sin(3x)\tag{EX}$$

In the notation above $n=2, a_2=1, a_1=-1, a_0=9, \alpha=0, \beta=3, P(x)=0, Q(x)=3, f(x)=3\sin(3x)$ and $k=0$ (since $3i$ is not a root of $\lambda ^2-\lambda +9$).

So a particular solution to $\text{EX}$ is determined by $$y_p(x)=x^0\left[R(x)\cos(3x)+S(x)\sin(3x)\right] \tag{PS}$$ where $R$ and $S$ are polynomials whose degree is $0$, that is, they are constants, so for some $A,B\in \mathbb R$, $\text{PS}$ is equivalent to $$y_p(x)=A\cos(3x)+B\sin(3x).$$

Now replace the expression on the RHS of the above formula in $\text{EX}$.

One has $$y'_p(x)=-3A\sin(3x)+3B\cos(3x),$$ $$y''_p(x)=-9A\cos(3x)-9B\sin(3x).$$

Therefore, substituting in the equation and rearranging yields $$(-9A-3B+9A)\cos(3x)+(-9B+3A+9B)\sin(3x)=3\sin(3x).$$

Since $\{\cos , \sin\}$ is a linearly indepedent set over $\mathbb R$, it follows that $-3B=0$ and $3A=3$, yielding $y_p(x)=\cos(x)$.


Solving the homogeneous equation $$ y'''-y=0 $$ should pose no problem: the roots of the characteristic polynomial $X^3-X$ are $0$, $-1$ and $1$. For a particular solution, consider that the derivative of a function of the form $$ g(x)=a\cos x+b\sin x $$ is a function of the same form.