# How evaluate $\int_0^\infty \frac{\ln^2\;\left|\;\tan\left(\frac{ax}{2}-\frac{\pi}{4}\right)\;\right|}{1+x^2} \;dx$

How evaluate (without using Complex analysis) $$\int_0^\infty \frac{\ln^2\;\left|\;\tan\left(\frac{ax}{2}-\frac{\pi}{4}\right)\;\right|}{1+x^2}\; dx\quad (a\gt0)$$

My Attempt:
I used the expansion of the following functions: $$\ln\left|2\sin(x)\right| \text{ and }\ln\left|2\cos(x)\right|$$ To get the following expansion: $$\ln\;\left|\;\tan\left(\frac{ax}{2}-\frac{\pi}{4}\right)\;\right|=2\sum_{n=1}^\infty (-1)^n \frac{\sin[(2n-1)ax]}{2n-1}$$ Then I expressed the square of the logarithmic function as follows:$$\ln^2\;\left|\;\tan\left(\frac{ax}{2}-\frac{\pi}{4}\right)\;\right|=4\sum_{m=1}^\infty\sum_{n=1}^\infty (-1)^{m+n} \frac{\sin[(2m-1)ax]\sin[(2n-1)ax]}{(2m-1)(2n-1)}$$ And used the formula of the product of two sines, then integrated the following well known integral under the summation sign: $$\int_0^\infty \frac{\cos(bx)}{1+x^2} \;dx$$ And expressed the final result in terms of $$\; \arctan\;\left(\;e^{-a}\;\right)\;$$ but this was not the right answer according to the one evaluated by Complex analysis, which is $$\frac{{\pi}^3}{8}-2\pi\; \arctan^2\;\left(\;e^{-a}\;\right)$$ Any hint for another method or idea?

• It is relevant that $\log|\tan(x/2-\pi/4)| = -i(\arctan(e^{-ix}) - \arctan(e^{ix}) )$ $=-2i(\arctan(e^{\pm ix} ) \mp \pi/4)$ where in the last formula the sign is $+$ if $-\pi/2 < x < \pi/2, -\pi/2 + 2\pi < x < \pi/2 + 2\pi, ...$ and the $-$ sign otherwise. Your stated answer is $2\pi( (\pi/4)^2 - \arctan^2(e^{-a} ))$ which seems to scream to use the observation with the residue theorem. However, by problem statement, it is not allowed. – skbmoore Oct 4 '18 at 17:13
• @skbmoore, thx for the insight. – Wolfdale Oct 4 '18 at 17:34

Using OP's series expansion, we have

\begin{align*} I &= 2 \sum_{m, n \geq 0} \frac{(-1)^{m+n}}{(2m+1)(2n+1)} \int_{0}^{\infty} \frac{\sin[(2m+1)ax]\sin[(2n+1)ax]}{1+x^2} \, dx \\ &= \pi \sum_{m, n \geq 0} \frac{(-1)^{m+n}}{(2m+1)(2n+1)} \left( e^{-a|2m-2n|} - e^{-a(2m+2n+2)} \right). \end{align*}

We will split the sum into several parts and analyze them separately.

• It is straightforward that

$$\sum_{m, n \geq 0} \frac{(-1)^{m+n}}{(2m+1)(2n+1)} e^{-a(2m+2n+2)} = \arctan^2(e^{-a}).$$

• Using the identity $$\frac{1}{(2m+1)(2n+1)} = \frac{1}{(2m-2n)(2n+1)} + \frac{1}{(2n-2m)(2m+1)}$$, we have

\begin{align*} \sum_{m, n \geq 0} \frac{(-1)^{m+n}}{(2m+1)(2n+1)} e^{-a|2m-2n|} &= \sum_{m = 0} \frac{1}{(2m+1)^2} + \sum_{\substack{m, n \geq 0 \\ m \neq n }} \frac{(-1)^{m-n}}{(m-n)(2n+1)} e^{-a|2m-2n|} \\ &= \frac{\pi^2}{8} + \sum_{n \geq 0} \frac{1}{2n+1} \sum_{\substack{k \geq -n \\ k \neq 0}} \frac{(-1)^k}{k} e^{-2a|k|}. \end{align*}

• The last sum can be simplified further: using the fact that $$\frac{(-1)^k}{k}e^{-2a|k|}$$ is an odd function of $$k$$,

\begin{align*} \sum_{n \geq 0} \frac{1}{2n+1} \sum_{\substack{k \geq -n \\ k \neq 0}} \frac{(-1)^k}{k} e^{-2a|k|} &= \sum_{n \geq 0} \frac{1}{2n+1} \sum_{k = n+1}^{\infty} \frac{(-1)^k}{k} e^{-2a|k|} \\ &= \sum_{k = 1}^{\infty} \left( \sum_{n=0}^{k-1} \frac{1}{2n+1} \right) \frac{(-1)^k}{k} e^{-2a|k|}. \end{align*}

Symmetrizing the inner sum, we find that

\begin{align*} \sum_{n=0}^{k-1} \frac{1}{2n+1} = \frac{1}{2} \sum_{\substack{i, j \geq 0 \\ i+j = k-1}} \left( \frac{1}{2i+1} + \frac{1}{2j+1} \right) = \sum_{\substack{i, j \geq 0 \\ i+j = k-1}} \frac{k}{(2i+1)(2j+1)}. \end{align*}

Plugging this back,

\begin{align*} \sum_{n \geq 0} \frac{1}{2n+1} \sum_{\substack{k \geq -n \\ k \neq 0}} \frac{(-1)^k}{k} e^{-2a|k|} &= \sum_{i, j \geq 0} \frac{1}{(2i+1)(2j+1)} (-1)^{i+j+1} e^{-a(2i+2j+2)} \\ &= - \arctan^2(e^{-a}). \end{align*}

Combining altogether, we obtain the desired answer.

• Brilliant sir. The summation technicues used in the 2nd part of your answer are fabulous. – Wolfdale Oct 7 '18 at 15:28
• I'll wait another day and accept your solution. – Wolfdale Oct 7 '18 at 15:28
• Just one inquiry, I got the swapping of indexes step, I got the symmeterizing step, but the last step where you replaced $k$ with $i+j+1$ how did you remove the inner sum? Also, there was a restriction $i+j=k-1$ – Wolfdale Oct 7 '18 at 15:34
• @Wolfdale, I merged the outer sum and the inner sum. This follows by noting that $$\{(i,j) : i,j \geq 0\} = \bigsqcup_{k=1}^{\infty} \{ (i,j) : i,j \geq 0 \text{ and } i+j = k-1 \},$$ where the right-hand side is the disjoint union. (Perhaps it is easier to visualize this from $ij$-plane, where $i+j=k-1$ is the line joining $(0,k-1)$ and $(k-1,0)$ and hence this line sweeps all the lattice points $(i,j)$ with $i,j \geq 0$ exactly once by varying $k$.) – Sangchul Lee Oct 7 '18 at 17:37
• Thx for the clarification. One final question, what is your opinion about using the expantion of $\ln\left|\tan\left(\frac{ax}{2}-\frac{\pi}{4}\right)\right|$, there is a restriction $\frac{-\pi}{2}\lt ax \lt \frac{\pi}{2}$, and we integrated $f(x)$ over $\mathbb {R}^+$? – Wolfdale Oct 7 '18 at 18:32