The given differential equation is
x ² (y' - x ²) + 3xy = cos(x)
Expanding and rearranging terms, we get
x ² y' + 3xy = cos(x) + x ⁴
Multiply both sides by x, which is motivated by the fact that (x ³)' = 3x ².
x ³ y' + 3x ²y = x cos(x) + x ⁵
The left side is the derivative of a product:
(x ³y)' = x cos(x) + x ⁵
Integrate both sides with respect to x :
∫ (x ³y)' dx = ∫ (x cos(x) + x ⁵) dx
x ³y = cos(x) + x sin(x) + 1/6 x ⁶ + C
Solve for y. Since x > 0, we can safely divide both sides by x ³.
y = cos(x)/x ³ + sin(x)/x ² + 1/6 x ³ + C/x³