# Integrating $d\psi=(x+y)dx +x_0dy$

Tags:
1. Sep 30, 2014

### cr7einstein

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 (pg 333), 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?

I would like to stress that it is NOT my objective to SOLVE the equation, but to get my concept of integrating different variables wrt to each other clear. In brief, I want to know how to integrate expressions such as (x+y) and xy wrt to x(or y). And I am not talking about double integrals here. If you don't have y=f(x) as an expansion, i.e. x and y are mere variables when integrated wrt each other, how to integrate the expression is my query. Also, from the book it seems that they have taken $$\int(x+y) dx = \int x dx + \int y dx$$,i.e "distributed the integrand". How can you do that, since the integral is only once, how can you make 2 integrals out of it? In short, does integration have some sort of distributive rule and each term of the expression in brackets integrated separately wrt the variable in question(dx in this case)? If so, then WHY? or am I missing something? Please elaborate.

2. Sep 30, 2014

### Staff: Mentor

You don't. This would be reasonable if x and y were independent of each other. However, this isn't the case here, as we assume that y is a function of x.
Because x0 is a constant. One of the basic properties of definite integrals is that the integral of a constant times a function is the constant times the integral of the function. Also, the integral of the sum of two functions is the sum of the integrals of the functions. These properties follow from the linearity of the definite integral.
This is a legitimate step, but the problem is that you can't do the second integral. That integral needs to be performed with respect to x, but you can't replace y with its equivalent form in terms of x.
I didn't check all of your work in detail to verify that the DE you have is exact. For this equation, a simpler approach is to use a so-called integrating factor.

Rewrite the equation as y' + y/x = -1
It turns out that the integrating factor is $$\phi(x) = e^{\int \frac{dx}{x}} = e^{ln(x)} = x$$
Multiply both sides of the original DE by the integrating factor, resulting in xy' + y = -x, or d/dx(xy) = -x
Now integrate both sides (with respect to x) to get xy = -(1/2)x2 + C
Solve for y to get your solution as a function of x.

3. Sep 30, 2014

### HallsofIvy

Staff Emeritus
I would have done this in a slightly different format. We can write $dy/dx= -1- y/x$ as $xdy= (-x- y) dx$ or $xdy+ (x+ y)dy= 0$.

Yes, that is exact- the derivative of x with respect to x and the derivative of x+ y with respect to y are both 1. That means there exist a function F(x, y) such that $dF= F_x dx+ F_y dy= (x+ y)dx+ xdy$. We have $F_x= x+ y$ and $F_y= x$. Since the partial derivative with respect to y is done holding x constant we must have $F= xy+ \phi(x)$. Here $\phi(x)$ is the "constant of integration". Since taking the partial derivative, we treat x as a constant, the "constant of integration" may be a function of x.

Differentiating $F= xy+ \phi(x)$ with respect to x, $F_x= y+ \phi'(x)$. But we already have $F_x= x+ y$ so $y+ \phi'(x)= x+ y$ which gives $\phi'(x)= x$ and so $\phi(x)= x^2/2+ C$

$F(x, y)= xy+ x^2/2+ C$. dF= 0 means that F is a constant- $F(x, y)= xy+ x^2/2+ C= C'$. Combining the two constants, $xy+ x^2/2= C$.

Last edited: Oct 2, 2014
4. Oct 2, 2014

### cr7einstein

@Mark44, That is not my question. I know I can solve it using other methods. My question is about the reason of doing the integrals in the way done in the book. For instance, I asked why is $$x_0$$ a constant, because that's what taking it outside the integral implies(which is what they have done in the book). As for $$\int y dx$$, they have equated it to yx, which means y is a constant wrt x...But how?? I don't mean to say why do you take the constant outside the integral, I meant WHY is the thing a constant, because that is what the next step ($$\int x_0 dy= x_0y$$, and $$\int(x+y)dx = x^2/2 + xy$$ - This is the thing done in the textbook, I don't understand how) implies. So the thing in brackets is my question really. Thanks again!!

5. Oct 2, 2014

### HallsofIvy

Staff Emeritus
Any integral "dy" treats all other independent variables as constants. Any integral "dx" treats all other independent variables as constants. It is just the "reverse" of partial differentiation.

6. Oct 3, 2014

### cr7einstein

But the thing is, there is no specified dependence/independence of variables here....Or is it assumed so?

7. Oct 3, 2014

### Staff: Mentor

The variables are assumed to be independent here.

8. Oct 4, 2014

### cr7einstein

Ok, Thanks a lot!!!

9. Oct 6, 2014

### cr7einstein

But @Mark44, here, y is a function of x ( we have a y'), so $$\int y dx$$ cannot be evaluated unless you know what y exactly is, right? How can you then assume it to be independent when integrating wrt dx? Sorry for restarting this, but I still don't get it...

10. Oct 6, 2014

### HallsofIvy

Staff Emeritus
If y is a function of x, then, no, you cannot integrate it with respect to x. But if you know that was from a partial derivative with respect to x, then y is being treated as a constant so the anti-derivative, under those circumstances would be $xy+ f(y)$ where f(y) can be any function of y.