We wish to evaluate
I=∫(xsinx+cosxx)2dx.
Whenever we see a rational expression in which the denominator as well as its derivative appear, it is often fruitful to look for some expression whose derivative reproduces the given integrand. Let us therefore inspect the quantity
F(x)=tanx−xsinx+cosxxsecx.
If it turns out that F′(x)=(xsinx+cosxx)2, then we can immediately write I=F(x)+C. So we now differentiate F(x) very carefully, showing every algebraic step.
First, recall the basic derivatives we shall need:
dxd(tanx)=sec2x,dxd(secx)=secxtanx.
Write the denominator that keeps occurring as
D=xsinx+cosx.
Its derivative is
D′=dxd(xsinx)+dxd(cosx)=sinx+xcosx−sinx=xcosx.
Now differentiate F(x) term by term.
1. For the first term we directly have
dxd(tanx)=sec2x.
2. The second term is the quotient Dxsecx.
Let us put u=xsecx,v=D.
Then u′=secx+xsecxtanx,v′=D′=xcosx.
Using the quotient rule (vu)′=v2u′v−uv′, we get
dxd(Dxsecx)=D2(secx+xsecxtanx)D−(xsecx)(xcosx).
Because in F(x) this whole fraction is preceded by a minus sign, the contribution of the second term to F′(x) will actually be the negative of the above. Thus
F′(x)=sec2x−D2(secx+xsecxtanx)D−(xsecx)(xcosx).
It is now a matter of pure algebra to simplify the numerator. For that purpose let us isolate the large numerator:
N=(secx+xsecxtanx)D−(xsecx)(xcosx).
Handle the product in the first term:
(secx+xsecxtanx)D=secxD+xsecxtanxD.
The second part of N simplifies immediately because secxcosx=1:
(xsecx)(xcosx)=x2secxcosx=x2.
Therefore
N=secxD+xsecxtanxD−x2.
Notice that secxD can itself be rewritten:
secxD=secx(xsinx+cosx)=cosxxsinx+cosx=1+xtanx.
Consequently,
secxD=1+xtanx⟹secxD+xsecxtanxD=(1+xtanx)+xtanx(1+xtanx).
This factorisation tells us that
N=(1+xtanx)[1+xtanx]−x2.
But 1+xtanx squared is (1+xtanx)2, whose numeric value need not be expanded because, as we shall see, it will cancel out perfectly with the sec2xD2 part of F′(x).
Indeed, compute
sec2xD2=cos2x1(xsinx+cosx)2=(secxD)2=(1+xtanx)2.
Now the total numerator appearing in F′(x) is
sec2xD2−N=(1+xtanx)2−[(1+xtanx)2−x2]=x2.
Therefore
F′(x)=D2x2=(xsinx+cosxx)2.
But this is precisely the integrand of I. Hence F(x) is an antiderivative, and we can write
∫(xsinx+cosxx)2dx=tanx−xsinx+cosxxsecx+C.
Comparing with the given options, this matches Option A.
Hence, the correct answer is Option A.