# How to use contour method with $\int_0^{\pi} \tan (x) \log \left(\cos ^2(x)\right) dx =0$?

To solve $$\int \tan (x) \log \left(\cos ^2(x)\right) dx$$ one may use the identity:

$$\int f'(x)[f(x)]^n dx = \frac{[f(x)]^{n+1}}{n+1}\, n\neq-1$$ resulting in $$-\frac{1}{4} \log ^2\left(\cos ^2(z)\right)$$

Specifically I would like to use the contour method for principle value $$\int_0^{\pi} \tan (x) \log \left(\cos ^2(x)\right) dx =0$$

I would like to also find if possible the more difficult principle value $$\int_0^{\frac{2\pi}{3}} \tan (x) \log \left(\cos ^2(x)\right) dx =-\frac{1}{4} \log ^2(4)$$

I am trying to use contour integration however there is discontinuity.

The first steps I tried was to find the residues and work out a suitable contour.

I would be grateful if these steps could be shown as in this similar question answered by @dustin here, the function is modified to use the contour method. I also note a similar method was shown on page 160-1 of “Complex Analysis” by Ahlfors, this time using a rectangle.

• Contour integration does not handle indefinite integrals. You should include the bounds in the post, not just in the title Commented Jan 8, 2023 at 15:55
• Contour integration is also quite inappropriate for general bounds. You could maybe do $\int_0^\pi$ here, but $\int_0^{42}$ will be essentially impossible with the contour methods Commented Jan 8, 2023 at 15:56
• @FShrike thank you I will overall the question taking that into account Commented Jan 8, 2023 at 15:57
• The integral diverges. Commented Jan 8, 2023 at 21:27
• @Accelerator Since there's a discontinuity in the integrand at $x=\frac{\pi}{2}$,the integral needs to be evaluated as a principal value integral (see en.wikipedia.org/wiki/Cauchy_principal_value and mathworld.wolfram.com/CauchyPrincipalValue.html). Commented Jan 8, 2023 at 21:29

Contour integration is completely overkill by the way (nevermind tricky to set up). In the same spirit as the now deleted answer, consider that for $$0<\epsilon<\frac{\pi}{2}$$ we have: $$\left(\int_0^{\pi/2-\epsilon}+\int_{\pi/2+\epsilon}^{\pi}\right)\tan(x)\log(\cos^2(x))\,\mathrm{d}x\\\overset{x\mapsto x-\pi/2}{=}-\left(\int_{-\pi/2}^{-\epsilon}+\int_{\epsilon}^{\pi/2}\right)\cot(x)\log(\sin^2(x))\,\mathrm{d}x$$
The integrand is odd, and properly integrable over this interval for every such $$\epsilon$$. The above is then zero, always, so the principal value is zero.