# How to evaluate $\int_{0}^{\frac{\pi}{2}} \ln ^{n}(\cos \theta) d \theta, \textrm{ where }n\in \mathbb{N}?$

We are going to find a reduction formula for the integral

$$J_n=\int_{0}^{\frac{\pi}{2}} \ln ^{n}(\cos \theta) d \theta$$

In my post, I had found a reduction formula for the integral $$I_n=\int_{0}^{\infty} \frac{\ln ^{n}\left(1+x^{2}\right)}{1+x^{2}} d x$$ as

$$\boxed{I_n= 2 \ln 2 I_{n-1}+ (n-1)!\sum_{k=0}^{n-2} \frac{2^{n-k}-2}{k!}\zeta(n-k) I_k} \tag*{(*)}$$ Letting $$x\mapsto \tan(\theta)$$, \begin{aligned} I_{n} =\int_{0}^{\frac{\pi}{2}} \frac{\ln ^{n}\left(\sec ^{2} \theta\right)}{1+\tan ^{2} \theta} \cdot \sec ^{2} \theta d \theta &=(-2)^{n} J_n \end{aligned}

Putting $$I_n$$ into (*) yields \begin{aligned} (-2)^{n}J_n&= 2 \ln 2(-2)^{n-1} J_{n-1} + (n-1) !\sum_{k=0}^{n-2} \frac{2^{n-k}-2}{k_ !} \zeta(n-k) (-2)^{k} J_k \\J_n&= -\ln 2 J_{n-1} + (n-1) !\sum_{k=0}^{n-2} \frac{(-1)^{n-k}}{k !} \left(1-\frac{1}{2^{n-k-1}} \right)\zeta(n-k) J_k \end{aligned} For example, \begin{aligned} \int_{0}^{\frac{\pi}{2}} \ln ^{2}(\cos \theta )d \theta&=-\ln 2 J_{1}+\frac{1}{2} \zeta(2) J_{0} \\ &=-\ln 2\left(-\frac{\pi}{2} \ln 2\right)+\frac{1}{2} \zeta(2) J_{0} \\ &=\frac{\pi \ln ^{2} 2}{2}+\frac{\pi^{3}}{24} \end{aligned}

My Question Is there any other closed form for the integral?

• Why a separate post for an integral which is just one substitution away? (You're essentially duplicating a question - I would't be surprised if this one is closed as such.) Commented Feb 28, 2022 at 6:59

We can start with he equality of integrals over $$f(\sin x)$$ and $$f(\cos x)$$ which can be proved by their symmetry, denote $$J_{n} = \int_{0}^{\pi/2} {\ln^{n} (\sin x) \,\mathrm{d}x} = \int_{0}^{\pi/2} {\ln^{n} (\cos x) \,\mathrm{d}x}$$ which is the $$n$$-degree generalized integral. Taking $$u=\sin^{2}\!x$$ in the first integral, or $$u=\cos^{2}\!x$$ in the second one, we have $$J_{n} = \frac1{2^{n+1}} \int_{0}^{1} {\frac{\ln^{n}\!u}{\sqrt{u(1-u)}} \,\mathrm{d}u}$$ Then introduce a parameterized integral involving Beta function \begin{aligned} I(s) & = \int_{0}^{1} {u^{s-1/2}(1-u)^{-1/2} \,\mathrm{d}u} = B\big(s+\tfrac1{2},\tfrac1{2}\big) = \frac{\sqrt{\pi}\Gamma\big(s+\tfrac1{2}\big)}{\Gamma(s+1)} = \frac{\pi\Gamma(2s+1)}{(2^{s}\Gamma(s+1))^{2}} \end{aligned} where recalling duplication formula of Gamma function $$\Gamma(s)\Gamma\big(s+\tfrac1{2}\big) = 2^{1-2s}\sqrt{\pi}\Gamma(2s)$$ thus $$J_{n} = \frac1{2^{n+1}} \frac{\mathrm{d}^{n}I(s)}{\mathrm{d}s^{n}} \bigg|_{s=0} = \frac{\pi}{2^{n+1}} \frac{\mathrm{d}^{n}}{\mathrm{d}s^{n}} \left( \frac{\Gamma(2s+1)}{(2^{s}\Gamma(s+1))^{2}} \right) \biggr|_{s=0}$$ plug-in $$s=0$$, the only required is the value of digamma function $$\psi^{(n)}(1)$$, by which we can obtain the $$n$$-th derivative of log-gamma function. Taking $$n=1,2$$ as instances $$J_{1} = \frac{\pi}{4} \frac{\Gamma(2s+1)}{(2^{s}\Gamma(s+1))^{2}} \big( 2\psi(2s+1) - 2\psi(s+1) - 2\ln2 \big) \biggr|_{s=0} = -\frac{\pi}{2}\ln2$$ and \begin{aligned} J_{2} = \frac{\pi}{8} \frac{\Gamma(2s+1)}{(2^{s}\Gamma(s+1))^{2}} \big( & (2\psi(2s+1) - 2\psi(s+1) - 2\ln2)^{2}\\ & + (4\psi'(2s+1) - 2\psi'(s+1)) \big)\biggr|_{s=0} = \frac{\pi^{3}}{24} + \frac{\pi}{2}\ln^{2}\!2 \end{aligned} where recalling $$\psi^{(n)}(1) = (-1)^{n+1} \Gamma(n+1) \zeta(n+1)$$ to establish the closed form of $$J_{n}$$ which the specific integer values of zeta function.
\begin{align}\int_0^{\frac{\pi}{2}}\ln(\cos(x))^n\mathrm{d}x=&\int_0^{\frac{\pi}{2}}\left.\frac{\partial^n}{\partial t^n}\cos(x)^t\right|_{t=0}\mathrm{d}x\\ =&\left.\frac{\partial^n}{\partial t^n}\left[\int_0^{\frac{\pi}{2}}\cos(x)^t\mathrm{d}x\right]\right|_{t=0}\end{align}
This is a known integral: $$\int_0^{\frac{\pi}{2}}\cos(x)^t\mathrm{d}x=\frac{1}{2}\text{B}\left(\frac{1}{2},\frac{t+1}{2}\right)$$ \begin{align}\int_0^{\frac{\pi}{2}}\ln(\cos(x))^n\mathrm{d}x=&\frac{1}{2}\left.\frac{\partial^n}{\partial t^n}\left[\text{B}\left(\frac{1}{2},\frac{t+1}{2}\right)\right]\right|_{t=0}\end{align} Writing the derivative function of the Beta function in terms of the complete Bell polynomial I'll spare you all the calculations because they are actually quite long and I don't want to write them in LaTeX. The main considerations is that when you take the $$n$$-th derivative of the Beta function you find a Bell polynomial depending on polygamma functions, by calculating at $$t=0$$ you have to calculate $$\psi^{(n)}\left(\frac{1}{2}\right)$$ which can be expressed as an $$\eta$$ function.
We come to the fact that: $$\int_0^{\frac{\pi}{2}}\ln(\cos(x))^n\mathrm{d}x=(-1)^n\cdot\frac{\pi}{2}\cdot B_n\left(\Gamma(1)\eta(1),\Gamma(2)\eta(2),\cdots\Gamma(n)\eta(n)\right)$$ Where $$B_n(a_1,\cdots,a_n)$$ is the $$n$$-th complete Bell polynomial and $$\eta(z)$$ is the Dirichlet eta function