# Integral of Gradshteyn and Ryzhik: $\int_0^\infty\ln(1 + 2e^{-x}\cos t + e^{-2x})\,dx =\frac{\pi^2}6-\frac{t^2}2$

I'm looking for a proof of identity 4.223.3 from Gradshteyn and Ryzhik's Tables of Integrals, Series and Products, namely

$$\int_0^\infty\ln(1 + 2e^{-x}\cos t + e^{-2x})\,dx = \frac{\pi^2}{6} - \frac{t^2}{2} \qquad (\lvert t\rvert < \pi)$$

(I suspect it holds for $$\lvert t\rvert = \pi$$ as well).

Unlike the proceeding formulas 4.223.1 and 4.223.2 for $$\int_0^\infty\ln(1 \pm e^{-x})\,dx$$, its proof does not appear in part 9 of Amdeberhan et al.'s Integrals in Gradshteyn and Ryzhik. The reference in GR is for table 256 of the 1867 work Nouvelles tables d'intégrales définies (large pdf).

One reason I'm interested in the derivation is that the integral looks related to

$$\int_0^\infty \ln(1 - 2xe^{-x} - e^{-2x})\,dx,$$

which is equivalent to the integral asked in a previous unanswered question.

Another approach is to notice that the integral is \begin{align*} & \int_0^{ + \infty } {\log \left| {1 + e^{ - (x + it)} } \right|^2 dx} = 2\int_0^{ + \infty } {\Re \log (1 + e^{ - (x + it)} )dx} \\ & = 2\Re \int_0^{ + \infty } {\log (1 + e^{ - (x + it)} )dx} = 2\Re \int_0^{ + \infty } {\sum\limits_{n = 1}^\infty {( - 1)^{n + 1} \frac{{e^{ - (x + it)n} }}{n}} dx} \\ & = 2\Re \sum\limits_{n = 1}^\infty {\frac{{( - 1)^{n + 1} e^{ - i nt } }}{n}\int_0^{ + \infty } {e^{ - nx} dx} } \\ & = 2\Re \sum\limits_{n = 1}^\infty {( - 1)^{n + 1} \frac{{e^{ - itn} }}{{n^2 }}} = 2\sum\limits_{n = 1}^\infty {( - 1)^{n + 1} \frac{{\cos (nt)}}{{n^2 }}} \end{align*} which is the Fourier series of $$\frac{\pi^2}{6}-\frac{t^2}{2}$$, $$|t|<\pi$$.

Let the given integeral be $$I(t)$$. Differentiating wrt $$t$$,

$$I'(t) = \int_0^{\infty} \frac{-2e^{-x}\sin t}{1+2e^{-x}\cos t+e^{-2x}}dx$$

Substitute $$e^{-x} = y \Rightarrow -e^{-x}dx = dy$$, then

$$I'(t) = -\int_0^1 \frac{2\sin t}{1+2y\cos t +y^2}dy$$

Using $$\sin^2 t + \cos^2 t = 1$$,

$$I'(t) = -2\sin t\int_0^1 \frac{1}{(y + \cos t)^2 + \sin^2 t}dy = -2\sin t\left(\frac{1}{\sin t} \arctan\left(\frac{y + \cos t}{\sin t}\right)\right|_0^1$$

$$\Rightarrow I'(t) = -2\left(\arctan\left(\frac{1 + \cos t}{\sin t}\right) - \arctan\left(\frac{\cos t}{\sin t}\right)\right)$$

With $$1 + \cos t = 2\cos^2 \frac{t}{2}$$, $$\sin t = 2\sin\frac{t}{2}\cos\frac{t}{2}$$ and $$\arctan t = \frac{\pi}{2} - \cot^{-1}t$$, the above expression is

$$I'(t) = -t \Rightarrow I(t) = \frac{-t^2}{2} + c$$

To determine $$c$$, we need to calculate $$I\left(\frac{\pi}{2}\right)$$. From the original integral,

$$I\left(\frac{\pi}{2}\right) = \int_0^{\infty} \ln(1 + e^{-2x})dx = \frac{\pi^2}{24}$$

The above result is available in the linked pdf itself. Thereforce,

$$c = I\left(\frac{\pi}{2}\right) + \frac{1}{2}\left(\frac{\pi}{2}\right)^2 = \frac{\pi^2}{6}$$

Hence,

$$I(t) = \frac{\pi^2}{6} - \frac{t^2}{2}$$

This is really a slight expansion on the comment by Masacroso: If you make the substitution $$\exp(-t) = u,$$ and then differentiate with respect to $$t,$$ you get a rational function integral, which is easy to evaluate. For the starting point, the obvious value is $$t=\frac{\pi}{2},$$ which gets rid of the cosine term.

Note that

\begin{align} I(t)=&\int_0^\infty\ln(1 + 2e^{-x}\cos t + e^{-2x})\,dx \\ =&2Re \int_0^\infty\ln(1+e^{it-x})dx \overset{y=e^{it-x} } =2Re \int_{0}^{e^{it}} \frac{\ln(1+y)}y dy\\ I’(t) =& 2Re\>( i \ln (1+e^{it}))=2Re\> \left(i\ln\left(2\cos\frac t2 e^{i \frac t2}\right)\right)=-t \end{align} Then $$I(t)= I(0)+\int_0^t I’(s)ds = 2\int_0^1 \frac{\ln(1+y)}ydy-\int_0^t s\>ds= \frac{\pi^2}6 -\frac {t^2}2$$

Sketch for possible solution, too long for a comment: suppose we can differentiate under the integral sign, then if $$I(t)$$ is the original integral $$\frac{d}{dt}I(t)=-2\sin t\int_0^{\infty }\frac1{e^x+2\cos t+e^{-x}}\mathop{}\!d x$$

Then setting $$c_t:=2\cos t,\, s_t:=-2\sin t$$ and with the change of variable $$e^x=y$$ you have that

$$\frac{d}{dt}I(t)=s_t\int_1^{\infty }\frac1{y^2+c_t y+1}\mathop{}\!d y$$

Then the last integral is solvable in two different ways depending on the value of $$c_t$$. This would give a closed form for $$\frac{d}{dt}I(t)$$. Now the integral $$I(0)$$ seems attackable, thus you will have finally a first order linear differential equation, what "probably" can be solved explicitly.