$$ \begin{cases} y''(t) + y(t) = \sin t \\[5pt] y(0) = 0, \quad y'(0) = 0 \end{cases} $$
I understand how to get $y_h=A\cos t+B\sin t$ but I dont understand how you get $y_p= -\dfrac t2\cos t$
Attempt at solution
$$y''+y=\sin t\quad\Longrightarrow \quad y''(0)+y(c)=\sin t\quad \Longrightarrow \quad c=\sin t$$
$$y''+y=\sin x$$ The characteristic equation is $\lambda^2+1=0$ then the general solution is $y_g=C_1\cos x+C_2\sin x$. For special solution since $\sin x$ is a general solution then we let $y_p=x(A\sin x+B\cos x)$ and write: \begin{eqnarray*} y_p &=& Ax\sin x+Bx\cos x \\ y_p' &=& (A-Bx)\sin x+(Ax+B)\cos x \\ y_p'' &=& (-Ax-2B)\sin x+(2A-Bx)\cos x \\ y_p''+y_p &=& -2B\sin x+2A\cos x \\ &=& \sin x \end{eqnarray*} then $B=-\dfrac12$ and $A=0$.