Trying to compute an integral using Dirichlet's problem solution I want to compute for $r < 1$ that 
$$ r \cos \phi = \frac{1}{2 \pi} \int_0^{2 \pi} \frac{ (1-r^2) \cos \theta }{1 - 2r \cos( \phi - \theta) + r^2 } d \theta $$
In my notes, it says that the way to show this is by solving the Dirichlet Problem directly for the boundary condition $u_0(z) = x $. How can we do that? 

Note that if in general $f(e^{i\theta})$ is a function defined on $\{|x| = 1\}$ in $\mathbb R^2$, then the function 
$$u(re^{i\phi}) = \frac{1}{2\pi} \int_0^{2\pi} \frac{1 - r^2}{1 - 2r \cos(\phi - \theta) + r^2} f(e^{i\theta}) d\theta $$
defined in $\{|x| \le 1\}$ solves the Dirichlet's problem. That is, $u$ satisfies 
$$\begin{cases} \Delta u = 0 & \\ u|_{\{|x| = 1\}} = f & \end{cases}$$
So if now $f =x$, then in terms of polar coordinate, $f(e^{i\theta}) = \cos \theta$, and we see that $u =x$ (by the uniqueness of the solution of the Dirichlet problem, note $u = x$ is clearly harmonic). So we have for all $1>r$ and $\phi$,
$$r\cos\theta= u(re^{i\phi}) =  \frac{1}{2\pi} \int_0^{2\pi} \frac{(1 - r^2)\cos\theta}{1 - 2r \cos(\phi - \theta) + r^2} d\theta.$$
