TITLE: Having fun integral $\int_0^{\pi/4} \cos x \arctan(\cos x)\, dx$
QUESTION [11 upvotes]: Playing around with the inverse trigonometric function integration, I found a nice closed-form of the following integral

$$\int_0^{\pi/4} \cos x \arctan(\cos x)\, dx=\frac{3\sqrt{2}-1}{4}\pi-\frac{3\sqrt{2}}{2}\arctan\sqrt{2}$$

which numerically agrees with output of Wolfram Alpha. I am wondering, what is the nicest way (or the most complicated way) to obtain the given result. I would love to see how Mathematics SE users prove it. Any method is welcome. Thank you. (>‿◠)✌

REPLY [2 votes]: Integrate by parts:
$$\int cos(x)arctan(cos(x))dx=sin(x)arctan(cos(x))+\int\frac{sin^2(x)}{1+cos^2(x)}dx$$
Rewrite:
$$\int cos(x)arctan(cos(x))dx=sin(x)arctan(cos(x))+\int\frac{2}{1+cos^2(x)}dx-x$$
To obtain this integral, we differentiate $arctan(\alpha tan(x))$, which results in $\frac{\alpha}{cos^2(x)+(\alpha sin(x))^2}$.
So we get:
$$\int \frac{\frac{1}{2}\sqrt{2}}{cos^2(x)+\frac{1}{2}sin^2(x)}dx=arctan\left(\frac{1}{2}\sqrt{2}tan(x)\right)$$
Indefinite integral:
$$\int cos(x)arctan(cos(x))dx=sin(x)arctan(cos(x))+\sqrt{2}arctan(\frac{1}{2}\sqrt{2}tan(x))-x$$
Plugging in the boundaries is left as an exercise to the reader.