Solve the initial value problem for $y''(t)+y(t)=\sin t$ 

$$
\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$$
 A: $$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$.
A: As posted in the comments, you can find the particular solution with
variation of parameters. On Wikipedia there is also done an example in a similar case. 
Here, we want to look for the particular solution of the ODE $y''(t)+y(t)=\sin(t)$. You already derived the correct complementary solution $y_h(t)=A \cos(t)+B \sin(t)$. That means it is composed of the basis functions $u_1(t):=\cos(t)$ and $u_2(t):=\sin(t)$. The Wronskian is
$$W(t)=\begin{vmatrix} u_1(t) & u_2(t) \\ u_1'(t) & u_2'(t) \end{vmatrix}=\dots=1.$$
We denote by $f$ the right-hand side of the ODE and we compute the indefinite integrals 
\begin{align}a(t) &=-\int \frac{f(t) u_1(t)}{W(t)} ~\text{d}t=\dots=-\tfrac12 t+\tfrac14 \sin(2t), \\
b(t)&=\int \frac{f(t) u_2(t)}{W(t)} ~\text{d}t=\dots=-\tfrac12 \cos^2(t),\end{align} 
yielding the particular solution
$$y_p(t)=a(t) u_1(t)+b(t)u_2(t) = \dots =-\tfrac12  t \cos(t).$$
