TITLE: Integrals from Brasilian Math Olympiad 2019
QUESTION [9 upvotes]: The following integrals are the Brasilian Mathematical Olympiad in 2019.
Show that $\displaystyle\int_1^2\frac{e^x(x-1)}{x(x+e^x)}\,dx=\ln\left(\frac{2+e^2}{2+2e}\right)$ and  $\displaystyle\int_0^{\pi/2}\frac{x\sin(2x)}{1+\cos(2x)^2}\,dx=\frac{\pi^2}{16}$.
I tried to use traditional methods, but these integrals are very difficult. Has someone any suggestion? Thanks a lot.

REPLY [10 votes]: $$\int_1^2\frac{e^x(x-1)}{x(x+e^x)}dx=\int_1^2 \frac{e^x\left(\frac{1}{x}-\frac{1}{x^2}\right)}{1+\frac{e^x}{x}}dx=\ln\left(1+\frac{e^x}{x}\right)\bigg|_1^2 =\ln\left(\frac{1+\frac{e^2}{2}}{1+e}\right)$$

For the second one, let $\frac{\pi}{2}-x=t$ to get:
$$\mathcal J=\int_0^{\pi/2}\frac{x\sin(2x)}{1+\cos^2(2x)}dx=\int_{\pi/2}^0 \frac{\left(\frac{\pi}{2}-t\right)\sin(2t)}{1+\cos^2(2t)}(-dt)\overset{t=x}=\int_0^\frac{\pi}{2}\frac{\left(\frac{\pi}{2}-x\right)\sin(2x)}{1+\cos^2(2x)}dx$$
Now add them up to get:
$$2\mathcal J=\frac{\pi}{2}\int_0^\frac{\pi}{2}\frac{\sin(2x)}{1+\cos^2(2x)}dx\Rightarrow \mathcal J=-\frac{\pi}{8}\arctan(\cos(2x))\bigg|_0^\frac{\pi}{2}=\frac{\pi^2}{16}$$

REPLY [4 votes]: For the second integral, use $\int_a^bf(x) = \int_a^bf(a+b-x)$ and add these together to get $I =$$ \int_0^\frac\pi2 {\frac \pi4\sin(2x)\over1+\cos(2x)^2}$. Substituting with $\cos(2x) = t$ gives the solution easily.