Solve y` - y cot x = 2x - x^2 cot x
Rearrange the DE.
y' +(x^2 - y)cot(x) = 2x
(x^2 - y)cot(x) = 2x - y'
Let g(x) = x^2 - y, then g'(x) = 2x - y'
So,
g(x).cot(x) = 2x - y' = g'(x)
Or,
g' - g.cot(x) = 0
The solution for this is,
g(x) = A.sin(x)
Substituting back for g(x) = A.sin(x)
x^2 - y = A.sin(x)
y(x) = x^2 - A.sin(x)