Problem Statement
Consider the differential equation $x \frac{dy}{dx} + 2y = \cos x$ for $x > 0$, with the initial condition $y(\pi) = 0$.
**(a)** [5 marks] Find the general solution of the differential equation.
**(b)** [2 marks] Find the particular solution satisfying $y(\pi) = 0$.
Verified Solution & Marking Scheme
Part (a) [M1]
Rearrange to standard form: $\frac{dy}{dx} + \frac{2}{x}y = \frac{\cos x}{x}$
Part (a) [M1, A1]
Integrating factor: $I(x) = e^{\int \frac{2}{x} dx} = e^{2\ln x} = e^{\ln(x^2)} = x^2$
Part (a) [M1]
Multiply by integrating factor: $\frac{d}{dx}(x^2 y) = x^2 \cdot \frac{\cos x}{x} = x\cos x$
Part (a) [M1, A1]
Integrate by parts: $x^2 y = \int x\cos x \, dx = x\sin x - \int \sin x \, dx = x\sin x + \cos x + C \implies y = \frac{x\sin x + \cos x + C}{x^2}$
Part (b) [M1]
Substitute $x = \pi, y = 0$: $0 = \frac{\pi\sin(\pi) + \cos(\pi) + C}{\pi^2} = \frac{0 - 1 + C}{\pi^2} \implies C = 1$
Part (b) [A1]
Particular solution: $y = \frac{x\sin x + \cos x + 1}{x^2}$