Laplace-transforming both sides of $y'' + y = 2t$,
$$s^2 Y (s) - y_0 s - v_0 + Y (s) = \frac{2}{s^2}$$
Hence,
$$Y (s) = y_0 \left(\frac{s}{s^2 + 1}\right) + (v_0 - 2)\left(\frac{1}{s^2 + 1}\right) + \frac{2}{s^2}$$
Taking the inverse Laplace transform,
$$y (t) = y_0 \cos (t) + (v_0 - 2) \sin (t) + 2 t$$
From the conditions $y(\pi /4) = \pi / 2 $ and $y'(\pi /4) = 2- \sqrt{2}$, we get
$$y_0 + v_0 = 2 \qquad \qquad \qquad y_0 - v_0 = 2$$
Thus, $y_0 = 2$ and $v_0 = 0$, and
$$y (t) = 2 \cos (t) - 2 \sin (t) + 2 t$$
Well, we have that:
$$\text{y}''\left(t\right)+9\cdot\text{y}\left(t\right)=\cos\left(t\right)\tag1$$
Now, when we take the Laplace transform of both sides we get:
$$\mathscr{L}_t\left[\text{y}''\left(t\right)+9\cdot\text{y}\left(t\right)\right]_{\left(\text{s}\right)}=\mathscr{L}_t\left[\text{y}''\left(t\right)\right]_{\left(\text{s}\right)}+9\cdot\mathscr{L}_t\left[\text{y}\left(t\right)\right]_{\left(\text{s}\right)}=\mathscr{L}_t\left[\cos\left(t\right)\right]_{\left(\text{s}\right)}\tag2$$
Use that:
- $$\mathscr{L}_t\left[\text{y}''\left(t\right)\right]_{\left(\text{s}\right)}=\text{s}^2\cdot\text{Y}\left(\text{s}\right)-\text{s}\cdot\text{y}\left(0\right)-\text{y}'\left(0\right)\tag3$$
- $$\mathscr{L}_t\left[\text{y}\left(t\right)\right]_{\left(\text{s}\right)}=\text{Y}\left(\text{s}\right)\tag4$$
- $$\mathscr{L}_t\left[\cos\left(t\right)\right]_{\left(\text{s}\right)}=\frac{\text{s}}{1+\text{s}^2}\tag5$$
So, we get:
$$\text{s}^2\cdot\text{Y}\left(\text{s}\right)-\text{s}\cdot\text{y}\left(0\right)-\text{y}'\left(0\right)+9\cdot\text{Y}\left(\text{s}\right)=\frac{\text{s}}{1+\text{s}^2}\tag6$$
Now, using the initial condition $\text{y}\left(0\right)=1$:
$$\text{s}^2\cdot\text{Y}\left(\text{s}\right)-\text{s}\cdot1-\text{y}'\left(0\right)+9\cdot\text{Y}\left(\text{s}\right)=\text{s}^2\cdot\text{Y}\left(\text{s}\right)-\text{s}-\text{y}'\left(0\right)+9\cdot\text{Y}\left(\text{s}\right)=\frac{\text{s}}{1+\text{s}^2}\tag7$$
Now, solving $\text{Y}\left(\text{s}\right)$:
$$\text{Y}\left(\text{s}\right)=\frac{\text{y}'\left(0\right)+\text{s}^2\cdot\text{y}'\left(0\right)+\text{s}^3+2\cdot\text{s}}{\text{s}^4+10\cdot\text{s}^2+9}\tag8$$
Now, using inverse Laplace transform:
$$\text{y}\left(t\right)=\frac{\cos\left(t\right)+7\cos\left(3t\right)}{8}+\frac{\text{y}'\left(0\right)\cdot\sin\left(3t\right)}{3}\tag9$$
So, in order to solve $\text{y}'\left(0\right)$, use the second initial condition $\text{y}\left(\frac{\pi}{2}\right)=-1$:
$$-1=\frac{\cos\left(\frac{\pi}{2}\right)+7\cos\left(3\cdot\frac{\pi}{2}\right)}{8}+\frac{\text{y}'\left(0\right)\cdot\sin\left(3\cdot\frac{\pi}{2}\right)}{3}=-\frac{\text{y}'\left(0\right)}{3}\space\Longleftrightarrow\space\color{red}{\text{y}'\left(0\right)=3}\tag{10}$$
So, the complete solution is given by:
$$\text{y}\left(t\right)=\frac{\cos\left(t\right)+7\cos\left(3t\right)}{8}+\sin\left(3t\right)\tag{11}$$
Best Answer
Call $x(0)=a;\;x'(0)=b$ and $X$ the Laplace transform of $x(t)$
You get, from tables $$-a s-b+s^2 X-X=\frac{s}{s^2-1}$$ and solving wrt $X$ $$X=\frac{a s^3+bs^2+(1-a) s-b}{\left(s^2-1\right)^2}$$ Partial fractions $$\frac{P}{s+1}+\frac{Q}{(s+1)^2}+\frac{R}{s-1}+\frac{S}{(s-1)^2}=(*)\\=\frac{s^2 (-P+Q+R+S)+s (-P-2 Q-R+2 S)+s^3 (P+R)+P+Q-R+S}{(s-1)^2 (s+1)^2}$$ We get the system
$\left\{ \begin{array}{l} P+Q-R+S=-b \\ -P-2 Q-R+2 S=1-a \\ -P+Q+R+S=b \\ P+R=a \\ \end{array} \right. $
And solutions are $$P= \frac{a-b}{2},Q= -\frac{1}{4},R= \frac{a+b}{2},S= \frac{1}{4}$$ So $(*)$ can be written as $$\frac{a-b}{2 (s+1)}+\frac{a+b}{2 (s-1)}+\frac{1}{4 (s-1)^2}-\frac{1}{4 (s+1)^2}$$ and looking back to the tables we get $$x(t)=\frac{1}{2} e^{-t} (a-b)+\frac{1}{2} e^t (a+b) +\frac{e^t t}{4}-\frac{e^{-t} t}{4} $$ and finally $$x(t)=a \cosh t+b \sinh t+\frac{1}{2} t \sinh t$$