Step 1: Rewrite integrand by multiplying and dividing by cosine
To integrate by parts, we observe the derivative of the denominator term xsinx+cosx. Its derivative is dxd(xsinx+cosx)=xcosx+sinx−sinx=xcosx. Thus, we rewrite the numerator x2 as cosxx⋅(xcosx) so that one part is directly integrable.
Step 2: Find the integral of the second function
Let t=xsinx+cosx. Then dt=(xcosx+sinx−sinx)dx=xcosxdx. The integral becomes ∫t2dt=−t1=−xsinx+cosx1.
Step 3: Apply integration by parts
Taking f(x)=cosxx=xsecx as the first function and g(x)=(xsinx+cosx)2xcosx as the second function, we apply the integration by parts rule: ∫f(x)g(x)dx=f(x)∫g(x)dx−∫[dxdf(x)∫g(x)dx]dx.
Step 4: Differentiate the first function and simplify the remaining integral
Differentiating f(x)=cosxx using the quotient rule gives cos2x1⋅cosx−x(−sinx)=cos2xcosx+xsinx. Substituting this into the remaining integral leads to an exact cancellation of the factor (xsinx+cosx).
Step 5: Evaluate the remaining integral and conclude
The remaining integral simplifies to ∫cos2x1dx=∫sec2xdx=tanx. Adding the constant of integration C, we obtain the final answer.