<s>[INST] Find $\int \frac{x^2}{(x \cos x - \sin x)(x \sin x + \cos x)}dx $ Find $$\int \frac{x^2}{(x \cos x - \sin x)(x \sin x + \cos x)}dx $$
Any hints please?
Could'nt think of any approach till now...
 [/INST] When I have a rational function I usually start by making a part of the denominator "appear" in the numerator, and since we're dealing with trigonometric function, the following identity is quite handy:
$$\frac{x^2}{(x \cos x - \sin x)(x \sin x + \cos x)}=\frac{x^2\cos^2x+x^2\sin^2x}{(x \cos x - \sin x )(x \sin x + \cos x)} $$
$$\frac{x^2\cos^2x-x\sin x\cos x+x\sin x\cos x+x^2\sin^2x}{(x \cos x - \sin x )(x \sin x + \cos x)}=\frac{x\cos x(x\cos x-\sin x)+x\sin x(\cos x+x\sin x)}{(x \cos x - \sin x )(x \sin x + \cos x)} $$
$$ = \frac{x \cos x}{ x \sin x  + \cos x } + \frac{x \sin x}{x \cos x - \sin x} $$
Let's treat each part separately:
$$I_1=\int \frac{x \cos x}{ x \sin x  + \cos x }dx$$
Let $u=x \sin x  + \cos x$ then $du=x \cos xdx$ then
$$I_1\int \frac {du}u=\ln(u)+c_1$$
Acting similarly on the second term, yields:
$$\int \frac{x^2}{(x \cos x - \sin x)(x \sin x + \cos x)}dx=\ln( x \sin x  + \cos x)-\ln(x \cos x - \sin x)+c$$
</s>