Integrate : $\int \frac{x^2}{(x\cos x -\sin x)(x\sin x +\cos x)}dx$

HINT :

Rewrite the integrand $$ \frac{x^2}{(x\cos x -\sin x)(x\sin x +\cos x)} $$ as $$ \frac{x\cos x}{x\sin x +\cos x}+\frac{x\sin x}{x\cos x -\sin x} $$ then $$ \frac{\color{red}{\sin x}+x\cos x-\color{red}{\sin x}}{x\sin x +\cos x}+\frac{\color{blue}{\cos x}+x\sin x-\color{blue}{\cos x}}{x\cos x -\sin x}. $$ Now let $u=x\sin x +\cos x$ and $v=x\cos x -\sin x$.


$\bf{Another \; Solution::}$ Let $\displaystyle I = \int\frac{x^2}{(x\sin x+\cos x)\cdot (x\cos x-\sin x)}dx$

Now $\displaystyle I = \int\frac{2x^2}{(x^2\sin 2x+2x\cos^2 x-2x\sin^2 x-\sin 2x)}dx$

So $\displaystyle I = \int\frac{2x^2}{(x^2-1)\sin 2x+2x\cos 2x}dx$

Now $\displaystyle (x^2-1)\sin 2x+2x\cos 2x = \sqrt{(x^2-1)^2+(2x)^2}\cdot \left\{\left(\frac{x^2-1}{x^2+1}\right)\sin 2x+\left(\frac{2x}{x^2+1}\right)\cos 2x\right\}$

Now We can write $\displaystyle (x^2-1)\sin 2x+2x\cos 2x = (x^2+1)\cdot \sin (2x+\alpha)$

Where $\displaystyle \displaystyle \left(\frac{x^2-1}{x^2+1}\right) = \cos \alpha$ and $\displaystyle \left(\frac{2x}{x^2+1}\right)=\sin \alpha$

and so $\displaystyle\tan \alpha = \left(\frac{2x}{x^2-1}\right)\Rightarrow \alpha = \tan^{-1}\left(\frac{2x}{x^2-1}\right)$

So Integral $\displaystyle I = \int \csc(2x+\alpha)\cdot \left(\frac{2x^2}{x^2+1}\right)dx$

Now let $\displaystyle (2x+\alpha) = t\Rightarrow \left\{2x+\tan^{-1}\left(\frac{2x}{x^2-1}\right)\right\} = t\;,$Then $\displaystyle \left(\frac{2x^2}{x^2+1}\right)dx=dt$

So Integral $\displaystyle I = \int \csc tdt = \ln \left|\tan \frac{t}{2}\right|+\mathcal{C} = \ln \left|\tan \left(x+\frac{\alpha}{2}\right)\right|+\mathcal{C} $


$\bf{My\; Solution::\; }$Let $\displaystyle I = \int\frac{x^2}{(x\sin x+\cos x)\cdot (x\cos x-\sin x)}dx$

Let $x=\tan \theta\;,$ Then $dx = \sec^2 \theta d\theta.\;\; $ Then $$I = \displaystyle \int \frac{\tan^2 \theta\cdot \sec^2 \theta }{(\tan \theta\cdot \sin(\tan \theta)+\cos(\tan \theta) )\times (\tan \theta\cdot \cos(\tan \theta)-\sin(\tan \theta) )}d\theta$$

So $$\displaystyle I = \int\frac{\tan^2 \theta\cdot \sec^2 \theta\cdot \cos^2 \theta }{(\sin \theta\cdot \sin(\tan \theta)+\cos(\tan \theta)\cdot \cos \theta )\times (\sin \theta\cdot \cos(\tan \theta)-\sin(\tan \theta)\cdot \cos \theta )}d\theta$$

So $$\displaystyle I = \int\frac{2\tan^2 \theta}{2\cos(\theta-\tan \theta)\cdot \sin(\theta-\tan \theta)}d\theta = \int\frac{2\tan^2 \theta}{\sin (2\theta-2\tan \theta)}d\theta$$

Now Let $\displaystyle (2\theta-2\tan \theta) = u\;\;,$ Then $(2-2\sec^2 \theta)d\theta = du\Rightarrow 2\tan^2\theta d\theta = -du$ So $$\displaystyle I = -\int\frac{1}{\sin u}du = -\int \csc u du = -\ln \tan \left(\frac{u}{2}\right)+\mathbb{C}=-\ln \tan \left(\theta -\tan \theta\right)+\mathbb{C}$$

So $$\displaystyle I = \ln\left|\frac{\cos (\theta-\tan \theta)}{\sin (\theta-\tan \theta)}\right|+\mathbb{C} = \ln\left|\frac{\cos \theta \cdot \cos (\tan \theta)+\sin \theta \cdot \sin(\tan \theta)}{\sin \theta \cdot \cos (\tan \theta)-\cos \theta \cdot \sin(\tan \theta)}\right|+\mathbb{C}$$

So $$\displaystyle I = \ln\left|\frac{\sin (\tan \theta)\cdot \tan \theta+\cos(\tan \theta)}{\cos (\tan \theta)\cdot \tan \theta-\sin (\tan \theta)}\right|+\mathbb{C} = \ln \left|\frac{x\sin x+\cos x}{x\cos x-\sin x}\right|+\mathbb{C}$$

So $$\int\frac{x^2}{(x\sin x+\cos x)\cdot (x\cos x-\sin x)}dx=\ln \left|\frac{x\sin x+\cos x}{x\cos x-\sin x}\right|+\mathbb{C}$$