Let, I=intx^2/(xsinx+cosx)^2dx,
=int{(xsecx)((xcosx)/(xsinx+cosx)^2)}dx.
We will use the following Rule of Integration by Parts (IBP) :
" IBP : "intuv'dx=uv-intu'vdx.
Prior to the Integration, let us note :
d/dx{1/(xsinx+cosx)}
=-1/(xsinx+cosx)^2*d/dx{(xsinx+cosx)},
=-1/(xsinx+cosx)^2*{(x*cosx+sinx)+(-sinx)}.
=-(xcosx)/(xsinx+cosx)^2.
rArr int(xcosx)/(xsinx+cosx)^2dx=-1/(xsinx+cosx)............(1).
Also, d/dx(xsecx)=xsecxtanx+secx,
=x*1/cosx*sinx/cosx+1/cosx.
rArr d/dx(xsecx)=(xsinx+cosx)/cos^2x............(2).
Now, in IBP, we take,
u=xsecx, and, v'=(xcosx)/(xsinx+cosx)^2.
:.u'=(xsinx+cosx)/cos^2x, &, v=-1/(xsinx+cosx).
:. I=(xsecx){-1/(xsinx+cosx)}
-int{((xsinx+cosx)/cos^2x)*(-1/(xsinx+cosx))}dx,
=-x/{cosx(xsinx+cosx)}+intsec^2xdx,
=-x/{cosx(xsinx+cosx)}+tanx,
=-x/{cosx(xsinx+cosx)}+sinx/cosx,
={-x+sinx(xsinx+cosx)}/{cosx(xsinx+cosx)},
={-x+xsin^2x+sinxcosx}/{cosx(xsinx+cosx)},
={-x(1-sin^2x)+sinxcosx}/{cosx(xsinx+cosx)},
=(-xcos^2x+sinxcosx)/{cosx(xsinx+cosx)},
={cosx(sinx-xcosx)}/{cosx(xsinx+cosx)}.
rArr I=(sinx-xcosx)/(xsinx+cosx)+C.
color(blue)("Enjoy Maths.!")