Answer
$I=\cos xy$ $\;$ is integrating factor.
Work Step by Step
$(\tan xy+xy)dx+x^2dy=0$ ___(1)
Here, $M(x,y)=\tan xy+xy$
$N(x,y)=x^2$
$M_y=x\sec^2xy+x\;\;\;,\;\;\;N_x=2x$
$M_{y}\neq N_{x}$
(1) is not exact
Multiply (1) by $I=\cos xy$
$(\sin xy+xy\cos xy)dx+x^2\cos xy\;dy=0$ ___(2)
Here, $M_{1}(x,y)=\sin xy+xy\cos xy$
$N_{1}(x,y)=x^2\cos xy$
$(M_{1})_y=x\cos xy+x[\cos xy-xy\sin xy]$
$\;\;\;\;\;\;\;\;\;\;\;=2x\cos xy-x^2y\sin xy$
$(N_{1})_x=2x\cos xy-x^2y\sin xy$
$(M_{1})_y=(N_{1})_x$
$\Rightarrow $ (2) is Exact
$I=\cos xy$ $\;$ is integrating factor of (1).