We have,
(1+x2)dydx−2xy=(x2+2)(x2+1)
⇒dydx−2xy(1+x2)=(x2+2)(x2+1)(1+x2)
⇒dydx−2xy(1+x2)=(x2+2)
On comparing that,
dydx+Py=Q
Then,
P=−2x1+x2,Q=x2+2
Now,
I.F.=e∫pdx=e∫−2x1+x2dx=e−log(1+x2)=11+x2
So,
y.I.F.=∫QI.F.dx+C
⇒y.11+x2=∫x2+21+x2dx+C
⇒y1+x2=∫x2+11+x2dx+∫11+x2dx+C
⇒y1+x2=x+tan−1x+C
Hence,
this is the answer.