Differential Equation by Separation of Variables

1. Mar 30, 2012

TranscendArcu

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

Solve the differential equation: $y' + cos(x)y = cos(x)$

3. The attempt at a solution
$y' = cos(x)(1 -y)$
$\frac{dy}{1-y} = cos(x) dx$
$-ln|1-y| = sin(x) + C$
$\frac{1}{1-y} = e^{sin(x)} + C$
$1-y = \frac{1}{e^{sin(x)} + C}$
$y = \frac{-1}{e^{sin(x)} + C} + 1$

Have I done this correctly?

2. Mar 30, 2012

Dick

No. e^(sin(x)+C) isn't the same as e^sin(x)+C.

3. Mar 30, 2012

TranscendArcu

So I know $e^{sin(x) + C} = e^{sin(x)}e^C$. But since $e^C$ is just a constant, can't I just compress it into the constant C?

4. Mar 30, 2012

Dick

Yes, but that makes it C*e^(sin(x)), doesn't it?

5. Mar 30, 2012

TranscendArcu

so I should write,

$\frac{1}{1-y} = e^{sin(x)}C$
$1-y = \frac{1}{e^{sin(x)}C}$, and C is totally arbitrary so write,
$y = \frac{C}{e^{sin(x)}} + 1$

6. Mar 30, 2012

Dick

I think that works.