# Differential Equation by Separation of Variables

## Homework Statement

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

## 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?

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

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?

Dick
Homework Helper
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?

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

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$

Dick
$\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$