<s>[INST] Evaluate $\int \dfrac{x^2}{(x\cos x-\sin x)(x\sin x+\cos x)}dx$ $$\int \dfrac{x^2}{(x\cos x-\sin x)(x\sin x+\cos x)}dx$$
My attempts is as follows:-
Integrating by parts:-
$$\dfrac{1}{(x\cos x-\sin x)(x\sin x+\cos x)}\cdot\dfrac{x^3}{3}-\dfrac{1}{3}\int\dfrac{x^3\left(-x\sin x(x\sin x+\cos x)+x\cos x(x\cos x-\sin x)\right)}{(x\cos x-\sin x)^2(x\sin x+\cos x)^2}dx$$
$$\dfrac{1}{(x\cos x-\sin x)(x\sin x+\cos x)}\cdot\dfrac{x^3}{3}-\dfrac{1}{3}\int\dfrac{x^3\left(-x^2\sin^2x-x\sin x\cos x-x\cos x\sin x+x^2\cos^2x\right)}{(x\cos x-\sin x)^2(x\sin x+\cos x)^2}dx$$
$$\dfrac{1}{(x\cos x-\sin x)(x\sin x+\cos x)}\cdot\dfrac{x^3}{3}-\dfrac{1}{3}\int\dfrac{x^3\left(x^2\cos2x-x\sin 2x\right)}{(x^2\cos x\sin x+x\cos^2x-x\sin^2x-\sin x\cos x)^2}dx$$
$$\dfrac{1}{(x\cos x-\sin x)(x\sin x+\cos x)}\cdot\dfrac{x^3}{3}-\dfrac{1}{3}\int\dfrac{x^3\left(x^2\cos2x-x\sin 2x\right)}{(\cos x\sin x(x^2-1)+x\cos 2x)^2}dx$$
I thought numerator and denominator in the second would be quite similar, but its not, so I was not able to proceed from here.
Any directions?
 [/INST] The integrand is $\frac{x\cos x}{x\sin x+\cos x}-\frac{-x\sin x}{x\cos x-\sin x}$. In the numerator of the first fraction, add and subtract the $\sin x$ and in the second -- $\cos x$.
</s>