# 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$$

• There are several standard methods available for this: look up "variation of parameters" or "method of undetermined coefficients" and pick your favorite. (Then there's what I think of as the "annihilator method" though I don't recall if it has an official name - the idea is to let $u = y''+y = \sin t$, observe that $0 = u'' +u = y^{(4)} + 2 y'' + y$ and then solve that.) – Daniel Schepler Oct 18 '17 at 16:59
• $$y=C_1\cos(t)+C_2\sin(t)+y_p$$ – Dr. Sonnhard Graubner Oct 18 '17 at 17:24

$$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$.

• Question why is $y_{p}=x<-$ where did this x come from? – valer Oct 18 '17 at 17:53
• I said. we let this is a method! – Nosrati Oct 18 '17 at 17:54
• @valer we know that there is $y_p$ that will give you the right answer, so we define it to be with that $x$, it is like in some questions you let $f(t)=e^{u(t)t}$ – ℋolo Oct 18 '17 at 18:12

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).$$