Integrating $d\psi=(x+y)dx +x_0dy$ I am quite embarrassed to ask this question, as I know i have lost track of the concept here, but Ill nevertheless ask it. I was going through Mathematical methods for physicists, and there was an example:
"Solve $y'+(1+\frac{y}{x}) = 0$"
My problem is,
(a) when you put the equation into the general form of an exact equation, and get:
$\psi = \int^{x}_{x_0} (x+y)dx + \int^{y}_{y_0} x_0dy$,
$\psi   = \frac{x^2}{2} + xy + C$ ,
Why do you treat y and x as constant wrt to each other when integrating?
More specifically, why is $\int^{y}_{y_0} x_0dy = x_0 \int^{y}_{y_0} dy$, and the same thing with y in the first integral? There is no explicit assumption of dependence of x on y and vice versa, So I'm guessing it is because P and Q of the exact solution are  functions of 2 variables, but you integrate only wrt one.
(b) Why are the rest of the terms($-x_0^2/2 , x_0y_0)$, of the integral constant?
This question might get me downvotes, but please bear with me. Thanks in advance!!
 A: So we have the inhomogeneous linear ODE
$$y'+{y\over x}=-1\ .\tag{1}$$
Forget about "exact form" or "integrating factors", and use the standard method! The associated homogeneous equation
$$y'+{y\over x}=0\tag{2}$$
is of Eulerian type and has solutions of the form $y(x)=x^\alpha$. Entering this "Ansatz" into $(2)$ produces the condition $\alpha=-1$. It follows that the general solution of $(2)$ is
$$y(x)={C\over x},\qquad C\in{\mathbb R}\ .$$
In order to tackle the inhomogeneous equation $(1)$ we use the method of "variation of the constant". This means that we enter the new "Ansatz" $$y(x)={C(x)\over x}$$
into $(1)$ and obtain the following ODE for the new unknown function $x\mapsto C(x)$:
$${C'\>x-C\over x^2}+{C\over x^2}=-1\ ,$$
or $C'(x)=-x$. It follows that $$C(x)=-{x^2\over2}+C_1,$$ so that we obtain as general solution of $(1)$ the family of functions
$$y(x)=-{x\over2}+{C_1\over x},\qquad C_1\in{\mathbb R}\ .$$
A: I can show you what all that fuss about. When you write a differential equation into the general form of an exact equation:
$$P(x,y)dx+Q(x,y)dy=0$$
There has to be a total differential $\psi=f(x,y)$ which satisfies:
$$P(x,y)=\frac{\partial f(x,y)}{\partial x}\;\;and\;\; Q(x,y)=\frac{\partial f(x,y)}{\partial y}
 $$
Therefore,
$$d\psi=P(x,y)dx+Q(x,y)dy=0$$
and the solution is:
$$\int d\psi=c\;\Longrightarrow \psi=f(x,y)=c$$
Now, how do we find this solution? Remember that:
$$\frac{\partial}{\partial x}\left(\frac{\partial f(x,y)}{\partial y}\right)=\frac{\partial}{\partial y}\left(\frac{\partial f(x,y)}{\partial x}\right)
 $$
$$\frac{\partial}{\partial x}(Q(x,y))=\frac{\partial}{\partial y}(P(x,y))$$
We will use this result later. Let's return to the solution:
$$\frac{\partial f(x,y)}{\partial x}dx=P(x,y)dx$$
$$f(x,y)=\int_{x_{0}}^{x}P(x,y)dx+R(y)$$
Here, we are integrating through $dx$ and we will integrate $dy$ seperately. Thus $y$ is constant and $R(y)$ represents the arbitrary constant. We have to find $R(y)$.
$$\frac{\partial f(x,y)}{\partial y}=Q(x,y)=\int_{x_{0}}^{x}\frac{\partial P(x,y)}{\partial y}dx+R^{\prime}(y)$$
Now we use our previous solution:
$$Q(x,y)=\int_{x_{0}}^{x}\frac{\partial Q(x,y)}{\partial x}dx+R^{\prime}(y)
 $$
$$Q(x,y)=Q(x,y)-Q(x_{0},y)+R^{\prime}(y)$$
$$R(y)=\int_{y_{0}}^{y}Q(x_{0},y)dy$$
Then you find f(x,y) as:
$$f(x,y)=\int_{x_{0}}^{x}P(x,y)dx+\int_{y_{0}}^{y}Q(x_{0},y)dy=c$$
You can take $x_0=0$ and $y_0=0$. You can find other details like integrability in Tenenbaum's ODE book.
In your case, the exact form of the differential is as follows:
$$(x+y)dx+xdy=0$$
Therefore, the solution is:
$$\int_0^x(x+y)dx+\int_0^y0dy=c\:\Longrightarrow\:\frac{x^2}{2}+xy=c$$
A: You can also solve this by noting that this is a first order linear ODE. To solve this, we first rewrite the equation in the form $$y' + \left(\frac{1}{x}\right) y = -1$$ It's nice to solve differential equations for $y$ by integrating an expression that involves $y'$, so let's multiply both sides of our equation by a mystery function $f(x)$ that is called an integrating factor. We now have $$fy' + \left(\frac{1}{x} \right)f y = - f$$ By the product rule, we have that $(fy)' = fy' + f'y$, and accordingly, $fy' = (fy)' -f'y$, so we now can say that $$(fy)' -  f'y +  \left( \frac{1}{x} \right) f y  = -f \Longrightarrow (fy)' - \left( f' - \frac{1}{x}f \right) y = - f \tag{1}  $$
Now, if only this mystery function $f$ satisfied the equation $f' - \left(\frac{1}{x} \right) f = 0$, then we would just have $(fy)'$ on the lefthand side, and we could find $y$ by integrating both sides with respect to $x$. Well, we can find the function $f$ that achieves this. We now solve the separable differential equation $$f' - \left(\frac{1}{x} \right) f = 0 \Longrightarrow \frac{f'}{f} = \frac{1}{x} \Longrightarrow \log(f) = \log{x} + \log{c} \Longrightarrow f = cx  $$ Note that we can let $c=1$ because we just need to find one function $f$ that satisfies $f' - \left(\frac{1}{x} \right) f = 0$, so let's say $f = x$. Plugging $f = x$ into $(1)$ gives us $$(xy)' - \left((x)' - \left(\frac{1}{x}\right) x\right)y = - x \Longrightarrow (xy)' - (1-1)y = -x \Longrightarrow (fy)' = -x \tag{2}$$
Now, integrating both sides of $(2)$ gives 
$$xy = -\frac{1}{2} x^2 + c \Longrightarrow \boxed{y = \displaystyle\frac{-x}{2} + \displaystyle\frac{c}{x}}$$
I hope this helped as an illustration of how to solve first order linear ODEs.
