<s>[INST] Solving a non-exact differential I started off solving the differential equation $$(xy^2 + 3e^{x-3})dx - x^2ydy = 0$$
 It's a non-exact first order equation whose integrating factor is $1/x^4$.
Finally I got to the equation where I needed to integrate $$\frac{e^{x-3}}{x^4} dx$$ But I can't seem to proceed.
Is there any other way to solve this.
 [/INST] First, we rearrange the given equation (which is a Bernoulli equation):
$$
x^2y'y - xy^2 = 3e^{x-3} \Rightarrow 2y'y - \frac{2y^2}{x} = \frac{6e^{x-3}}{x^2}.
$$
Notice that we can simplify this result by letting $z(x) := y^2(x)$:
$$
z' - \frac{2z}{x} = \frac{6e^{x-3}}{x^2}.\tag{1}\label{eq:z}
$$
Let $\mu(x) := e^{\int -2/x\mathrm{d}x} = 1/x^2$ the integrating factor of \eqref{eq:z}. Multiplying both sides of this equation by $\mu(x)$,
$$
\frac{z'}{x^2} - \frac{2z}{x^3} = \frac{z'}{x^2} - z\frac{\mathrm{d}\phantom{x}}{\mathrm{d}x}\left(\frac{1}{x^2}\right) = \frac{\mathrm{d}\phantom{x}}{\mathrm{d}x}\left(\frac{z}{x^2}\right) = \frac{6e^{x-3}}{x^4}.
$$
Integrating both sides by $x$,
$$
\frac{z}{x^2} = \int \frac{6e^{x-3}}{x^4} \mathrm{d}x = \frac{\mathrm{Ei}(x)}{e^3} -\frac{e^{x-3}(x^2+x+2)}{x^3} + c_1,
$$
so
$$
z(x) = \frac{x^2\mathrm{Ei}(x)}{e^3} -\frac{e^{x-3}(x^2+x+2)}{x} + c_1x^2 \Rightarrow \boxed{y(x) = \pm \sqrt{\frac{x^2\mathrm{Ei}(x)}{e^3} -\frac{e^{x-3}(x^2+x+2)}{x} + c_1x^2}.} 
$$
Here is a plot of the solution setting $10 \le z(1) \le 200$ for fixing a value of $c_1$.

</s>