# Having fun integral $\int_0^{\pi/4} \cos x \arctan(\cos x)\, dx$

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. (>‿◠)✌

Integrate by parts $$\int\cos x\arctan(\cos x)dx$$

$$=\arctan(\cos x)\int\cos x\ dx-\int\left(\frac{d[\arctan(\cos x)]}{dx}\int\cos x\ dx\right)dx$$

$$=\arctan(\cos x)\sin x-\int\left(\frac{-\sin x}{1+\cos^2x}\cdot\sin x\right)dx$$

Now, $$\int\frac{\sin^2x}{1+\cos^2x}dx=\int\frac{2-(1+\cos^2x)}{1+\cos^2x}dx$$

$$=2\int\frac{dx}{1+\cos^2x}-\int dx$$

$$=2\int\frac{\sec^2x\ dx}{2+\tan^2x}-x$$

• Congrats for earning $100$K+ Mr. Lab (ô‿ô) – Anastasiya-Romanova 秀 Sep 28 '14 at 17:18

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.