# Solve DE by finding an integrating factor (please check my work)

## Homework Statement

Solve (x + 2) sin y dx + x cos y dy = 0 by finding an integrating factor
..............M....................N.....................

M_y (x+2)siny = (x+2)cosy

N_x xcosy = cos y

M_y not equal to N_x, therefore equation is not exact..
so far so good? thanks

Mark44
Mentor

## Homework Statement

Solve (x + 2) sin y dx + x cos y dy = 0 by finding an integrating factor
..............M....................N.....................

M_y (x+2)siny = (x+2)cosy

N_x xcosy = cos y

M_y not equal to N_x, therefore equation is not exact..
so far so good? thanks
So far, so good.

thanks.. actually i am already stuck. I do know i need an integrating factor but i dont know steps to get one. I could start by multiplying whole equation by x, but isnt this just random guessing? I also know that my goal is to make DE exact by finding correct integ factor, and then i can proceed as in other probs. so, i am at roadblock.

You can derive it by integrating something. Let's have a go.
Say
y'+fy=g
where f, g are functions of x. It's usually simple to get your DE into this form.

Now we want to multiply by something to make the LHS a 'product' derivative ie
we want to find a p such that
py'+pfy=pg
=d/dx(Py) for some P.

so suppose py'+pfy=d/dx(Py)=Py'+P'y

So we want P=p and pf=P'
ie
Pf=P'
f=(1/P)P'
=> int f dx = logP +const

The const is arbitrary (why?) and doesn't matter.

And so we can find P (exponentiate) that ends up changing the equation to
d/dx(Py)=Pg.

Summary:
Suppose the LHS can be written as d/dx(Py)
expand this
equate 'bits' and solve for P in terms of coefficients

I am familiar with getting integrating factor by putting equation in the form y' + p(t)y = g(t)
and so integrating factor is mu(x) = e^integ p(t)dt.

but i am not familiar with using an integrating factor to make an equation exact? isnt my goal to multiply the equation by some factor to make it exact right?

Once you've found your integrating factor, you can just write the line
d/dt(Py)=Pg

The whole point of an integrating factor is to make the LHS exact.

ok thank you, but i am still confused as to how to actually get the integrating factor? (to make an equation exact)??

rock.freak667
Homework Helper
ok thank you, but i am still confused as to how to actually get the integrating factor? (to make an equation exact)??
Here is something helpful to know

Given M(x,y)dx+N(x,y)dy =0 is not exact, then an integrating factor can be found as follows:

1) if (∂M/∂y - ∂N/∂x)/N = f(x) then e∫f(x) dx is an integrating factor

2) If (∂M/∂y - ∂N/∂x)/M = -g(y) then e∫g(y) dy is an integrating factor.

Last edited:
wow that is useful.

so i have
[(x+2) cos y - cos y] / xcos y = ?

simplify... (cos y's cancel)

(x+2)/x - (1/x)

= x+1/x
= 1 + 1/x

so integrating factor, mu(x) is e^integ (1+1/x)

e^x+ln|x|

simplifies to: xe^x

so my integrating factor is mu(x) = xe^x

correct so far??

thanks

rock.freak667
Homework Helper
Yes that should work.

ok thank you, but i am still confused as to how to actually get the integrating factor? (to make an equation exact)??
In your problem, we have:

$$M = (x+2)\sin y$$

$$M_y = (x+2)\cos y$$

$$N = x\cos y$$

$$N_x = \cos y$$

Clearly, we have $$M_y \neq N_x$$ and we need to multiply the equation by an integrating factor to proceed further.

The theory behind integrating factors is as follows: take your DE and multiply by an integrating factor p:

$$pMdx + pNdy = 0$$

We then proceed identically as before, that is to say, we look for a p such that:

$$\frac{\partial}{\partial y}\left(pM\right) = \frac{\partial}{\partial x}\left(pN\right)$$

$$p_y M + p M_y = p_x N + p N_x$$

The last equation is a result of the Chain Rule. Suppose that p is a function of x alone (not y), then $$p_y = 0$$, and the last equation reduces to:

$$p\left(M_y - N_x\right) = p_x N$$

$$\frac{M_y - N_x}{N}dx = \frac{dp}{p}$$

Let $$F(x) = \left(M_y - N_x\right)/N$$, and the above equation becomes:

$$F(x)dx = \frac{dp}{p}$$

$$\ln(p) = \int F(x)dx$$

$$p(x) = e ^{\int F(x)dx}$$

This has already been posted (in essence), but I thought it's useful to understand where the equations come from, and how they are derived, rather than just memorizing arcane equations by "rote", so to speak..

The integrating factor you derived should be correct for your problem.

multiply everything by integ factor, xe^x...

xe^x[ (x + 2) sin y dx + x cos y dy ] = 0
..........M..........................N

M_y = xe^x (x + 2) cos y

N_y = xe^x (x + 2) cos y

since Ive already determined the integ factor that makes equation exact, N_y must be the same as M_y, so it isnt necessary to partial differentiate N_x
Is that valid reasoning? If so i will proceed.. thanks

I am asking if that is valid, because if i come across something alot more difficult (time consuming) to differentiate, i can just note that M_y must = N_x and proceed without actually differentiating N_x,
right? thanks

multiply everything by integ factor, xe^x...

xe^x[ (x + 2) sin y dx + x cos y dy ] = 0
..........M..........................N

M_y = xe^x (x + 2) cos y

N_y = xe^x (x + 2) cos y

since Ive already determined the integ factor that makes equation exact, N_y must be the same as M_y, so it isnt necessary to partial differentiate N_x
Is that valid reasoning? If so i will proceed.. thanks
I think there might still be a slight error in your reasoning.

You do still need to calculate N_x, in order to show that the new equation is exact.

Your "new" values of M and N, and their derivatives, are as follows:

$$M = xe^x(x+2)\sin y$$

$$M_y = xe^x(x+2) \cos y$$

$$N = x^2e^x \cos y$$

$$N_x =xe^x(x+2) \cos y$$

Hence, M_y = N_x as desired, and the equation is exact (i.e., your integrating factor was correct).

However, you do still need to calculate N_x to prove this.

i now need to integrate wrt x, xe^x (x + 2) cos y

first i simplify the x's into 2 terms:

x^2e^x + 2xe^x

integrate wrt x using integ by parts on both terms

e^x(x^2 - 2x + 2) + 2xe^x -2e^x

then add the y term

[e^x(x^2 - 2x + 2) + 2xe^x -2e^x ]cos y + h(y)

then take partial derivative of above expression wrt y, and equate to N

[e^x(x^2 - 2x + 2) + 2xe^x -2e^x ](-sin y) + h'(y) = x cos y dy

cancel

-x^2e^x + h'(y) = xcosy

solve for h(y)..

h'(y) = x cos y + -x^2e^x

is this correct so far?

thanks psholtx. isnt it already proved by saying that if (∂M/∂y - ∂N/∂x)/N = f(x) then e∫f(x) dx is an integrating factor. If that is true, then wouldnt integrating N_x to show exactness be redundant?

It might be simpler to integrate N w.r.t. y... ;-)

thanks psholtx. isnt it already proved by saying that if (∂M/∂y - ∂N/∂x)/N = f(x) then e∫f(x) dx is an integrating factor. If that is true, then wouldnt integrating N_x to show exactness be redundant?
It is "proved" by that, but I find it's always best to "check" the answer by taking the derivatives one more time, just to be certain..