Evaluate $\displaystyle \int \frac{x^2 + 2}{(x \cos x + \sin x)^2} \ dx.$
2. Try the substitution $\displaystyle u=x-\arctan\frac1x$. Then $\displaystyle \tan u=\frac{\tan x-\frac1x}{1+\frac{\tan x}x} =\frac{x\sin x-\cos x}{x\cos x+\sin x}$. Furthermore $\displaystyle 1+\tan^2 u=\frac{x^2+1}{(x\cos x+\sin x)^2}$. Also $\displaystyle \mathrm{d}u=\frac{x^2+2}{x^2+1}\mathrm{d}x$. Therefore $\displaystyle \displaystyle\int\dfrac{x^2+2}{(x\cos x+\sin x)^2}\mathrm{d}x=\int(1+\tan^2 u)\mathrm{d}u=\tan u+c=\frac{x\sin x-\cos x}{x\cos x+\sin x}+c$.
Try the substitution $\displaystyle u=x-\arctan\frac1x$. Then $\displaystyle \tan u=\frac{\tan x-\frac1x}{1+\frac{\tan x}x} =\frac{x\sin x-\cos x}{x\cos x+\sin x}$. Furthermore $\displaystyle 1+\tan^2 u=\frac{x^2+1}{(x\cos x+\sin x)^2}$. Also $\displaystyle \mathrm{d}u=\frac{x^2+2}{x^2+1}\mathrm{d}x$. Therefore $\displaystyle \displaystyle\int\dfrac{x^2+2}{(x\cos x+\sin x)^2}\mathrm{d}x=\int(1+\tan^2 u)\mathrm{d}u=\tan u+c=\frac{x\sin x-\cos x}{x\cos x+\sin x}+c$.