The given differential equation is
(1+x2)dy+2xydx=cotxdx
Dividing every term by dx,
(1+x2)dxdy+2xy=cotx
Dividing every term by (1+x2) to make the coefficient of
dxdy unity,
dxdy+1+x22xy=1+x2cotx
Linear Differential Equation
Comparing with
dxdy+Py=Q,
we have
P=1+x22x,Q=1+x2cotx
Integrating Factor
∫Pdx=∫1+x22xdx
=log∣1+x2∣
Since 1+x2>0,
log∣1+x2∣=log(1+x2)
I.F.=e∫Pdx=elog(1+x2)=1+x2
General Solution
y(I.F.)=∫Q(I.F.)dx+c
⇒y(1+x2)=∫1+x2cotx(1+x2)dx+c
⇒y(1+x2)=∫cotxdx+c
⇒y(1+x2)=log∣sinx∣+c
Final Solution
Dividing every term by 1+x2,
y=1+x2log∣sinx∣+1+x2c
or
y=(1+x2)−1log∣sinx∣+c(1+x2)−1
y=1+x2log∣sinx∣+1+x2c
which is the required general solution.