Evaluation of $\int^{\pi/2}_{0} \frac{x \tan(x)}{\sec(x)+\tan(x)}dx$

Hint: Try the sub $x \mapsto \frac{\pi}{2} - x$ to get $$\int_0^{\pi/2} \frac{(\pi/2 - x) \cot x}{\csc x + \cot x} \, \mathrm{d}x = \int_0^{\pi/2} \frac{\pi/2 - x}{1 + \sec x} \, \mathrm{d}x$$

Then the rest is do-able using $$\frac{1}{\sec x + 1} = \frac{\cos x}{\cos x + 1} = \frac{\cos^2 \frac{x}{2} - \sin^2 \frac{x}{2}}{2\cos^2 \frac{x}{2}} = \frac{1}{2} - \frac{\tan^2 \frac{x}{2}}{2}$$

And so $$ \int \frac{\mathrm{d}x}{1 + \sec x} = \frac{1}{2} \int 1 - \left(-1+\sec^2 \frac{x}{2}\right) \, \mathrm{d}x = x - \tan \frac{x}{2} + \mathrm{C}$$


There might be an easier solution exploiting symmetry but the one follows is what I came up:

\begin{align*} \int_{0}^{\pi/2} \frac{x\tan x}{\sec x + \tan x} \, {\rm d}x &= \int_{0}^{\pi/2} \frac{x \tan x}{\frac{1}{\cos x} + \frac{\sin x}{\cos x}} \, {\rm d}x \\ &= \int_{0}^{\pi/2} \frac{x \cos x \frac{\sin x}{\cos x}}{1+\sin x} \, {\rm d}x\\ &= \int_{0}^{\pi/2} \frac{x \sin x}{1+ \sin x} \, {\rm d}x \\ &=\int_{0}^{\pi/2} \frac{\left ( \frac{\pi}{2}-x \right ) \cos x}{1+\cos x} \, {\rm d}x \\ &= \frac{\pi}{2} \int_{0}^{\pi/2} \frac{\cos x}{1+ \cos x} \, {\rm d}x - \int_{0}^{\pi/2} \frac{x \cos x}{1+ \cos x} \, {\rm d}x \\ &= \frac{\pi^2-2\pi}{4} + \frac{\pi}{2} - \frac{\pi^2}{8} -\log 2 \\ &= \frac{\pi^2}{8} - \log 2 \end{align*}

The last integrals standing are trivial. If needed I may add a derivation.

Addendum:

For the first integral we have that:

\begin{align*} \int_{0}^{\pi/2} \frac{\cos x}{1+\cos x} \, {\rm d}x &=\int_{0}^{\pi/2} \frac{\cos x+1 -1}{1+ \cos x} \, {\rm d}x \\ &= \int_{0}^{\pi/2} \left ( 1 - \frac{1}{1+ \cos x} \right ) \, {\rm d}x \\ &= \frac{\pi}{2} - \int_{0}^{\pi/2} \frac{{\rm d}x}{1+ \cos x} \\ &= \frac{\pi}{2} - \int_{0}^{\pi/2} \frac{{\rm d}x}{2\cos^2 \left ( \frac{x}{2} \right )} \\ &= \frac{\pi}{2} - \left [\tan \frac{x}{2} \right ]_0^{\pi/2} \\ &= \frac{\pi}{2} - \tan \frac{\pi}{4} \\ &= \frac{\pi}{2}-1 \end{align*}

and

\begin{align*} \int_{0}^{\pi/2} \frac{x \cos x}{1+\cos x} \, {\rm d}x &= \int_{0}^{\pi/2} \frac{x (\cos x+1) -x}{1+\cos x} \, {\rm d}x \\ &= \int_{0}^{\pi/2} x \, {\rm d}x - \int_{0}^{\pi/2} \frac{x}{1+ \cos x} \, {\rm d}x\\ &= \left [ \frac{x^2}{2} \right ]_0^{\pi/2} - \int_{0}^{\pi/2} \frac{x}{1+\cos x} \, {\rm d}x\\ &= \frac{\pi^2}{8} - \left [ x \tan \left ( \frac{x}{2} \right ) \right ]_0^{\pi/2} + \int_{0}^{\pi/2} \tan \left ( \frac{x}{2} \right ) \, {\rm d}x \\ &=\frac{\pi^2}{8} - \frac{\pi}{2} - \left [ 2 \log \cos \frac{x}{2} \right ]_0^{\pi/2} \\ &= \frac{\pi^2}{8} - \frac{\pi}{2} - 2 \log \cos \frac{\pi}{4} \\ &= \frac{\pi^2}{8} - \frac{\pi}{2} + \log 2 \end{align*}

since it is well known that $\displaystyle \int \frac{{\rm d}x}{1+ \cos x} = \tan \frac{x}{2}+c, \; c \in \mathbb{R}$ and

$$\int \tan \frac{x}{2} \, {\rm d}x = \int \frac{\sin \frac{x}{2}}{\cos \frac{x}{2}} \, {\rm d}x = -\frac{1}{2}\int \frac{\left ( \cos \frac{x}{2} \right )'}{\cos \frac{x}{2}} \, {\rm d}x = - 2 \log \cos \frac{x}{2} + c , \; c \in \mathbb{R}$$


In the absence of any tricks, it looks feasible to do this integral through integration by parts to eliminate the $x$. I'm guessing there's a typo in the question. Assuming the integral portion is correct, we multiply and divide by $\sec x-\tan x$.

$$\int_0^{\frac\pi2}x(\sec x\tan x-\tan^2x)dx=\int_0^\frac{\pi}2x(\sec x\tan x-\sec^2x+1)dx=$$

$$x(\sec x-\tan x+x)]_0^\frac\pi2-\int_0^\frac\pi2(\sec x-\tan x+x)dx=$$

$$x^2+\frac x{\sec x+\tan x}-(\ln|\sec x+\tan x|+\ln|\cos x|+\frac12x^2)]_0^\frac\pi2=$$

$$\frac12x^2+\frac{x\cos x}{1+\sin x}-\ln|1+\sin x|]_0^\frac\pi2=\frac{\pi^2}8-\ln2$$