Show that $$\int_0^{\frac{\pi}{2}}\ln(\sin^2 x+k^2\cos^2 x)dx=\pi\ln \frac{1+k}{2}$$

This is an exercise from Edwards Treatise on Integral Calculus II pg.188.

What solution to this problem can be given ?

In the chapter in Edwards he introduces the technique of substitution $x\mapsto \frac{\pi}{2}-x$. And proves Euler's formulas $$\int_0^{\frac{\pi}{2}}\ln \sin x dx =\int_0^{\frac{\pi}{2}}\ln \cos x dx=-\frac{\pi}{2}\ln 2$$ The problem can be written as

$$\int_0^{\frac{\pi}{2}}\ln(\tan^2 x+k^2 )dx+2\int_0^{\frac{\pi}{2}}\ln(\cos x)dx=\pi\ln(1+k)-\pi\ln 2$$

Which reduces the question to $$\int_0^{\frac{\pi}{2}}\ln(\tan^2 x+k^2 )dx=\pi\ln(1+k)$$

What proof can people give of this equation ?

The only success I have had is to differentiate with respect to $k$, and the result is easy to evaluate. However, it seems that Edwards has at this stage not discussed that method, (although he lists it as a technique, and there is a chapter on it in part I) so is there another solution ? Of course, these old books may be playing by different rules. And the Tripos type questions dont follow any pedagogical pattern. But I guess I really want to know if someone has another solution.

  • $\begingroup$ Here, you may prefer doing with series manipulation. $\endgroup$
    – Naren
    Jan 8, 2022 at 2:17

3 Answers 3


First of all, we can note that $ \int_{0}^{\frac{\pi}{2}}{\ln{\left(\sin{x}\right)}\,\mathrm{d}x}= \int_{0}^{\frac{\pi}{2}}{\ln{\left(\cos{x}\right)}\,\mathrm{d}x} $, $ \ \ \ \ \left(y=\frac{\pi}{2}-x\right)$

Substracting the RHS from the LHS, then multiplying by $ 2 $, gives $ \int_{0}^{\frac{\pi}{2}}{\ln{\left(\tan^{2}{x}\right)}\,\mathrm{d}x} = 0$.

\begin{aligned}\int_{0}^{\frac{\pi}{2}}{\ln{\left(\tan^{2}{x}+k^{2}\right)}\,\mathrm{d}x}&=k^{2}\int_{0}^{\frac{\pi}{2}}{\int_{0}^{1}{\frac{\mathrm{d}y\,\mathrm{d}x}{\tan^{2}{x}+k^{2}y}}}\\ &=k^{2}\int_{0}^{1}{\int_{0}^{\frac{\pi}{2}}{\frac{\mathrm{d}x\,\mathrm{d}y}{\tan^{2}{x}+k^{2}y}}}\\ &=k^{2}\int_{0}^{1}{\int_{0}^{\frac{\pi}{2}}{\frac{\mathrm{d}x}{\cos^{2}{x}\left(\tan^{2}{x}+k^{2}{y}\right)\left(1+\tan^{2}{x}\right)}}\,\mathrm{d}y}\\ &=k^{2}\int_{0}^{1}{\int_{0}^{+\infty}{\frac{\mathrm{d}x}{\left(x^{2}+k^{2}y\right)\left(1+x^{2}\right)}}\,\mathrm{d}y}\\ &=k^{2}\int_{0}^{1}{\int_{0}^{+\infty}{\left(\frac{1}{\left(1-k^{2}y\right)\left(x^{2}+k^{2}y\right)}-\frac{1}{\left(1-k^{2}y\right)\left(1+x^{2}\right)}\right)\mathrm{d}x}\,\mathrm{d}y}\\ &=k^{2}\int_{0}^{1}{\left(\frac{1}{1-k^{2}y}\int_{0}^{+\infty}{\frac{\mathrm{d}x}{x^{2}+k^2y}}-\frac{1}{1-k^{2}y}\int_{0}^{+\infty}{\frac{\mathrm{d}x}{1+x^{2}}}\right)\mathrm{d}y}\\ &=k^{2}\int_{0}^{1}{\left(\frac{\pi}{2\left(1-k^{2}y\right)}\left(\frac{1}{k\sqrt{y}}-1\right)\right)\mathrm{d}y}\\ &=k\pi\int_{0}^{1}{\frac{\mathrm{d}y}{2\sqrt{y}\left(1+k\sqrt{y}\right)}}\\ &=\pi\int_{0}^{1}{\frac{k}{1+ky}\,\mathrm{d}y}\\ \int_{0}^{\frac{\pi}{2}}{\ln{\left(\tan^{2}{x}+k^{2}\right)}\,\mathrm{d}x}&=\pi\ln{\left(1+k\right)}\end{aligned}

  • 1
    $\begingroup$ In my experience, this method does nothing but hides the use of differentiation under the integral sign. Is we observe closely, they are essentially the same methods. (+1) $\endgroup$ Dec 26, 2021 at 6:31
  • $\begingroup$ @LaxmiNarayanBhandari In my math studies, we've learned and proven the differentiation under the integral sign theorem, then we've learned Fubini theorem and proven it using differentiation under the integral sign. So I agree with you. $\endgroup$
    – CHAMSI
    Dec 26, 2021 at 13:23
  • $\begingroup$ Good answer. I'll just say that it would have been clearer to write that your method relies on the fact that: $$\int_0^{\pi/2}\ln(\tan^2x)\,\mathrm{d}x=0$$To justify the first step $\endgroup$
    – FShrike
    Dec 27, 2021 at 14:53
  • $\begingroup$ @FShrike Yeah, I agree. I'll add it my answer. $\endgroup$
    – CHAMSI
    Dec 27, 2021 at 15:13

I doubt this was the approach Edwards had in mind, but if we make the substitution $u = \tan x$, the integral becomes $$ \begin{align}\int_{0}^{\pi /2}\ln(\sin^2 x+k^2\cos^2 x) \, \mathrm dx &=\int_{0}^{\infty} \frac{\ln \left(\frac{u^{2}+k^{2}}{u^{2}+1} \right)}{1+u^{2}} \, \mathrm du \\ & = \int_{0}^{\infty} \frac{\ln(u^{2}+k^{2})}{u^{2}+1} \, \mathrm du - \int_{0}^{\infty} \frac{\ln(u^{2}+1)}{u^{2}+1} \, \mathrm du. \end{align}$$

And by integrating the function $$f(z) = \frac{\ln(z+ik)}{z^{2}+1}, \quad k>0,$$ around a semicircular contour in the upper half of the complex plane, we find that $$ \int_{-\infty}^{\infty} \frac{\ln(x+ik)}{x^{2}+1} \, \mathrm dx = 2 \pi i \operatorname{Res}[f(z), i] = \pi \ln (i+ik). $$

(The branch cut is entirely in the lower half-plane if we use the principal branch of the logarithm.)

Equating the real parts on both side of the equation, we get $$\frac{1}{2} \int_{-\infty}^{\infty} \frac{\ln(x^{2}+k^{2})}{x^{2}+1} \, \mathrm dx = \pi \ln (1+k).$$

Therefore, $$\int_{0}^{\pi /2}\ln(\sin^2 x+k^2\cos^2 x) \, \mathrm dx = \pi \ln (1+k) - \pi \ln 2 = \pi \ln \left( \frac{1+k}{2} \right).$$

A generalization:

Assume that $k \ge 0$ and $ 0 < \theta < \pi$.

Let $$I(k, \theta) = \int_{-\pi/2}^{\pi/2} \ln \left(\sin^{2}(x)+k \sin(2x) \cos (\theta) +k^{2} \cos^{2}(x)\right) \, \mathrm dx .$$

Then again making substitution $u = \tan x$, we get

$$\begin{align} I(k, \theta) &= \int_{-\infty}^{\infty} \frac{\ln \left(\frac{u^{2}+2ku \cos (\theta) +k^{2}}{u^{2}+1} \right)}{u^{2}+1} \, \mathrm du \\ &= \int_{-\infty}^{\infty} \frac{\ln(u^{2}+2ku \cos (\theta) + k^{2})}{u^{2}+1} \, \mathrm du - 2 \pi \ln 2 \\ &= \pi \ln (1+2k \sin (\theta) +k^{2}) - 2 \pi \ln 2 \\ &= \pi \ln \left( \frac{1+2k \sin (\theta) +k^{2}}{4} \right). \end{align}$$

An evaluation of the integral on the second line using contour integration can be found here.


There is a quite low-level elementary solution. Using some trigonometric identities and change of variable, we obtain \begin{multline*} \int\limits_0^{\frac \pi 2} \ln(\sin^2 x + k^2\cos^2x)\,dx = \int\limits_0^{\frac \pi 2} \ln\Big(\frac{1-\cos 2x}2+ k^2\frac{1+\cos 2x}2\Big)\,dx = \\ \frac 12 \int\limits_0^\pi \ln\Big(\frac{1-\cos t}2+ k^2\frac{1+\cos t}2\Big)\,dt = \frac 14 \int\limits_0^{2\pi} \ln\Big(\frac{1+k^2}2-\frac{1-k^2 }2\cos t\Big)\,dt. \end{multline*}

Suppose that $0 < k < 1$. Then we have an integral of a continuous function, which equals to the limit of its Riemann sums: \begin{multline*} \frac 14 \int\limits_0^{2\pi} \ln\Big(\frac{1+k^2}2-\frac{1-k^2 }2\cos t\Big)\,dt = \frac \pi{2n} \lim\limits_{n\to\infty} \sum\limits_{j=0}^{n-1}\ln\Big(\frac{1+k^2}2-\frac{1-k^2 }2\cos \frac{2\pi j}n\Big) =\\ \frac \pi{2n} \lim\limits_{n\to\infty} \ln \prod\limits_{j=0}^{n-1}\Big(\frac{1+k^2}2-\frac{1-k^2 }2\cos \frac{2\pi j}n\Big) = \frac \pi{2n} \lim\limits_{n\to\infty} \ln \prod\limits_{j=0}^{n-1}\Big(a^2 - 2ab\cos \frac{2\pi j}n + b^2\Big), \end{multline*} where $a = \frac{1+k}{2}$, $b = \frac{1-k}{2}$. Applying the algebraic identity $$ \prod\limits_{j=0}^{n-1}\Big(a^2 - 2ab\cos \frac{2\pi j}n + b^2\Big) = (a^n - b^n)^2, $$ we finally get $$ \frac \pi{2n} \lim\limits_{n\to\infty} \ln (a^n - b^n)^2 = \frac \pi{n} \lim\limits_{n\to\infty} \ln \Big(\Big(\frac{1+k}2\Big)^n - \Big(\frac{1-k}2\Big)^n\Big) = \pi \ln \frac{1+k}2. $$

  • $\begingroup$ Very nice original solution. $\endgroup$ Dec 27, 2021 at 19:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .