(1+y²) + (2xy - coty)dy/dx = 0
On rearranging, the equation becomes:
⇒dy/dx + 2y/(1+y²)x = coty/(1+y²).
This equation is in the form of dy/dx + P(y).x = Q(y) where
P(y) = 2y/(1+y²)
This is a first order linear non-homogeneous differential equation. Thus integrating factor is:
I.F. = e∫P(y)dy = e∫2y/(1+y²)dy = eln(1+y²) = 1+y².