The given differential equation is y(1+xy)dx−xdy=0 ⇒(ydx−xdy)+xy2dx=0 ⇒y2ydx−xdy+xdx=0 ⇒d(yx)+xdx=0
On integrating both sides, we get ∫d(yx)+∫xdx=0 ⇒yx+2x2=C
If the above curve passes through the point (1,2) , then 21+21=C⇒C=1
The given curve is yx+2x2=1 ∴y=2−x22x ⇒f(x)=2−x22x