Non exact differential equation problem 
$$x\frac{dy}{dx}=x^2 +y$$  

given that $\\ y\left( 1 \right) =0$
When i got partial derivatives of both sides, found it's not an exact equation..please can anybody can give a clue to solve this..
 A: $$x\frac { dy }{ dx } =x^{ 2 }+y\\ xdy-ydx={ x }^{ 2 }dx\\ \frac { xdy-ydx }{ { x }^{ 2 } } =dx\\ \\ d\left( \frac { y }{ x }  \right) =dx\\ \frac { y }{ x } =x+C\\ y=x\left( x+C \right) \\ $$ and since $y(1)=0$ we get from that $$y\left( x \right) =x\left( x+C \right) \\ y\left( 1 \right) =0\\ 1+C=0\\ C=-1$$
finally

$$y\left( x \right) =x\left( x-1 \right) ={ x }^{ 2 }-x$$

A: The standard way of solving this type of equation would be to notice it is a linear differential equation:
$$\frac{dy}{dx}-\frac{1}{x}\cdot y=x$$
So, the integrating factor here is $e^{\int -\frac{1}{x} dx} = \frac{1}{x}$, and we can write 
$$\frac{1}{x}\frac{dy}{dx}-\frac{1}{x^2}y=1$$
$$\frac{d}{dx}\left(\frac{y}{x}\right)=1$$
$$\frac{y}{x}=x+c$$
$$y=x^2+c x$$
Finally, applying the initial condition gives
$$y=x^2- x$$
A: Two good methods of solution have been given. Here is a third using an integration factor.
Since the initial equation is not exact we can check to see whether either


*

*$\dfrac{\dfrac{\partial M}{\partial y}-\dfrac{\partial N}{\partial x}}{N}$ is a function of $x$ alone or whether 

*$-\dfrac{\dfrac{\partial M}{\partial y}-\dfrac{\partial N}{\partial x}}{M}$ is a function of $y$ alone
In this case we see that $\dfrac{\dfrac{\partial M}{\partial y}-\dfrac{\partial N}{\partial x}}{N}=-\dfrac{2}{x}$
which gives an integrating factor of $\mu=\int e^{-2/x}dx=x^{-2}$.
Applying the integrating factor yields the exact equation
$$ \left(1+x^{-2}y\right)\,dx-x^{-1}dy=0 $$
which can then easily be integrated yielding $y=x^2-x$.
A: Consider it as a linear equation in $y$
\begin{eqnarray*}
x\frac{dy}{dx}-y= x^2
\end{eqnarray*}
First solve
\begin{eqnarray*}
x\frac{dy}{dx}-y= 0
\end{eqnarray*}
Assume the solution $y=x^{\lambda}$ ... $\lambda=1$ and we have the general solution $y=Ax$.
Now for the particular solution assume the form $y=Bx^2$ substitute this back into the original eqation and we have $B=1$. Now put in the initial condtion & $\color{red}{y=x^2-x}$.
A: $x\frac{dy}{dx}-y=x^2$. Divide both sides by $x$ to get $y'-\frac{y}{x}=x$, the integrating factor is $e^{\int-\frac{1}{x}\,\mathrm{d}x}=\frac{1}{x}$. Our differential equation then becomes $\left(\frac{y}{x}\right)'=1\implies\frac{y}{x}=x+C\implies\boxed{y=x^2+Cx}$ solving for the constant gives us $C=-1$
