Evaluate $\int \frac{x\tan(x) \sec(x)}{(\tan(x)-x)^2}$ Find value of following integral $$\int \frac{x\tan(x) \sec(x)}{(\tan(x)-x)^2}\text{dx}$$
the numerator is $\text{d[sec(x)]}$ but that isnt work due to $x$ in denominator. First we can simplify as $$\int\frac{x\sin(x)}{(\sin(x)-x\cos(x))^2} \text{dx} = \int \frac{x}{(\sin(x)-x\cos(x))} \text{dx}+\int \frac{x^2 \cos(x)}{(\sin(x)-x\cos(x))^2} \text{dx}$$
but again its not manipulative. Suggest a useful substitution or method.
Thanks a lot!

Consider the function $f(x) = \frac{1}{(\sin x - x\cos x)}$. Once differentiation gives:
$$f'(x) = \frac{-(\cos x +x\sin x-\cos x)}{(\sin x - x\cos x)^2} = \frac{-x \sin x}{(\sin x - x\cos x)^2}$$
So your integral is:
$$\int \frac{x \sin x}{(\sin x - x\cos x)^2} dx =  \frac{-1}{(\sin x - x \cos x)}$$
