Integral $\int\frac{2x^2}{2x\cos(2x)+(x^2-1)\sin(2x)} \mathrm d x$ 
Integrate  $\displaystyle\int\dfrac{2x^2}{2x\cos(2x)+(x^2-1)\sin(2x)} \mathrm d x$

I tried dividing by $\cos^2(x)$ and then substituting $\tan(x)=t$.
 A: The hint:
Compute 
$$\left(\ln\dfrac{x-\tan x}{x\tan x+1}\right)^{'}.$$
A: Here's a solution using @MichaelRozenberg's hint. Solution requires some careful observation and without Michael's hint, I wouldn't have noticed it. Still, it provides a quick answer. 
Using double-angle formula, we get 
$$\dfrac{2x^2}{2x\cos(2x)+(x^2-1)\sin(2x)}=\dfrac{x^2}{(x\cos x-\sin x)(x\sin x+\cos x)}.$$
Dividing the numerator and denominator by  $\cos^2x $ gives, $$\dfrac{x^2\sec^2x}{(x-\tan x)(x\tan x+1)}.$$
Now observe that $$\left(\dfrac{x-\tan x}{x\tan x+1}\right)^{'}=\dfrac{-x^2\sec^2x}{(x\tan x+1)^2}.$$
So multiply the numerator and denominator by $x\tan x+1$ and take $\dfrac{x-\tan x}{x\tan x+1}=t. $
A: $$2x\cos (2x)+(x^2-1)\sin 2x=(x^2+1)\bigg[\frac{2x}{x^2+1}\cos 2x+\frac{x^2-1}{x^2+1}\sin 2x\bigg]$$
$$=(x^2+1)\cos\bigg(2x-2\alpha\bigg)$$
$\displaystyle \sin(2\alpha)=\frac{x^2-1}{x^2+1}$ and $\displaystyle \cos(2\alpha)=\frac{2x}{x^2+1}$
integration $$=\int\sec\bigg(2x-\tan^{-1}\frac{x^2-1}{2x}\bigg)\frac{2x^2}{x^2+1}dx$$
put $\displaystyle 2x-\tan^{-1}\bigg(\frac{x^2-1}{2x}\bigg)=t$
And $\displaystyle \frac{2x^2}{x^2+1}dx=dt$
Integral $$=\int \sec(t)dt=\ln\bigg|\sec (t)+\tan (t)\bigg|+C$$
A: Let $\arctan x=y\implies x=\tan y,x^2-1=\dfrac{\sin^2y}{\cos^2y}-1=-(1+x^2)\cos2y$
$$2x\cos(2x)+(x^2-1)\sin2x=(1+x^2)\sin2(\arctan x-x)$$
$$I=\displaystyle\int\dfrac{2x^2}{2x\cos(2x)+(x^2-1)\sin(2x)} =\int\dfrac{2x^2}{(1+x^2)\sin2(\arctan x-x)}$$
Now set $u=\arctan x-x,du=-\dfrac{x^2\ dx}{1+x^2}$
$$I=-2\int\dfrac{du}{\sin2u}=?$$
Use this
A: After substituting $\cos(2x)=\cos^2x-\sin^2x$ and $\sin(2x)=2\sin x\cos x$ and doing a bit of algebra, we find that
$$2x\cos(2x)+(x^2-1)\sin(2x)=2(x\sin x+\cos x)(x\cos x-\sin x)$$
and thus
$$\begin{align}{2x^2\over 2x\cos(2x)+(x^2-1)\sin(2x)}
&={x^2\over(x\sin x+\cos x)(x\cos x-\sin x)}\\
&={x\cos x\over x\sin x+\cos x}+{x\sin x\over x\cos x-\sin x}\end{align}$$
The substitution $u=x\sin x+\cos x$, $du=x\cos x\,dx$ tells us
$$\int{x\cos x\over x\sin x+\cos x}\,dx=\int{du\over u}=\ln|u|+C=\ln|x\sin x+\cos x|+C$$
while the substitution $u=x\cos x-\sin x$, $du=-x\sin x$ tells us
$$\int{x\sin x\over x\cos x-\sin x}\,dx=-\int{du\over u}=-\ln|u|+C = -\ln|x\cos x-\sin x|+C$$
and thus
$$\int{2x^2\over 2x\cos(2x)+(x^2-1)\sin(2x)}\,dx=\ln\left|x\sin x+\cos x\over x\cos x-\sin x\right|+C$$
Remark: The key here was to get split the integral into two pieces, each of which is easily handled with a simple substitution. The two pieces' substitutions are similar, but not the same. It was not obvious (to me, at least) that the double-angle formulae would lead to a nice factorization, nor that "partial fractions" on the factored denominator would produce such nice results, but the individual steps seemed natural to consider. 
