Concept:
This is a first-order linear differential equation.
First simplify the derivative term, convert to linear form, find the integrating factor, and then integrate.
ip
Step 1: Expand \(\frac{d}{dx}(xy)\).
\[
\frac{d}{dx}(xy)=x\frac{dy}{dx}+y
\]
So the given equation becomes:
\[
y + x\frac{dy}{dx} + y = x(\sin x+\log x)
\]
\[
x\frac{dy}{dx}+2y=x(\sin x+\log x)
\]
ip
Step 2: Write it in linear form.
Divide by \(x\):
\[
\frac{dy}{dx}+\frac{2}{x}y=\sin x+\log x
\]
This is of the form:
\[
\frac{dy}{dx}+Py=Q
\]
with
\[
P=\frac{2}{x}
\]
ip
Step 3: Find the integrating factor.
\[
\text{I.F.}=e^{\int \frac{2}{x}\,dx}=e^{2\ln x}=x^2
\]
ip
Step 4: Multiply through by the integrating factor.
\[
x^2\frac{dy}{dx}+2xy=x^2\sin x+x^2\log x
\]
The left side becomes:
\[
\frac{d}{dx}(x^2y)=x^2\sin x+x^2\log x
\]
So,
\[
x^2y=\int x^2\sin x\,dx+\int x^2\log x\,dx + c
\]
ip
Step 5: Integrate the two terms.
Using standard integration by parts:
\[
\int x^2\sin x\,dx = -x^2\cos x + 2x\sin x + 2\cos x
\]
Also,
\[
\int x^2\log x\,dx = \frac{x^3}{3}\log x - \frac{x^3}{9}
\]
Therefore,
\[
x^2y=
-x^2\cos x + 2x\sin x + 2\cos x + \frac{x^3}{3}\log x - \frac{x^3}{9} + c
\]
ip
Step 6: Divide by \(x^2\).
\[
y=
-\cos x + \frac{2}{x}\sin x + \frac{2}{x^2}\cos x + \frac{x}{3}\log x - \frac{x}{9} + \frac{c}{x^2}
\]
ip
Hence, the correct answer is:
\[
\boxed{(C)}
\]