${\frac {d^2y}{dx^2}}+{\frac {dy}{dx}} = x^2$
I'm not sure how to solve it, in textbook solution for this problem is
$y = \frac13x^3 - x^2 + 2x +c_1+c_2e^{-x}$
${\frac {d^2y}{dx^2}}+{\frac {dy}{dx}} = x^2$
I'm not sure how to solve it, in textbook solution for this problem is
$y = \frac13x^3 - x^2 + 2x +c_1+c_2e^{-x}$
A simpler solution would be $v=y'$ and then it becomes $v'+v=x^2$ which has an integrating factor of $e^x$ which makes it $\left (ve^x\right )'=x^2e^x$ and integrating both sides $ve^x=e^x(x^2-2x+2)+C_1$ and then we get $v=y'=x^2-2x+2+C_1e^{-x}$ $$\boxed{y=\frac{1}{3}x^3-x^2+2x+C_1e^{-x}+C_2}$$ I didn't really understand the whole kernel thing from the previous answer. I apologize to the severe incorrectness of my last answer.
I want to show you the 'classical' method to solve these inhomogeneous linear ODEs of second order.
$$y''(x)+y'(x) = x^2$$
We solve this ODE with the ansatz $y(x)=y_h(x)+y_p(x)$ where $y_h$ denotes the solution to the corresponding homogeneous problem and $y_p$ is some particular solution to this ODE.
Firstly let's look at the homogenous problem $y''(x)+y'(x)=0$. We look for an exponential solution i.e. let's set $y=c e^{\lambda x}$ for some constant $c$. We get the so called characteristic equation
$$\lambda^2+\lambda=\lambda(\lambda+1)=0$$
i.e. $\lambda \in \{-1,0 \}$. Therefore we have $y_h(x)=c_1+c_2 e^{-x}$ where $c_1,c_2$ are some constants.
Now for the particular solution. It is quite nice that the inhomogeneous right hand side is a polynomial of second order - corresponding to this let's set $y_p$ as a polynomial, in particular $y_p(x):=a_0+a_1 x+ a_2x^2+a_3x^3.$ Now, plugging this into the ODE we get
$$\begin{align}(2a_2+6a_3x)+(a_1+2a_2x+3a_3x^2)&=x^2 \\ \Leftrightarrow x^0(a_1+2a_2)+x^1(2a_2+6a_3)+x^2(3a_3)&=x^0 \cdot 0 + x^1 \cdot 0 +x^2 \cdot 1\end{align}$$
Therefore we have to solve the linear equation system
$$\begin{cases} a_1+2a_2 &= 0 \\ 2a_2+6a_3 &=0 \\ 3a_3&=1\end{cases}$$
and that means $a_3=\frac13, a_2=-1, a_1=2$. Further $a_0$ is arbitrary, so let's just set $a_0=0$ since we just look for one particular solution. We get finally $y_p(x)=\frac13 x^3-x^2+2x.$
All in all we have
$$y(x)=y_h(x)+y_p(x)=c_1+c_2 e^{-x}+\frac13 x^3-x^2+2x$$
Integrate once to get $$\frac{dy}{dx} + y = \frac{1}{3}x^3 + c_1.$$ Formally this is $$(D+I)y = \frac{1}{3}x^3 + c_1$$ with the derivative $D$. Since $(I+D)(I - D + D^2 - D^3) = I - D^4$ acts as $I$ on polynomials of degree $3$ it follows that \begin{align*} y &= (I-D+D^2-D^3) \Big( \frac{1}{3}x^3 + c_1 \Big) + \mathrm{Ker}(D+I) \\ &= \frac{1}{3}x^3 - x^2 + 2x - 2 + c_1 + \mathrm{Ker}(D+I) \\ &= \frac{1}{3}x^3 - x^2 + 2x + c_1 + c_2 e^{-x} \end{align*} since the kernel of $D+I$ is $\{f: f' + f = 0\} = \{c_2 e^{-x}: \, c_2 \in \mathbb{R}\}.$