$\int_{\gamma}f(z)\log\left(\frac{z+1}{z-1}\right)dz = 2\pi i\int_{x=-1}^{x=1}f(x)dx$ on an ellipse I am a self-studier and this is a problem from a course I've been doing. I would appreciate help showing:
$$\int_{\gamma}f(z)\log\left(\frac{z+1}{z-1}\right)dz = 2\pi i\int_{x=-1}^{x=1}f(x)dx$$
where $\gamma$ is an ellipse with foci at $-1$ and $1$ and $f$ is analytic inside and on it.
Initially it asks to show $\left(\frac{z+1}{z-1}\right)\in [-\infty,0]$ iff $z\in[-1,1]$.
This seems OK in that substituting $-1$ and $1$, and then testing $+1/2$ and $-1/2$ show it is $\leq 0$.
Any help would be appreciated. Thanks.
 A: Construct a contour $C$ consisting of the following segments:


*

*an ellipse $\gamma$ of the form $z=a \cos{t} + i \sqrt{a^2-1} \sin{t}$, $a \gt 1$, $t \in [-\pi,\pi]$

*a line segment $z \in [-a,-1-\epsilon)$ just above the real axis

*a semicircle of radius $\epsilon$ and center $z=-1$ above the real axis

*a line segment $z \in [-1+\epsilon,1-\epsilon]$ just above the real axis

*a circle of radius $\epsilon$ centered at $z=1$

*a line segment $z \in [1-\epsilon,-1+\epsilon]$ just below the real axis

*a semicircle of radius $\epsilon$ and center $z=-1$ below the real axis

*a line segment $z \in (-1-\epsilon,-a]$ just below the real axis


$C$ is illustrated in the figure below.

By Cauchy's theorem,
$$\oint_C dz \, f(z) \log{\left ( \frac{z+1}{z-1} \right )} = 0$$
as the integrand is analytic inside of $C$.  We may write out the contour integral in terms of each segment of $C$ listed above.  However, as $\epsilon \to 0$, the integrals about the second, third, fifth, seventh, and eighth segments together vanish.  (Briefly, the second and eighth cancel because they are not along the branch cut, while the integrals about the semicircles vanish as $\epsilon \to 0$.)  
Now, note that along the fourth segment,
$$z+1 = |z+1| e^{i 0}$$
$$z-1 = |z-1| e^{i \pi}$$
and along the sixth segment,
$$z+1 = |z+1| e^{i 0}$$
$$z-1 = |z-1| e^{-i \pi}$$
Then we may write
$$\int_{\gamma} dz \, f(z) \log{\left ( \frac{z+1}{z-1} \right )} + \int_{-1}^1 dx \, f(x) [(\log{|x+1|} + i 0) - (\log{|x-1|} + i \pi)] \\ + \int_1^{-1} dx \, f(x) [(\log{|x+1|} + i 0) - (\log{|x-1|} - i \pi)]= 0$$
Note that the log terms cancel.  The above equation then yields
$$ \int_{\gamma} dz \, f(z) \log{\left ( \frac{z+1}{z-1} \right )} = i 2 \pi \int_{-1}^1 dx \, f(x) $$
as was to be shown.
