<s>[INST] Integral of $1/(1+x \tan(x))^2$ How would you solve the following integral?
$$\int \frac{1}{(1+x\tan(x))^2} dx$$
Any help would be appreciated.
 [/INST] $\bf{My\; Solution::}$ Let $\displaystyle I = \int\frac{1}{(1+x\tan x)^2}dx = \int\frac{\cos ^2x}{(x\sin x+\cos x)^2}dx$
So $\displaystyle I = \int \frac{\cos x}{x}\cdot \left\{\frac{x\cos x}{(x\sin x+\cos x)^2}\right\}dx$
Now Using Integration by Parts.... 
So $\displaystyle I = -\frac{\cos x}{x}\cdot \frac{1}{(x\sin x+\cos x)}-\int \frac{(x\sin x+\cos x)}{x^2}\cdot \frac{1}{(x\sin x+\cos x)}dx$
So $\displaystyle I = -\frac{1}{x\cdot (1+x\tan x)}+\frac{1}{x}+\mathcal{C} = \frac{\tan x}{(1+x\tan x)}+\mathcal{C}.$
</s>