Linear First Order ODE/x dy + y dx = x cosine x dx

Theorem
The linear first order ODE:
 * $(1): \quad x \, \mathrm d y + y \, \mathrm d x = x \cos x \, \mathrm d x$

has the solution:
 * $x y = x \sin x + \cos x + C$

Proof
Rearranging $(1)$:
 * $(2): \quad \dfrac {\mathrm d y} {\mathrm d x} + \dfrac y x = \cos x$

$(2)$ is a linear first order ODE in the form:
 * $\dfrac {\mathrm d y}{\mathrm d x} + P \left({x}\right) y = Q \left({x}\right)$

where:
 * $P \left({x}\right) = \dfrac 1 x$
 * $Q \left({x}\right) = \cos x$

Thus:

Thus from Solution by Integrating Factor, $(1)$ can be rewritten as: