Prove: $\int_{0}^{\pi}\frac{x\tan x}{\sec x+\cos x}dx = \frac{\pi^{2}}{4}$ How to prove following?
$$\int_{0}^{\pi}\frac{x\tan x}{\sec x+\cos x}dx  = \frac{\pi^{2}}{4}$$
 A: $$\dfrac{x \tan(x)}{\sec(x) + \cos(x)} = \dfrac{x\sin(x)}{\cos(x) \cdot \sec(x) + \cos^2(x)} = \dfrac{x \sin(x)}{1+\cos^2(x)} = \sum_{k=0}^{\infty} (-1)^kx \sin(x) \cos^{2k}(x)$$
Hence,
$$I = \int_0^{\pi} \dfrac{x \tan(x)}{\sec(x) + \cos(x)} dx = \sum_{k=0}^{\infty}(-1)^k \int_0^{\pi} x \sin(x) \cos^{2k}(x) dx$$
Let $I_k = \displaystyle \int_0^{\pi} x \sin(x) \cos^{2k}(x) dx$. Replacing $x$ by $\pi-x$, we get $$I_k = \int_{0}^{\pi} (\pi-x) \sin(x) \cos^{2k}(x)dx = \pi \int_0^{\pi} \sin(x) \cos^{2k}(x)dx - I_k$$
Hence,
$$2I_k = \pi \int_0^{\pi} \sin(x) \cos^{2k}(x)dx = \pi \cdot \dfrac2{2k+1} \implies I_k = \dfrac{\pi}{2k+1}$$
Hence,
$$I = \sum_{k=0}^{\infty}(-1)^k I_k = \pi \left(\sum_{k=0}^{\infty} \dfrac{(-1)^k}{2k+1}\right) = \pi \cdot \dfrac{\pi}4 = \dfrac{\pi^2}4$$
A: Let $I$ denote your integral. Make the substitution $x\mapsto \pi-x$ to get that 
$$\begin{aligned}I &=\int_0^\pi \frac{(\pi-x)\tan(\pi-x)}{\sec(\pi-x)+\cos(\pi-x)}\,dx\\ &=\int_0^\pi \frac{(x-\pi)(-\tan(x))}{-\sec(x)-\cos(x)}\,dx\\ &= \pi\int_0^\pi\frac{\tan(x)}{\sec(x)+\cos(x)}\,dx-I\end{aligned}$$
Thus one sees that,
$$I=\frac{\pi}{2}\underbrace{\int_0^\pi \frac{\tan(x)}{\sec(x)+\cos(x)}\,dx}_{J}$$
Now, we can rewrite $J$ as 
$$J=\int_0^{\pi}\frac{\sin(x)}{\cos(x)^2+1}\,dx$$
Making the obvious substitution $\cos(x)\mapsto t$ gives us
$$J=\int_{1}^{-1}\frac{-dt}{t^2+1}=2\int_0^1\frac{dt}{t^2+1}=\frac{\pi}{2}$$
Thus,
$$I=\frac{\pi}{2}J=\frac{\pi^2}{4}$$
