<s>[INST] Indefinite integral $\int(\sin x)^2/(x\cdot\cos x-\sin x)^2\,dx$ How to find the antiderivative of $\dfrac{(\sin x)^2}{(x\cdot\cos x-\sin x)^2}$? I know that series theory can solve the problem. But I wish to solve the problem by the antiderivative way. The numerator and denominator divide the $x^2$ at the same time, don't they? 
 [/INST] As $\displaystyle \frac{d(x\cos x-\sin x)}{dx}=-x\sin x,\int\frac{-x\sin x}{(x\cos x-\sin x)^2}dx=-\frac1{x\cos x-\sin x}$
Integrating by parts, 
$$\int\frac{\sin^2x}{(x\cos x-\sin x)^2}dx=\int \frac{(-x\sin x)}{(x\cos x-\sin x)^2}\cdot\frac{-\sin x}x dx$$
$$=\frac{-\sin x}x\int\frac{(-x\sin x)}{(x\cos x-\sin x)^2}dx-\int\left(\frac{d\left(\frac{-\sin x}x\right)}{dx}\cdot\int \frac{(-x\sin x)}{(x\cos x-\sin x)^2}dx\right)dx$$
$$=\frac{\sin x}x\cdot\frac1{x\cos x-\sin x}+\int\left(\frac{x\cos x-\sin x}{x^2}\cdot\frac1{x\cos x-\sin x}\right)dx$$
$$=\frac{\sin x}x\frac1{x\cos x-\sin x}+\int\frac{dx}{x^2}$$
Can you take it from here?
</s>