In the "Integrating Factors" section of an old introductory differential equations book, this example problem is presented: $$\frac{x \ dy-y \ dx}{x^2}=xy \ (x \ dy+y \ dx)$$ $$d \left( \frac{y}{x}\right)=xy \ d(xy) \quad (*)$$ The book then simply says, "Integrate," and shows the answer: $\frac{y}{x}=\frac{1}{2} \ x^2y^2+k$.
I'm puzzled by the right side of equation (*) though. Integrating it would produce an integral of the form $\int xy \ d(xy)$, which is new to me. I'm familiar with differentials and iterated integrals, but I've never seen an integral with two variables simultaneously in a $d( \ )$ expression with variables preceding the $d( \ )$.
The left-hand side of (*) is easy: an integral of a differentiated function is simply the function itself (plus a constant).
But for the right side, can I just treat $(xy)$ as some sort of unit and integrate, since it's followed by $d(xy)$? $$\int xy \ d(xy)= \frac{1}{2}(xy)^2=\frac{1}{2}x^2y^2$$ That just seems too simplistic, especially since two variables are being multiplied together. I'd expect it to require something akin to integration by parts.
Yet, if I do the following (which seems more legitimate), I get a wrong answer for the right-hand side: $$\int xy \ d(xy)= \int xy \ (x \ dy+y \ dx) = \int (x^2y \ dy \ + \ xy^2dx)$$ $$=x^2\frac{y^2}{2}+y^2\frac{x^2}{2}=\frac{2x^2y^2}{2}=x^2y^2 \ + \ k$$ I don't think the discrepancy can be resolved simply by saying the constants are different. Where am I going wrong?