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?
Now you insert $$ 1=y(0)=(0+α)e^{−\sin 0}=α $$ to get the value for the integration constant.