Deduce $\int _ { 0 } ^ { \pi } \ln \left( x ^ { 2 } - 2 x \cos \theta + 1 \right) \mathrm { d } \theta$ for $x \in \mathbb { R } \backslash \{ - 1,1 \}$.