<s>[INST] Integrate : $\int \frac{x^2}{(x\cos x -\sin x)(x\sin x +\cos x)}dx$ 
$$\int \frac{x^2}{(x\cos x -\sin x)(x\sin x +\cos x)}\ dx$$

My approach : 
Dividing the denominator by $\cos^2x$ we get $\dfrac{x^2\sec^2x }{(x -\tan x)(x\tan x +1)}$ then
$$\int \frac{x^2\sec^2x}{x^2\tan x -x\tan^2x+x-\tan x}\ dx=\int \frac{x^2(1+\tan^2x)}{x^2\tan x -x\tan^2x+x-\tan x}dx$$
But I am not getting any relation between numerator and denominator so that I will take any substitution and solve further please suggest whether it is correct and how to proceed in this. Thanks.
 [/INST] $\displaystyle u=x\sin x+\cos x,v=x\cos x-\sin x \Rightarrow  \displaystyle du=x\cos xdx,dv=-x\sin xdx$
$\begin{align}\displaystyle\int\frac{x^{2}dx}{(x\sin x+\cos x)(x\cos x-\sin x)}&=\int\left(\frac{x\cos x}{x\sin x+\cos x}-\frac{-x\sin x}{x\cos x-\sin x}\right)dx\\&=\displaystyle\int\frac{du}{u}-\int\frac{dv}{v}\\&=\ln\left| \frac{u}{v} \right|+c\end{align}$
$\displaystyle\int\frac{x^{2}dx}{(x\sin x+\cos x)(x\cos x-\sin x)}=\ln\left| \frac{x\sin x+\cos x}{x\cos x-\sin x} \right|+c $
</s>