I got an complex integral $\int_{0}^{\pi} \frac {x \sin > x}{1+a^2-2a(\cos x)} $ for $a \ge 1$ and my given contour is a rectangle such that $|Re(z)|\le \pi$ and $0 \le |Im(z)| \le h \to \infty$.
I can rewrite the integral as $\int_{0}^{\pi} \frac {x \sin x}{1+a^2-2a(\cos x)} =1/2\int_{- \pi}^{\pi} \frac {x \sin x}{1+a^2-2a(\cos x)} $ and use the substitution:
$z = e^{ix}$, $\;$ $\cos x = \frac {e^{ix}-e^{-ix}}{2} = \frac {z + \frac {1}{z}}{2}$,$\;$ $dz = ie^{ix}dx$
We then received the expression for $f(z)$ as
$\frac {z(-i)}{1+a^2-a(\frac {1}{z}+z)} $ and we want to find the singularities of this function.
After some algebra, we get that we have two singularities at $z = a$ $\;$ & $\;$$z = \frac {1}{a}$, which are poles of the first order.
To evaluate that integral we are going to use the residue theorem:
$res_a = \lim_{\to a} \frac {z(-i)}{(z-1/a)}= \frac {a(-i)}{(a-1/a)}$
$res_{1/a} = \lim_{\to 1/a} \frac {z(-i)}{(z-a)}=\frac {1/a(-i)}{(-a+1/a)}$
and then $I = 2i\pi (res_a+res_{1/a})$
But this looks like the result if we were integrating around unit circle and I don't understand how that different contour changes the result to $I = \frac {\pi}{2} \frac {Ln(a+1)}{Ln(a)}$, according to my textbook.
I was thinking about plugging the residues back to $z = e^{ix}$, but I don't understand how do I get that '+1', etc.
There was posted the same integral, but I am interested in that different integration contour.
We assume $a \gt 1$ for simplicity. Evaluation of this integral is greatly simplified by using the fact that
$$\frac{\sin{x}}{1+a^2-2 a \cos{x}} = \operatorname{Im}{\left (\frac1{a-e^{i x}} \right )}$$
Thus the integral of interest is
$$\frac12 \operatorname{Im} \int_{-\pi}^{\pi} dx \, \frac{x}{a-e^{i x}} $$
We may use Cauchy's theorem to evaluate the integral. To wit, consider the complex integral:
$$\oint_{C} dz \,\frac{\log{z}}{z (z-a)}$$
where $C$ is the following contour:
where the outer circle is the unit circle, the inner circle has a radius $\epsilon$ that will approach zero. There is a branch cut along the negative real axis - negative because the integral is over $[-\pi,\pi]$.
We may write the above complex integral as a sum of integrals as we parametrize the various pieces of the contour $C$:
$$\begin{align}\oint_{C} dz \,\frac{\log{z}}{z (z-a)} &= \int_{-\pi}^{\pi} dx \, \frac{x}{a-e^{i x}} + e^{i \pi} \int_{1}^{\epsilon} dx \, \frac{\log{x}+i \pi}{x (x+a)} \\ &+ i \epsilon \int_{\pi}^{-\pi} d\phi \, e^{i \phi} \, \frac{\log{\epsilon}+i \phi}{\left ( \epsilon e^{i \phi} \right ) \left ( \epsilon e^{i \phi} -a \right )} + e^{-i \pi} \int_{\epsilon}^1 dx \, \frac{\log{x}-i \pi}{x (x+a)} \end{align}$$
By Cauchy's theorem, the complex integral is zero. We also consider the limit as $\epsilon \to 0$. In this limit, the third integral (about the small circle) behaves as $i (2 \pi/a) \log{\epsilon}$, and we may write
$$\begin{align}\int_{-\pi}^{\pi} dx \, \frac{x}{a-e^{i x}} &= -i \frac{2 \pi}{a} \log{\epsilon} - i 2 \pi \int_{\epsilon}^1 dx \, \frac{dx}{x (x+a)} \\ &= -i \frac{2 \pi}{a} \log{\epsilon} - i \frac{2 \pi}{a} \int_{\epsilon}^{1} \frac{dx}{x} + i \frac{2 \pi}{a} \int_{\epsilon}^{1} \frac{dx}{x+a}\\ &= i \frac{2 \pi}{a} \log{\left ( \frac{1+a}{a} \right )}\end{align}$$
Note that the singular pieces in $\epsilon$ canceled. With this, we may reconstruct the original integral using the pieces at the top. The result is, for $a \gt 1$,
I leave as an exercise for the reader what the value of the integral is when $|a| \lt 1$ or when $a \in \mathbb{C}$.