Is my solution of the following differential equation wrong? I had to solve the following differential equation:
$(x^2+y)\mathrm{d}x - x \mathrm{d}y=0$.
The equation is not exact and so I solved it as a simple linear equation
$$ \frac{\mathrm{d}y}{\mathrm{d}x}-\frac{y}{x}=x$$
The solution I got is $\frac{y}{x}=x+c$. However, the solution in the textbook is $-\frac{y}{x}+x=c$. I tried solve it again and again, and yet could not find where I'm wrong. Or is the solution in the book incorrect?
 A: You are both correct.
The value of c depends on the initial conditions.
Your c will be the negative of the book's c.
A: Transform your equation with a group $x'=\lambda x$ and $y'=\lambda^\beta y$.  Note that $dx'=\lambda dx$ and $dy'=\lambda^\beta dy$.
$$
\frac{\lambda^\beta dy}{\lambda dx}-\frac{\lambda^\beta y}{\lambda x}=\lambda x
$$For your ODE to be invariant to the group, $\beta -1=1$ or $\beta =2$.  Two stabilizers for this group are 
$$
\mu=\frac{y}{x^\beta}=\frac{y}{x^2}
$$and
$$
\nu=\frac{\dot{y}}{x^{\beta -1}}=\frac{\dot{y}}{x}
$$where $\dot{y}=\frac{dy}{dx}$.  Now your ODE can be written in terms of the group stabilizers:
$$
\frac{\dot{y}}{x}-\frac{y}{x^2}=1 \rightarrow \nu-\mu=1 \rightarrow \nu=1+\mu
$$Noting that
$$
x\frac{d\mu}{dx}=\nu-\beta \mu=1+\mu-2\mu=1-\mu
$$we can separate and solve this equation:
$$
\frac{d\mu}{1-\mu}=\frac{dx}{x}\rightarrow -ln(1-\mu)=lnx-lnC
$$
$$
\frac{C}{x}=1-\mu=1-\frac{y}{x^2}\rightarrow Cx=x^2-y
$$Thus your answer is equalivent to the one in the textbook:
$$
y=x^2-Cx
$$Of course, since C is a constant it can absorb the negative sign and still work as a solution: $y=x^2+C$.  
