How to solve Cauchy problem for $y' + y\cos x = e^{-\sin x} \quad y(0) = 1$? I have: $$y' + y\cos x = e^{-\sin x} \quad y(0) = 1$$
Applying Lagrange's method I got:
$$y' + y\cos x = 0 \\ \frac{dy}{dx} = -y\cos x \\ \int\frac{dy}{y} = -\int \cos x \, dx \\ \ln |y| = -\sin x +C \\ y = C\cdot e^{-\sin x}$$ 

$$y(x) = C(x)\cdot e^{-\sin x} \\ y'(x) = C'(x)e^{-\sin x} - C(x) e^{-\sin x} \cos x$$
substituting back into the original equation and simplifying I got:
$$C'(x)e^{-\sin x} = e^{-\sin x}$$
and therefore
$$C(x) = x + \alpha$$
and the final answer is:
$$y = (x + \alpha)e^{-\sin x}$$
But how to solve Cauchy problem for the final answer?
 A: Now you insert
$$
1=y(0)=(0+α)e^{−\sin 0}=α
$$
to get the value for the integration constant.
A: Whilst scanning this morning's new questions over coffee and a cigar I noticed that this Cauchy problem has a nifty little solution which does not use the conventional methods such as Lagrange's, variation of parameters or the classic integral formula for first order linear equations which gives the solution to
$y' + a(x)y = b(x), \; y(x_0) = y_0, \tag 1$
as
$y(x) = \displaystyle \exp \left( -\int_{x_0}^x a(s) \; ds \right) \left (y_0 + \int_{x_0}^x \exp \left ( \int_{x_0}^s a(u) \; du \right ) b(s) ds \right); \tag 2$
thus I thought it might be worth presenting here:
with
$y' + (\cos x) y = e^{-\sin x}, \; y(0) = 1, \tag 3$
we see that multiplication by $e^{\sin x}$ yields
$(e^{\sin x}) y' + (e^{\sin x} \cos x)y = 1,\tag 4$
and if we notice that
$((e^{\sin x})y)' = (e^{\sin x}) y' + (e^{\sin x} \cos x)y, \tag 5$
we see that (4) may be written
$((e^{\sin x})y)' = 1, \tag 6$
which we may directly integrate 'twixt $0$ and $x$ to obtain
$(e^{\sin x})y(x) - y(0) = (e^{\sin x})y(x) - (e^{\sin 0})y(0)$
$= \displaystyle \int_0^x ((e^{\sin s})y(s))' \; ds = \int_0^x 1 \; ds = x, \tag 7$
or
$(e^{\sin x})y(x) = x + y(0), \tag 8$
whence
$y(x) = (y(0) + x)e^{-\sin x}; \tag 9$
now using the initial condition $y(0) = 1$, voila!, we obtain
$y(x) = (1 + x)e^{-\sin x}. \tag{10}$
