Problem Statement
Find the general solution of the differential equation:\n\n$$\frac{dy}{dx} + y \cot x = 2x + x^2 \cot x, \quad (x \neq 0)$$
Verified Solution & Marking Scheme
Identify type & integrating factor (I.F.)
This is a first-order linear ODE of the form $$\frac{dy}{dx} + P(x)y = Q(x)$$, where $$P(x) = \cot x$$ and $$Q(x) = 2x + x^2 \cot x$$.
Calculate Integrating Factor
$$\text{I.F.} = e^{\int \cot x \, dx} = e^{\ln|\sin x|} = \sin x$$
Solve the equation
$$y \cdot (\text{I.F.}) = \int Q(x) \cdot (\text{I.F.}) \, dx + C$$\n$$y \sin x = \int (2x + x^2 \cot x) \sin x \, dx = \int (2x \sin x + x^2 \cos x) \, dx$$\nNotice that $$\frac{d}{dx}(x^2 \sin x) = 2x \sin x + x^2 \cos x$$.
Write general solution
$$y \sin x = x^2 \sin x + C \implies y = x^2 + C \csc x$$.