I have an ODE:
$$\frac{dy}{dx} + 3x^{2}y = x^{2}$$ .
I got the following integrating factor:
$$e^{x^3}$$
Then I multiplied both sides, but didn't come up with the right answer. It should be:
$$y = c~e^{-x^3} + \frac{1}{3}. $$
When I come up with the following:
$$y = \left(\frac{1}{3}e^{x^3} + c\right) e^{x^3}$$
What am I doing wrong?
You have: $$ y'(x)+3x^2 y-x^2=0\tag{1} $$ The associated homogeneous equation $$ y'=-3x^2 y $$ gives you: $$ \frac{y'}{y}=-3x^2=\frac{\mathrm{d}}{\mathrm{d}x}\log(y) $$ so $$ \log (y)=-x^3, $$ and $$ y(x)=e^{-x^3}. $$ The general integral for the homogeneous equation is $$ \left\{c\,e^{-x^3},\ c\in\mathbb{R}\right\}. $$ Now I look for a particular solution $\bar{y}$ of the original equation. If I look for a constant, like $$ \bar{y}(x)=a, $$ it must be $\bar{y}'(x)=0$, hence, from $(1)$: $$ 0+3ax^2-x^2=0. $$ It follows $a=\frac{1}{3}$ and the solution: $$ y(x)=ce^{-x^3}+\frac{1}{3}, $$ for all $c\in\mathbb{R}$.