The question asks to find the solution for the initial value problem:
$ y''+\omega^2y=sin(nt),\quad y(0)=0,\quad y'(0)=0 $
where $n$ is a positive integer when a) $\omega^2\neq n^2$ and b) $\omega^2= n^2$.
I've found the non-homogeneous solution $\dfrac{sin(nt)}{\omega^2-n^2}$, but I don't know how to get to the given solution for this part which is:
$ \dfrac{-nsin(\omega t)}{\omega(\omega^2-n^2)}+\dfrac{sin(nt)}{\omega^2-n^2}. $
The given solution for the second part is:
$ \dfrac{sin(\omega t)}{2\omega^2}+\dfrac{tcos(\omega t)}{2\omega} ,$
and I'm not sure why $Y$ here is $\dfrac{tcos(\omega t)}{2\omega}$.
Thanks for any help!
If $D$ is the differentiation operator, then your equation becomes $$ (D+\omega^2)y = \sin(nt). $$ The annihilator of the right side is $(D+n^2)$. So $y$ must be a solution of $$ (D+\omega^2)(D+n^2)y = 0. $$ The general solution of this equation is $$ y(t)=A\sin(\omega t)+B\cos(\omega t)+E\cos(nt)+F\sin(nt). $$ Plugging back into the original equation gives $E=0$ and $(-n^2+\omega^2)F=1$. The constants $A$ and $B$ are determined by endpoint conditions at $t=0$: $$ y(t)=A\sin(\omega t)+B\cos(\omega t)+\frac{1}{\omega^2-n^2}\sin(nt) \\ y(0)=0 \implies B=0 \\ y'(0)=0 \implies A\omega+\frac{n}{\omega^2-n^2}=0. $$ The solution is then found to be $$ y(t)=\frac{n}{\omega(n^2-\omega^2)}\sin(\omega t)+\frac{1}{\omega^2-n^2}\sin(nt). $$
You have a typo for (b), where I assume you mean $\omega^2=n^2$. in this second case, the equation is $$ (D+\omega^2)^2y = 0. $$ The general solution of this equation is $$ y(t) = A\cos(\omega t)+B\sin(\omega t)+E t\cos(\omega t)+Ft\sin(\omega t). $$