# Integration contour for improper integral $\int^\infty_{-\infty} \frac{dx}{(e^x + 1)(1 + e^{-x-z})}$.

A while ago, I read through a book in solid state physics (Ziman's Electrons and Photons) and, as an algebraic step in the derivation of a formula, the author uses

$$\int_{-\infty}^{\infty}\frac{d\eta}{\{\exp\eta + 1\}\{1 + \exp[-(\eta + z)]\}} = \frac{z}{1 - \exp(-z)}$$

without proof, merely stating the integral is "elementary". Today I used this equation to derive an analytical result in a paper, so I would like to find proof that this evaluation of the integral is correct. By the form of the integrand and the infinite limits of the integral, I guessed that the result should be obtainable with contour integration, but I am struggling to find an appropriate integration contour.

Any suggestions for which contour of integration I should take or even if contour integration is the correct idea to evaluate this integral?

For initial notational ease, let $a = e^{-z}$ and we will consider the indefinite integral $$I = \int \frac{dx}{(e^x + 1)(1 + a e^{-x})}.$$
Observing that $$\frac{1}{(e^x + 1)(1 + a e^{-x})} = \frac{1}{1 -a} \left [\frac{1}{e^x + 1} - \frac{a e^{-x}}{1 + a e^{-x}} \right ],$$ the integral can be rewritten as \begin{align*} I &= \frac{1}{1 - a} \int \frac{dx}{e^x + 1} - \frac{1}{1 - a} \int \frac{ae^{-x}}{1 + a e^{-x}} \, dx\\ &= \frac{1}{1 - a} \int \frac{e^{-x}}{1 + e^{-x}} - \frac{1}{1 - a} \int \frac{ae^{-x}}{1 + a e^{-x}} \, dx. \end{align*} Setting $u = e^{-x}, du = - e^{-x} \, dx$ yields \begin{align*} I &= -\frac{1}{1 - a} \int \frac{du}{1 + u} + \frac{1}{1 - a} \int \frac{a}{1 + au} \, du\\ &= -\frac{1}{1 - a} \ln (1 + u) + \frac{1}{1 - a} \ln (1 + au) + C\\ &= -\frac{1}{1 - a} \ln (1 + e^{-x}) + \frac{1}{1 - a} \ln (1 + ae^{-x}) + C. \end{align*} Rearranging, after setting $a = e^{-z}$, the expression for the integral can be brought into the following form $$I = \frac{1}{1 - e^{-z}} \ln \left (\frac{1 + e^{x + z}}{1 + e^x} \right ) + C.$$
Now for your improper integral, if we note that $$\lim_{x \to \infty} \ln \left (\frac{1 + e^{x + z}}{1 + e^x} \right ) = z,$$ and $$\lim_{x \to -\infty} \ln \left (\frac{1 + e^{x + z}}{1 + e^x} \right ) = 0,$$ then $$\int^\infty_{-\infty} \frac{dx}{(e^x + 1)(1 + e^{-x-z})} = \frac{z}{1 - \exp(-z)},$$ as required.
You don't need to use contour integration, write \begin{align} \int\frac{1}{(e^\eta+1)(1+e^{-\eta-z})}d\eta &= \int\frac{e^\eta}{(e^\eta+1)(e^\eta+e^{-z})}d\eta \\ &= \frac{e^z}{e^z-1}\int\frac{1}{e^\eta+1}d\eta - \frac{1}{e^z-1}\int\frac{1}{e^\eta+e^{-z}}d\eta \\ &= \frac{e^z}{e^z-1}\ln\dfrac{e^\eta+e^{-z}}{e^\eta+1} \end{align} take limit with integral bounds and find the result $\dfrac{z}{1-e^{-z}}$.