Yet another difficult integration question For $r \in (0,1)$ and $k \in \mathbb Z^+$, prove
$$ \frac{1}{\pi} \int_{0}^\pi \ln\left(1 + r \cos(u)\right) \ln \left( 1 + r \cos(3^k u)\right) du = \left(\ln\left(\frac{2(1-\sqrt{1-r^2})}{r^2}\right)\right)^2.$$
Given that for any $n \in \mathbb Z^+$
$$ - \frac{1}{\pi} \int_{0}^\pi \ln\left(1 + r \cos(nu)\right) du = \ln\left(\frac{2(1-\sqrt{1-r^2})}{r^2}\right).$$
In my mind, the strategy should be to use the fact that $\cos(u)$ and $\cos(3^ku)$ are orthogonal. Write $[0,\pi]$ as a product space where $\cos(u)$ and $\cos(3^ku)$ are constant along the (orthogonal) fibres. Then use Fubini's theorem. But I am having difficulty in putting the pieces together. Thanks for your help.


Lemma 1: Let $n \in \mathbb{Z}\backslash\{0\}$ and let $f$ be a function such
  that $f(x+T)=f(x)$ for all $x$. Then $$
     \int_0^T f(nx) \mathrm{d}x =  \int_0^T f(x) \mathrm{d}x  $$

${}$

Lemma 2: Let $f$ be any function such that $\int_0^{\pi} f(x)\,\mathrm{d}x  $ converges, then $$\int_0^{\pi} f(\cos x)\,\mathrm{d}x=\frac{1}{2}\int_0^{2\pi} f(\cos x)\,\mathrm{d}x$$

Using these two results it follows immediately that
\begin{align*}
I_n(r)
& = - \frac{1}{\pi} \int_{0}^\pi \ln\left(1 + r \cos(nu)\right) du \\
& = - \frac{1}{2\pi} \int_{0}^{2\pi} \ln\left(1 + r \cos(nu)\right) du \\
& = - \frac{1}{\pi} \int_{0}^\pi \ln\left(1 + r \cos u\right) du \\
& = I_1(r) = I(r)
\end{align*}
The next step is to differentiate under the integral sign. I will come back to the conditions where this holds, so
\begin{align*}
I'(r) 
= 
- \frac{1}{2\pi} \int_{0}^{2\pi} \frac{\partial }{\partial r} \ln\left(1 + r \cos u\right)\,\mathrm{d}u
= \frac{-1}{2\pi} \int_{0}^{2\pi} \frac{\cos u}{1 + r \cos u}\,\mathrm{d}u
=  \frac{1}{r} - \frac{1}{r\sqrt{1-r^2}}\end{align*}
Also note that $I(0) = 0$, so integrating the above expression from $0$ to $r$ gives
\begin{align*}
\int_0^r I(\tau) \mathrm{d}\tau & = \int_0^r \frac{1}{\tau} - \frac{1}{\tau\sqrt{1-\tau^2}} \mathrm{d}\tau \\
I(r) - I(0) & = \log \left( \frac{2}{r} \right) - \operatorname{arctanh}\left( \frac{1}{\sqrt{1-r^2}} \right)
\end{align*}
This is valid since we assume that $|r|< 1$. Hence
$$
I_n(r)
 = - \frac{1}{\pi} \int_{0}^\pi \ln\left(1 + r \cos(nu)\right) du
 = \log \left( \frac{2}{r} \right) - \operatorname{arctanh}\left( \frac{1}{\sqrt{1-r^2}} \right)
$$
The proof of the second lemma is trivial, and the evaluation of the trigonometric integral can be done something along the lines of 
$$
\frac{1}{r}\int_0^{2\pi} \frac{r\cos x}{1 + r \cos x} \mathrm{d}x 
= \frac{1}{r}\int_0^{2\pi} 1 - \frac{\mathrm{d}x}{1 + r \cos x} 
= \frac{2\pi}{r} - \int_{-\infty}^\infty \frac{2\mathrm{d}u}{(1-r)u^2 + 1+r}
$$
Then use something like $u \mapsto u\frac{1+r}{\sqrt{1-r}}$ to complete the work.
The proof of the first integral is also elementary note 
\begin{align}
          \int_0^{T} f(kx) \mathrm{d}x
 = \frac{1}{k}\int_{0}^{kT} f(x)\mathrm{d}x
 = \frac{1}{k}\sum_{n=0}^{k-1} \int_{nT}^{(n+1)T} f(x)\mathrm{d}x
 = \frac{1}{k}\sum_{n=0}^{k-1} \int_{0}^{T} f(u + nT)\mathrm{d}u
\end{align}
This completes the proof since, $f$ is has a period of $T$ then $f(u+nT)=f(u)$.
Eg intuitively we have $k$ integrals $\int_0^T + \int_T^{2T} + \cdots + \int_{(k-1)T}^{kT}$ equally big. 
