Integrate $\int^{\pi }_{0}\frac{x}{2-\tan ^{2}\left( x\right) }\mathrm dx $ The integral I tried to solve by using this rule 
$$\int \limits^{a}_{0}f\left( x\right)\mathrm  dx = \int \limits^{a}_{0}f\left( a-x\right)\mathrm dx.$$ 
The  integral is 
$$\int \limits^{\pi }_{0}\frac{x}{2-\tan ^{2}\left( x\right) }\mathrm dx $$ 
I tried Wolfram Alpha put it was useless...  Is there any hint or solution?
Thanks for help.
 A: Let $f(x) = 2 - \tan^2 x$. Then, using $\tan(\pi - x) = -\tan(x)$, $f(x) = f(\pi - x)$.
$$\int_0^{\pi} \frac{x}{f(x)}dx = \int_0^{\pi} \frac{\pi - x}{f(x)}dx \implies \\ \int_0^{\pi} \frac{x}{f(x)}dx = \frac{\pi}2 \int_0^{\pi} \frac1{f(x)}dx$$
Can you proceed?
A: This integral is divergent, since by the Taylor expansion, as $x \to \frac\pi4$, the integrand behaves as

$$
\frac{x}{2-\tan ^{2}\left( x\right) }=-\frac{\pi }{16 \left(x-\frac{\pi }{4}\right)}+\frac{\pi}{8}-\frac14+O \left(x-\frac{\pi }{4}\right).
$$ 

Maybe there is a typo in the question. Unless you are dealing with the Cauchy principal value.
A: Let $$I=\int_{0}^{\pi}\frac{x}{2-\tan^2 x}dx\tag 1$$
Now, using rule of integration, we get 
$$I=\int_{0}^{\pi}\frac{(\pi-x)}{2-\tan^2 (\pi-x)}dx$$
$$I=\int_{0}^{\pi}\frac{(\pi-x)}{2-\tan^2x}dx\tag 2$$ 
Now, adding (1) & (2), $$I+I=\int_{0}^{\pi}\frac{x}{2-\tan^2x}dx+\int_{0}^{\pi}\frac{(\pi-x)}{2-\tan^2x}dx$$ $$2I=\int_{0}^{\pi}\frac{\pi}{2-\tan^2x}dx$$
$$I=\frac{\pi}{2}\int_{0}^{\pi}\frac{dx}{2-\tan^2x}$$
Now, using $\int_{0}^{2a}f(x)dx=2\int_{0}^{a}f(x)dx\iff f(2a-x)=f(x)$, we get 
$$I=\frac{\pi}{2}(2)\int_{0}^{\pi/2}\frac{dx}{2-\tan^2x}$$
$$=\pi\int_{0}^{\pi/2}\frac{\sec^2x dx}{\sec^2x(2-\tan^2x)}$$
$$=\pi\int_{0}^{\pi/2}\frac{\sec^2x dx}{(1+\tan^2x)(2-\tan^2x)}$$ Now, let $\tan x=t\implies \sec^2x dx=dt$ $$I=\pi\int_{0}^{\infty}\frac{dt}{(1+t^2)(2-t^2)}$$
$$I=\pi\int_{0}^{\infty}\frac{dt}{(\sqrt{2}-t)(\sqrt{2}+t)(1+t^2)}$$ I hope you can solve further by using partial fractions.
A: The function $\displaystyle x\mapsto f(x)=\frac{x}{2-\tan^2x}$ is discontinuous at $x_1=\arctan\sqrt2 \in(\pi/4,\pi/2)$ and at $x_2=\pi-x_1$, and near $x_1$ we have
$$
2-\tan^2x=-6\sqrt2(x-x_1)-21(x-x_1)^2+\ldots.
$$
It follows that
$$
f(x)\sim -\frac{1}{6\sqrt2}-\frac{x_1}{6\sqrt2}(x-x_1)^{-1}+\ldots
$$
Thus the integral 
$$
\int_0^{x_1} f(x)\,dx
$$
is divergent, and so is the integral $\displaystyle \int_0^\pi f(x)\,dx$.
