Answer
The solution of the differential equation
$$
y^{\prime}=x e^{-\sin x}-y \cos x
$$
is
$$
y=\left(\frac{1}{2} x^{2}+C\right) e^{-\sin x}
$$
where $ C $ is an arbitrary constant
Work Step by Step
$$
y^{\prime}=x e^{-\sin x}-y \cos x
$$
$$
\Rightarrow \quad y^{\prime}+(\cos x) y=x e^{-\sin x} \quad\quad (1)
$$
This is a linear equation and the integrating factor is
$$
I(x)=e^{\int \cos x d x}=e^{\sin x}
$$
Multiplying Eq.(1) by $e^{\sin x}$ gives
$$
e^{\sin x} y^{\prime}+e^{\sin x}(\cos x) y=x .\quad\left(e^{\sin x} y\right)^{\prime}=x
$$
When we integrate both sides of the last equation we get:
$$
e^{\sin x} y=\frac{1}{2} x^{2}+C \Rightarrow y=\left(\frac{1}{2} x^{2}+C\right) e^{-\sin x}
$$
So the solution of the differential equation
$$
y^{\prime}=x e^{-\sin x}-y \cos x
$$
is
$$
y=\left(\frac{1}{2} x^{2}+C\right) e^{-\sin x}
$$
where $ C $ is an arbitrary constant