# differential equation solution

I have one problem in this task and please help me solve it. The problem is a first order non linear equation: $$xy \frac{dy}{dx}=1-x^2.$$ Here I have moved $y$ in one side and $x$ to the other, so I have

$$y\frac{dy}{dx}=\frac{1}{x}-x.$$

Here, I integrate both sides. On the right, I get:

$$\ln(x)-\frac{x^2}{2}+c$$

but what about left part? $\displaystyle \int y \frac{dy}{dx}$

How do I evaluate that? I have tried to take $y$ as a function of $x$, for example $y=kx$, $\frac{dy}{dx}=k$
and so $y \frac{dy}{dx}=kxk=k^2x$ ; if we integrate we get $k^2x^2/2=y^2/2$ so does it mean that $\displaystyle \int y \frac{dy}{dx} =\frac{y^2}{2}$ ?

thanks

-

Note that you integrated both sides with respect to $x$. So on the left you are evaluating $\int y{dy\over dx}\,dx$. If you substitute $u=y$ here, then $du={dy\over dx}\,dx$ and the integral becomes $\int u\,du$. Evaluating this and putting back in terms of $y$ gives ${y^2\over2}+C$.
The "shortcut" here is to first write $$y\,dy =(\textstyle{1\over x}-x)\,dx$$ and then take the antiderivative of both sides $${y^2\over2}+C= \ln|x|-{x^2\over2}+C_2.$$