Laplace equation and integral $$ \int_0^{2\pi} \frac{1+3 \sin{\phi}}{a^2-2ar \cos(\theta - \phi) + r^2 } d\phi$$ 
Help me plz ... I have tried to solve this. but I still don't know.
 A: This integral may be evaluated using residue theory.  In this case, convert the integral over $\phi$ to a contour integral over the unit circle in the complex plane, and evaluate the residues of the poles inside the unit circle.  Let $z=e^{i \phi}$, then $d\phi = dz/(i z)$, $\cos{\phi} = (z+z^{-1})/2$, $\sin{\phi} = (z-z^{-1})/(2 i)$.  Then, after some algebra, the above integral becomes
$$\frac{i}{a r} e^{i \theta} \oint_{|z|=1} \frac{dz}{z} \frac{z - i \frac{3}{2} (z^2-1)}{z^2 - \frac{a^2+r^2}{a r} e^{i \theta} z + e^{i 2 \theta}}$$
There are three poles for this integrand: $z=0$, $z=(a/r) e^{i \theta}$, and $z=(r/a) e^{i \theta}$.  We must now evaluate the residues at these poles and evaluate whether these poles lie inside or outside the unit circle.  These residues are found by using the formula
$$\text{Res}_{z=z_k} \left [ \frac{f(z)}{g(z)} \right ] = \frac{f(z_k)}{g'(z_k)}$$
which we may use because the poles are simple.  The residues are as follows:
$$\begin{array}\\z=0 & -\frac{3}{2 a r} e^{-i \theta} \\ z=(a/r) e^{i \theta} & \frac{i}{a r} \frac{1-i \frac{3}{2} \left ( \frac{a}{r} e^{i \theta} - \frac{r}{a} e^{-i \theta}\right )}{\frac{a}{r}-\frac{r}{a}}\\ z=(r/a) e^{i \theta} & \frac{i}{a r} \frac{1-i \frac{3}{2} \left ( \frac{r}{a} e^{i \theta} - \frac{a}{r} e^{-i \theta}\right )}{\frac{r}{a}-\frac{a}{r}} \end{array} $$
The value of the integral is $i 2 \pi$ times the sum of the residues of the poles inside the unit circle.  This means that we must evaluate the cases where $a \lt r$ and $a \gt r$ separately, as one or other of the poles is outside the unit circle according to these conditions.  That is, when $a \lt r$, the sum of the relevant  residues is
$$-\frac{3}{2 a r} e^{-i \theta} + \frac{i}{a r} \frac{1-i \frac{3}{2} \left ( \frac{a}{r} e^{i \theta} - \frac{r}{a} e^{-i \theta}\right )}{\frac{a}{r}-\frac{r}{a}}$$
and when $a \gt r$, the sum of the relevant residues is
$$-\frac{3}{2 a r} e^{-i \theta} + \frac{i}{a r} \frac{1-i \frac{3}{2} \left ( \frac{r}{a} e^{i \theta} - \frac{a}{r} e^{-i \theta}\right )}{\frac{r}{a}-\frac{a}{r}}$$
At this point, I will simply state the result of simplifying the above expressions and multiplying by $i 2 \pi$:
$$\int_0^{2 \pi} d\phi \frac{1+3 \sin{\phi}}{a^2-2 a r \cos{(\theta-\phi)} + r^2} = \begin{cases} \\ 2 \pi \frac{1+3 (a/r) \sin{\theta}}{r^2-a^2} & a \lt r\\ 2 \pi \frac{1+3 (r/a) \sin{\theta}}{a^2-r^2} & a \gt r\end{cases}$$
