Step 1: Understanding the Concept:
The given equation is homogeneous in \(x\) and \(y\). We can use the substitution \(y = vx\) to solve it.
Step 2: Key Formula or Approach:
The given equation is:
\[
x \sin \frac{y}{x} \, dy = \left( y \sin \frac{y}{x} - x \right) dx
\]
Rewrite as:
\[
\frac{dy}{dx} = \frac{y \sin(y/x) - x}{x \sin(y/x)}
\]
Let \(y = vx\), so \(\frac{dy}{dx} = v + x \frac{dv}{dx}\).
Also, \(\sin \frac{y}{x} = \sin v\).
Step 3: Detailed Explanation:
Substitute:
\[
v + x \frac{dv}{dx} = \frac{vx \sin v - x}{x \sin v} = \frac{v \sin v - 1}{\sin v} = v - \frac{1}{\sin v}
\]
So,
\[
v + x \frac{dv}{dx} = v - \csc v \Rightarrow x \frac{dv}{dx} = - \csc v
\]
Separate variables:
\[
\sin v \, dv = -\frac{dx}{x}
\]
Integrate:
\[
\int \sin v \, dv = -\int \frac{dx}{x} \Rightarrow -\cos v = -\ln x + c
\]
\[
\cos v = \ln x - c \Rightarrow \ln x - \cos v + c = 0
\]
Substitute \(v = y/x\):
\[
\ln x - \cos \frac{y}{x} + c = 0
\]
This matches option (D).
Step 4: Final Answer:
Therefore, option (D) is correct.