I need to solve the following first order linear partial differential equation: $$\frac{\partial u}{\partial x}+xy \frac{\partial u}{\partial y}=x^2$$ I could solve solve the homogeneous equation $$\frac{\partial u}{\partial x}+xy \frac{\partial u}{\partial y}=0$$ by setting $u(x,y)=f(x)g(y)$: $$f(x)'g(y)+xyf(x)g'(y)=0$$ After separation, we get 2 simple differential equation. Solving them, we get that the solution for $f$ and $g$ are $$f(x)=k_1\exp\left(\frac{cx^2}{2}\right)$$ and $$g(y)=k_2y^{-c}$$ so $$u(x,y)=k\exp\left(\frac{cx^2}{2}\right)y^{-c}$$ So the general solution to the homogeneous part is $$u(x,y)=c_1\exp\left(\frac{c_2x^2}{2}\right)y^{-c_2}+c_3$$
Q: How can I find the general solution to the original equation?
$$\frac{\partial u}{\partial x}+xy \frac{\partial u}{\partial y}=x^2$$ System of characteristic ODEs : $$\frac{dx}{1}=\frac{dy}{xy}=\frac{du}{x^2}$$ First characteristics, from $\quad\frac{dx}{1}=\frac{dy}{xy}$ : $$ye^{-\frac12 x^2}=c_1$$ Second characteristics, from $\quad\frac{dx}{1}=\frac{du}{x^2}$ : $$u-\frac13 x^3=c_2$$ General solution : $\quad u-\frac13 x^3=F\left(ye^{-\frac12 x^2}\right)\quad$ where $F$ is an arbitrary function. $$u(x,y)=\frac13 x^3+F\left(ye^{-\frac12 x^2}\right)$$ The function $F$ has to be determined according to some boundary conditions (Which are not specified in the wording of the question).