How can we show that $\int_{-\infty}^{+\infty}{ke^x\pm1\over \pi^2+(e^x-x+1)^2}\cdot{(e^x+1)^2\over \pi^2+(e^x+x+1)^2}\cdot 2x \,\mathrm dx=k?$

Solution 1:

First note that considering

$$F(k)=\int_{-\infty}^{+\infty}{(ke^x\pm1)\over \pi^2+(e^x-x+1)^2}\cdot{(e^x+1)^2\over \pi^2+(e^x+x+1)^2}\cdot 2x \mathrm dx$$

Let $x \to \log(x)$

$$F(k)=\int_{0}^{+\infty}{(kx\pm1) \over \pi^2+(x-\log(x)+1)^2}\cdot{(x+1)^2\over \pi^2+(x+\log(x)+1)^2}\cdot \frac{2\log(x)}{x} \mathrm dx = k$$

By separating the integrals note that

$$I_1=\int_{0}^{+\infty}{1 \over \pi^2+(x-\log(x)+1)^2}\cdot{(x+1)^2\over \pi^2+(x+\log(x)+1)^2}\cdot \frac{2\log(x)}{x} \mathrm dx=0$$

I could prove it numerically using Matlab. Hence I only show

$$I_2=\int_{0}^{+\infty}{\log(x) \over \pi^2+(x-\log(x)+1)^2}\cdot{(x+1)^2\over \pi^2+(x+\log(x)+1)^2}\cdot \mathrm dx = \frac{1}{2}$$


Consider the function

$$f(z) = \frac{(z-1)^2}{(1-(z+\log z))(1-(z-\log(z))}$$

Integrated around a key-hole contour around the principle branch of the logarithm

$$\log(z) = \log|z|+i\mathrm{Arg}(z)$$

Hence the contour

enter image description here

By taking the limits the smaller circle and the bigger one go to zero hence

$$\int_{-\infty}^{0}\frac{(x-1)^2}{(1-(x+\log|x|+i\pi ))(1-(x-\log|x|-i\pi)}dx+\int_{0}^{-\infty}\frac{(x-1)^2}{(1-(x+\log|x|-i\pi ))(1-(x-\log|x|+i\pi)}dx = 2\pi i\mathrm{Res}(f,1)$$

Convert to the positive limit

$$\int_{0}^{\infty}\frac{(x+1)^2}{(1+x-\log x-i\pi )(1+x+\log x+i\pi)}-\frac{(x+1)^2}{(1+x-\log x+i\pi )(1+x+\log x-i\pi)}dx = 2\pi i\mathrm{Res}(f,1)$$

This magically reduces to our integral

$$\int_{0}^{+\infty}{4\pi \,i \log(x) \over \pi^2+(x-\log(x)+1)^2}\cdot{(x+1)^2\over \pi^2+(x+\log(x)+1)^2}\cdot \mathrm dx = 2\pi i\mathrm{Res}(f,1)$$

Note that

$$\mathrm{Res}(f,1) = \lim_{z \to 1}\frac{(z-1)^3}{(1-(z+\log z))(1-(z-\log(z))} = 1$$

Hence we finally get our result

$$\int_{0}^{+\infty}{\log(x) \over \pi^2+(x-\log(x)+1)^2}\cdot{(x+1)^2\over \pi^2+(x+\log(x)+1)^2}\cdot \mathrm dx = \frac{1}{2}$$


Using the same approach we could show

$$\int^\infty_{-\infty}\frac{dx}{(e^x-x+1)^2+\pi^2}=\frac{1}{2}$$

Solution 2:

Some integrals

  • Let us prove that

$$\boxed{I_0 = \int\limits_{-\infty}^{+\infty}{dz\over\left(e^z-z+1\right)^2+\pi^2} = {1\over2}}$$ Roots of the denominator can be defined from the system $$\begin{cases} z=x+iy\\ \left(e^x\cos y - x + 1 + ie^x\sin y - iy\right)^2 + \pi^2 = 0, \end{cases}$$ $$\begin{cases} z=x+iy\\ \left(e^x\cos y - x + 1\right)^2 - \left(e^x\sin y - y\right)^2 + \pi^2 = 0\\ \left(e^x\cos y - x + 1\right)\left(e^x\sin y - y\right) = 0, \end{cases}$$ $$\begin{cases} z=x+iy\\ e^x\cos y = x - 1\\ \left|e^x\sin y - y\right| = \pi, \end{cases}$$ with the solutions $z=\pm\pi i$ (see also Wolfram Alpha).

So, $$I_0 = 2\pi i\,\mathrm{Res}_{z=\pi i}{1\over\left(e^z-z+1\right)^2+\pi^2} = 2\pi i\lim_{z\to\pi i}{1\over2\left(e^z-z+1\right)\left(e^z-1\right)} = {1\over2}.$$

  • Let us prove that

$$\boxed{I_1 = \int\limits_{-\infty}^{+\infty}{dz\over\left(e^z+z+1\right)^2+\pi^2} = {2\over3}}$$ Roots of the denominator can be defined from the system $$\begin{cases} z=x+iy\\ \left(e^x\cos y + x + 1 + ie^x\sin y + iy\right)^2 + \pi^2 = 0, \end{cases}$$ $$\begin{cases} z=x+iy\\ \left(e^x\cos y + x + 1\right)^2 - \left(e^x\sin y + y\right)^2 + \pi^2 = 0\\ \left(e^x\cos y + x + 1\right)\left(e^x\sin y + y\right) = 0, \end{cases}$$ $$\begin{cases} z=x+iy\\ e^x\cos y + x + 1 = 0\\ \left|e^x\sin y + y\right| = \pi, \end{cases}$$ with the solutions $z=\pm\pi i$ (see also Wolfram Alpha).

Note that the point $z=\pi i$ is a second-order pole, so $$I_1 = 2\pi i\,\mathrm{Res}_{z=\pi i}{1\over\left(e^z+z+1\right)^2+\pi^2} = 2\pi i\lim_{z\to\pi i} {d\over dz}\left({(z-\pi i)^2\over\left(e^z+z+1\right)^2+\pi^2}\right) = {2\over3}.$$ (see also Wolfram Alpha).

  • Let us prove that

$$\boxed{I_2 = \int\limits_{-\infty}^{+\infty}{e^zdz\over\left(e^z-z+1\right)^2+\pi^2} = {1\over2}}$$

Really, $$I_2 = \int\limits_{-\infty}^{+\infty}{e^zdz\over\left(e^z-z+1\right)^2+\pi^2}= \int\limits_{-\infty}^{+\infty}{e^z-1\over\left(e^z-z+1\right)^2+\pi^2}\,dz + I_0$$ $$ = {1\over\pi}\left.\arctan{e^z-z-1\over\pi}\right|_{-\infty}^{+\infty} + {1\over 2} = {1\over2}.$$

  • Let us prove that

$$\boxed{I_3 = \int\limits_{-\infty}^{+\infty}{e^zdz\over\left(e^z+z+1\right)^2+\pi^2} = {1\over3}}$$

Similarly, $$I_3 = \int\limits_{-\infty}^{+\infty}{e^zdz\over\left(e^z+z+1\right)^2+\pi^2}= \int\limits_{-\infty}^{+\infty}{e^z+1\over\left(e^z+z+1\right)^2+\pi^2}\,dz - I_1$$ $$ = {1\over\pi}\left.\arctan{e^z+z-1\over\pi}\right|_{-\infty}^{+\infty} - {2\over 3} = {1\over3}.$$

  • Let us prove that

$$\boxed{I_4 = \int\limits_{-\infty}^{+\infty}{2z(e^z+1)^2\over\left(\left(e^z-z+1\right)^2+\pi^2\right)\left(\left(e^z+z+1\right)^2+\pi^2\right)}\,dx = 0}$$

Really, $$I_4 = \int\limits_{-\infty}^{+\infty}{2z(e^z+1)^2\over\left(\left(e^z-z+1\right)^2+\pi^2\right)\left(\left(e^z+z+1\right)^2+\pi^2\right)}\,dx$$ $$= \int\limits_{-\infty}^{+\infty}{e^z+1\over2}\left({1\over\left(e^z-z+1\right)^2+\pi^2} - {1\over\left(e^z+z+1\right)^2+\pi^2}\right)\,dx$$ $$= {I_2+I_0-I_3-I_1\over2} = {1\over2}\left({1\over2}+{1\over2}-{2\over3}-{1\over3}\right) = 0.$$

  • Let us prove that

$$\boxed{I_5 = \int\limits_{-\infty}^{+\infty}{2ze^z(e^z+1)^2\over\left(\left(e^z-z+1\right)^2+\pi^2\right)\left(\left(e^z+z+1\right)^2+\pi^2\right)}\,dx = 1}$$

The denominator is $$D(z) = \left(\left(e^z+1\right)^2+z^2 +\pi^2 - 2z\left(e^z+1\right)\right) \left(\left(e^z+1\right)^2+z^2+\pi^2 + 2z\left(e^z+1\right)\right)$$ $$= \left(\left(e^z+1\right)^2+z^2+\pi^2\right)^2 - 4z^2\left(e^z+1\right)^2,$$ $$D'(z) = 4\left(e^z+z+1\right)\left(\left(e^z+1\right)^2+z^2+\pi^2\right) -8z\left(e^z+1\right)\left(e^z+z+1\right)$$ $$=4\left(e^z+z+1\right)\left(\left(e^z-z+1\right)^2+\pi^2\right)$$

The point $z=\pi i\ $ is the simple pole. So,

$$I_5 = 2\pi i\,\mathrm{Res}_{z=\pi i}{2ze^z(e^z+1)^2\over\left(\left(e^z-z+1\right)^2+\pi^2\right)\left(\left(e^z+z+1\right)^2+\pi^2\right)}$$ $$ = 2\pi i\,\lim_{z\to\pi i}{2ze^z(e^z+1)^2\over D'(z)} = 1.$$ (see also Wolfram Alpha)

Final calculations

$$I = \int\limits_{-\infty}^{+\infty}{ke^x\pm1\over \pi^2+(e^x-x+1)}\cdot{(e^x+1)^2\over \pi^2+(e^x+x+1)^2}\cdot 2x \mathrm dx$$ $$= kI_5\pm I_4 = k.$$

Finally, $$\boxed{\boxed{I = k}}$$