solving integral with complex analysis I have problems with understanding of the evaluation of this integral below. It has been a long a time ago since I had complex analysis.

where $a = (1-\sqrt y )^2$ and $b = (1+\sqrt y )^2$.
Now my question are: How do I substitute in the last 2 steps, how can I calculate the residuals and how do I get from there to answer $1/(1-y)$.
I hope you guys can help me. Thanks a lot!
Van
 A: Note that
$$
\sqrt{(b-x)(x-a)}=\sqrt{\left(\frac{b-a}{2}\right)^2-\left(x-\frac{b+a}{2}\right)^2}\tag{1}
$$
Therefore, we can substitute
$$
x=\frac{b+a}{2}-\frac{b-a}{2}\cos(\theta)\quad\text{so that}\quad\sqrt{(b-x)(x-a)}=\frac{b-a}{2}\sin(\theta)\tag{2}
$$
Furthermore, by the definition of $y$,
$$
\frac{b+a}2=1+y\qquad\text{and}\qquad\frac{b-a}2=2\sqrt{y}\tag{3}
$$
Thus, applying $(2)$ and $(3)$,
$$
\begin{align}
&\int_a^b\frac1x\frac1{2\pi xy}\sqrt{(b-x)(x-a)}\,\mathrm{d}x\tag{4}\\[9pt]
&=\frac1{2\pi y}\int_0^\pi\frac{4y\sin^2(\theta)}{\left(1+y-2\sqrt{y}\cos(\theta)\right)^2}\,\mathrm{d}\theta\tag{5}\\
&=\frac1{4\pi y}\int_{-\pi}^\pi\frac{4y\sin^2(\theta)}{\left(1+y-2\sqrt{y}\cos(\theta)\right)^2}\,\mathrm{d}\theta\tag{6}\\
&=\frac1{4\pi}\int_{-\pi}^\pi\frac{-\left(e^{i\theta}-e^{-i\theta}\right)^2}{\left(1+y-\sqrt{y}\left(e^{i\theta}+e^{-i\theta}\right)\right)^2}\frac{\mathrm{d}e^{i\theta}}{ie^{i\theta}}\tag{7}\\
&=-\frac1{4\pi i}\oint_{|z|=1}\frac{\left(z-\frac1z\right)^2}{\left(1+y-\sqrt{y}\left(z+\frac1z\right)\right)^2}\frac{\mathrm{d}z}{z}\tag{8}\\
&=-\frac1{4\pi i}\oint_{|z|=1}\frac{\left(z^2-1\right)^2}{\left((1+y)z-\sqrt{y}\left(z^2+1\right)\right)^2}\frac{\mathrm{d}z}{z}\tag{9}\\
&=-\frac1{4\pi i}2\pi i\left(\frac1y-\frac{1+y}{y(1-y)}\right)\tag{10}\\[9pt]
&=\frac1{1-y}\tag{11}
\end{align}
$$
Explanation:
$\:\ (5)$: apply $(2)$ and $(3)$
$\:\ (6)$: the integrand is even; double the domain of integration and divide by $2$
$\:\ (7)$: write $\sin(\theta)$ and $\cos(\theta)$ in terms of $e^{i\theta}$
$\:\ (8)$: substitute $z=e^{i\theta}$
$\:\ (9)$: multiply numerator and denominator by $z^2$
$(10)$: residue at $z=0$ is $\frac1y$ and the residue at $z=\sqrt{y}\ $ is $-\frac{1+y}{y(1-y)}$
Note that $(8)$ is the final integral in $(\mathrm{A}.13)$.

Computation of the Residues
The singularities are at $z=0$ and $z=\sqrt{y}$ and $z=\frac1{\sqrt{y}}$.
Since the singularity at $z=0$ is simple, multiply by $z$ and evaluate at $z=0$ to get a residue of $\frac1y$.
For $0\lt y\lt1$, the singularity at $z=\frac1{\sqrt{y}}$ is outside $|z|=1$.
For the singularity at $\sqrt{y}$, substitute $z\mapsto z+\sqrt{y}$ and look near $0$:
$$
\begin{align}
&\frac{\left(z^2+2z\sqrt{y}+y-1\right)^2}{\left((1+y)(z+\sqrt{y})-\sqrt{y}\left(z^2+2z\sqrt{y}+y+1\right)\right)^2}\frac1{z+\sqrt{y}}\\
&=\frac{(1-y)^2-4\sqrt{y}(1-y)z+O(z^2)}{\left((1-y)z-\sqrt{y}z^2\right)^2}\left(\frac1{\sqrt{y}}-\frac{z}{y}+O(z^2)\right)\\
&=\frac{1-\frac{4\sqrt{y}}{1-y}z+O(z^2)}{z^2\left(1-\frac{2\sqrt{y}}{1-y}z+O(z^2)\right)}\frac1{\sqrt{y}}\left(1-\frac{z}{\sqrt{y}}+O(z^2)\right)\\
&=\frac1{z^2\sqrt{y}}\left(1-\frac{z}{\sqrt{y}}-\frac{2\sqrt{y}}{1-y}z+O(z^2)\right)\\
&=\frac1{z^2}\left(\frac1{\sqrt{y}}-\frac{1+y}{y(1-y)}z+O(z^2)\right)\tag{12}
\end{align}
$$
The residue at $\sqrt{y}$ is the coefficient of $\frac1z$, that is $-\frac{1+y}{y(1-y)}$.
