How to solve $y''+y=x^2$? I need to solve:
$$y''+y=x^2$$
Taking the Laplace transform  (and using the fact that it is a linear operator) on both sides I get:
$$\mathscr{L}(y)=\frac{2}{s^3(s^2+1)}+y(0)\frac{s}{s^2+1}+y'(0)\frac{1}{s^2+1}$$
And hence:
$$y=2G(x)+y(0)\cos x +y'(0)\sin x$$
Where $G(x)$ is the inverse Laplace transform of:
$$\frac{1}{s^3(s^2+1)}$$
My question is how do I find this inverse Laplace transform, I'm used to splitting the fraction into partial fractions but I don't think I'm used to doing a partial fraction like in the above.
 A: As for the Laplace solution you asked for, you can split the fraction like this:
$$\frac 1{s^3(s^2+2)}=\frac As+\frac B{s^2}+\frac C{s^3}+\frac{Ds+E}{s^2+1}$$
$$=\frac{As^4+As^2+Bs^3+Bs+Cs^2+2C+Ds^4+Es^3}{s^3(s^2+1)}$$
$$=\frac{(A+D)s^4+(B+E)s^3+(A+C)s^2+Bs+C}{s^3(s^2+1)}$$
By identification, you find $B=0,E=0,C=1,A=-1,D=1$
A: Oh, I hate the Laplace transform!  I have yet to find a differential equation that cannot be solved more easily using simpler methods.  Here, the differential equation is $y''+ y= x^2$.  The associated homogeneous equation is $y''+ y= 0$.  Its characteristic equation is $r^2+ 1= 0$ which has roots $r= \pm i$ so the general solution to the associated homogeneous equation is $C_1cos(x)+ C_2sin(x)$.  The right hand side, $x^2$, is one of the kinds of functions we would expect as a solution to such an equation so we use "undetermined coefficients"- try $y= Ax^2+ Bx+ C$ for constants A, B, C to be determined.  Then $y'= 2Ax+ B$ and $y''= 2A$.  $y''+ y= 2A+ Ax^2+ Bx+ C= Ax^2+ Bx+ 2A+ C= x^2$.  Two polynomials will be equal for all x if and only if "corresponding coefficients" are equal- we must have $A= 1$, $B= 0$, and $2A+ C= 0$.  So A= 1, B= 0, and C= -2.  The general solution to this differential equation is $y(x)= C_1cos(x)+ C_2sin(x)+ x^2- 2$.
A: $\newcommand{\angles}[1]{\left\langle\,{#1}\,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

$\ds{{1 \over s^{3}\pars{s^{2} + 1}} :\ ?}$



*

*For the $\ds{\color{#f00}{\mbox{pole at}\ s = 0}}$, the residue is given by
\begin{align}
{1 \over 2!}\,\lim_{s \to 0}\,\totald[2]{}{s}\bracks{%
{s^{3} \over s^{3}\pars{s^{2} + 1}}\,\expo{st}} & =
{1 \over 2}\,\lim_{s \to 0}\,\totald[2]{}{s}\bracks{%
{\pars{1 - s^{2}}\pars{1 + st + \half\,s^{2}t^{2}}}}
\\[4mm] & =
\color{#f00}{-1 + \half\,t^{2}}
\end{align}

*For the $\ds{\color{#f00}{\mbox{poles at}\ s = \pm\ic}}$, the residue is given by
\begin{align}
\left.\pars{s \pm \ic}{\expo{st} \over s^{3}\pars{s - \ic}\pars{s + \ic}}
\right\vert_{\ s\ \to\ \pm\ic} & =
{\expo{\pm\ic t} \over \pm\ic\pars{\mp\ic\ \mp\ \ic}} =
\color{#f00}{\half\,\expo{\pm\ic t}}
\end{align}


The final result becomes:
  $$
\pars{-1 + \half\,t^{2}} + \pars{\half\,\expo{\ic t}} + \pars{\half\,\expo{-\ic t}}
=
\color{#f00}{-1 + \half\,t^{2} + \cos\pars{t}}
$$

A: 
My question is how do I find this inverse Laplace transform of $\dfrac{1}{s^3(s^2+1)}$?

Hint. If one wants to proceed on your route, by a partial fraction decomposition, one has
$$
\frac{1}{s^3(s^2+1)}=-\frac{1}{s}+\frac{1}{s^3}+\frac{s}{1+s^2}
$$ giving
$$
\mathcal{L}^{-1}\left(\frac{1}{s^3(s^2+1)}\right)(t)=-1+\frac{t^2}2+\cos t
$$ using standard properties of the inverse Laplace transform.
