# Homework Help: Struggling with Differential Equations

1. Feb 15, 2010

### jasonbot

1. The problem statement, all variables and given/known data

Hi, I'm struggling with a differential equations:

y'=(1-y)cosx

2. Relevant equations

3. The attempt at a solution

y'=cosx-ycosx

p(x)=e^(∫-cosxdx)
=e^-sinx

y'e^-sinx=e^(-sinx)cosx-e^(-sinx)ycosx

then I get confused because of the derivative.

I thought it could be
y'e^(-sinx)=d/dx(e^(-sinx)y) but that clearly doesnt work...

2. Feb 15, 2010

### CompuChip

Separation of variables might be a good approach here... you can show that the solution is given by

$$\int \frac{1}{1 - y} \, dy = \int \cos(x) \, dx$$

and both of the integrals are well calculable.

3. Feb 15, 2010

### vela

Staff Emeritus
If you want to use an integrating factor, you need to move the y's to the same side.

$$y'+(\cos x)y = \cos x$$

When you multiply through by the integrating factor p(x), the LHS becomes the derivative of p(x)y(x).

$$\mbox{LHS} = p(x)y'(x)+p'(x)y(x) = [p(x)y(x)]'$$

That's where the y' term goes.

4. Feb 15, 2010

### jasonbot

Gah! My bad :( I feel quite stupid now... The exercise is on integrating factors and I didn't see that
Thanks vela for clearing up integrating factors for me :D

so to continue...

∫1/(1-y)dy=∫cosxdx

-ln(1-y)=sinx+c

1-y=Ae^(-sinx), A=e^c

-y=Ae^(-sinx)-1
y=-Ae^(-sinx)+1

which according to the solution is correct. Thanks guys! It's actually an IVP but I'll just leave that out since it's easy.

5. Feb 15, 2010

### CompuChip

Note that what you are doing now is separation of variables.
To use integrating factors, you should proceed along vela's lines.

6. Feb 15, 2010

### jasonbot

I did note that, it's just easier this way. Thanks CompuChip