Does this integral have a closed form? I was working with this problem in an exam:
Given $\lambda\in(-1,1)\subset\Bbb R$, find 
$$f
   (\lambda)=\int_{0}^{\pi}\ln\left(1+\lambda \cos x\right)\mathrm{d}x
$$
My try: put $\delta\in (0,1)$ such that $\lambda\in(-\delta,\delta)$. Using the power series of $\ln(1+x)$ and uniform convergence to take $\sum_{n=0}^\infty$ outside $\int_{0}^{\pi}$, finally, I got this:
$$f(\lambda)=-\sum_{k=1}^\infty{(2k-1)!!\over (2k)!!}{\lambda^{2k-1}\over 2k}$$
But I still wonder if there is a closed form for $f(\lambda)?$ And is my solution above right or wrong?
 A: The answer to your integral is 
$$
    f(\lambda) = \pi \ln\left(\frac{1+\sqrt{1-\lambda^2}}{2}\right)
$$
Now to derivation. Given that 
$$
  \int_0^\pi \cos^n(x) \mathrm{d}x = \frac{1+(-1)^n}{2} \frac{\pi}{2^n} \binom{n}{n/2}
$$
Doing the series expansion of the integrand in $\lambda$ and interchanging the order of summation and integration yields:
$$
   f(\lambda) = -\pi \sum_{m=1}^\infty \left(\frac{\lambda}{2}\right)^{2m} \frac{1}{2 m} \binom{2m}{m} = - \pi \int_0^{\lambda} \sum_{m=1}^\infty \frac{x^{2m-1}}{2^m} \binom{2m}{m} \mathrm{d}x
$$
The sum equals 
$$
   \sum_{m=1}^\infty \frac{x^{2m-1}}{2^m} \binom{2m}{m} = \frac{1}{x} \left(\sum_{m=0}^\infty \frac{x^{2m}}{2^m} \binom{2m}{m} -1 \right) = \frac{1}{x} \left(\frac{1}{\sqrt{1-2x^2}} -1 \right) 
$$
Integrating this gives the answer.
A: Here is the outline of a solution using complex analysis.
For $a > 1$, the integral $J_a = \int_0^{\pi} \ln(1 + 2a\cos t + a^2) \, dt$ has the value $2\pi \ln a$, and this integral essentially reduces to yours for an appropriate choice of $a$, but with an extra constant term.
To calculate the value of $J_a$, you can show that it is really $\int_\gamma \ln(a + z)/iz \, dz$ where $\gamma$ is the unit circle, described counterclockwise. To do this, break the integral into the top and bottom semicircle, parametrizing both from $0$ to $\pi$, going from right to left on each semicircle. Then subtract the bottom integral from the top one to obtain $J_a$.
By the residue theorem, the integral is $2\pi i$ times the residue at $0$, which is $(\ln a)/i$.  
An alternative way to compute $J_a$ is to calculate the exact value, using trigonometry, of a Riemann sum with $n$ equally spaced points. This turns out to be: $$2\pi \ln a + \frac{\pi}{n} \ln \left[ \frac{1 + a}{1 - a}(a^{-2n} - 1) \right]$$ which tends to $2 \pi \ln a$. This last calculation is carried out in full in Cours de mathématiques spéciales (1991) by Ramis, Volume 3, p. 207.
Here is an idea for a third solution, though I haven't carried out the details. Integrating under the integral sign gives
$$f'(\lambda) = \int_0^{\pi} \frac{\cos x}{1 + \lambda \cos x} \, dx.$$
Now compute the integral on the right (easier said than done), integrate the resulting function of $\lambda$, and use $f(0) = 0$ to find $f(\lambda)$.
A: Cool question, with some nice answers.
Let's look at using the method suggested at the end of user117487's post, the Feynman trick of differentiating under the integral sign, which happens to be my favourite technique for integration. Note that
$$f'(\lambda) = \int_0^{\pi} \frac{\cos x}{1 + \lambda \cos x} \, \mathrm{d}x,$$
upon which adding and subtracting a certain integral becomes
$$
\lambda \, f'(\lambda) = \pi - \int_0^{\pi} \frac{1}{1 + \lambda \cos x} \, \mathrm{d}x.
$$
Let's evaluate the remaining integral, using the Weierstrass substitution 
\begin{align}
t & = \tan \frac{x}{2}, \\
\cos x & = \frac{1 - t^2}{1 + t^2}, \\
\mathrm{d}x & = \frac{2 \,\mathrm{d}t}{1 + t^2}.
\end{align}
Then the integral is 
$$
\int_0^{\infty} \! \frac{2 \ \mathrm{d}t}{1+\lambda+(1-\lambda)t^2}
$$
Let $$t=\sqrt{\frac{1+\lambda}{1-\lambda}}\ u,$$
then we have
$$
2\sqrt{\frac{1}{1-\lambda^2}} \int_0^{\infty} \! \frac{ \mathrm{d}u}{1+u^2} = \frac{\pi}{\sqrt{1-\lambda^2}}.
$$
From previously, 
$$
f(\lambda) = \pi \log \lambda - \pi \int \frac{\mathrm{d} \lambda}{\lambda\sqrt{1-\lambda^2}}.
$$
The remaining integral is fairly standard, so we obtain
$$
f(\lambda) = \pi \log \left( 1 + \sqrt{1-\lambda^2} \right) + c.
$$
Using the fact that $f(0) = 0$ gives $c=-\pi\log 2$, and we arrive at the same result given by the other posters.
A: $\newcommand{\+}{^{\dagger}}%
 \newcommand{\angles}[1]{\left\langle #1 \right\rangle}%
 \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}%
 \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}%
 \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}%
 \newcommand{\dd}{{\rm d}}%
 \newcommand{\ds}[1]{\displaystyle{#1}}%
 \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}%
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}%
 \newcommand{\fermi}{\,{\rm f}}%
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}%
 \newcommand{\half}{{1 \over 2}}%
 \newcommand{\ic}{{\rm i}}%
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}%
 \newcommand{\isdiv}{\,\left.\right\vert\,}%
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}%
 \newcommand{\ol}[1]{\overline{#1}}%
 \newcommand{\pars}[1]{\left( #1 \right)}%
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}%
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}%
 \newcommand{\sech}{\,{\rm sech}}%
 \newcommand{\sgn}{\,{\rm sgn}}%
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}%
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
$\ds{\fermi\pars{\lambda}
=
\int_{0}^{\pi}\ln\pars{1 + \lambda\cos\pars{x}}\,\dd x:
\ {\large ? }.\qquad\lambda, \delta \in {\mathbb R}\,,
\quad\verts{\lambda} < \delta < 1.\quad}$ It's clear that $\ds{\fermi\pars{\lambda}}$ is an even function of $\ds{\lambda}$ and $\ds{\fermi\pars{0} = 0}$ such that
we calculate

\begin{align}
\fermi\pars{\lambda \not= 0}&=
\int_{0}^{\pi}\ln\pars{1 + \verts{\lambda}\cos\pars{x}}\,\dd x
=\half\int_{-\pi}^{\pi}\ln\pars{1 + \verts{\lambda}\cos\pars{x}}\,\dd x
\\[3mm]&=
\half\int_{\verts{z} = 1 \atop {\vphantom{\Huge A}\verts{{\rm Arg}\pars{z}} < \pi}}
\ln\pars{1 + \verts{\lambda}\,{z^{2} + 1 \over 2z}}\,{\dd z \over \ic z}
\\[3mm]&=-\,\half\,\ic
\int_{\verts{z} = 1 \atop {\vphantom{\Huge A}\verts{{\rm Arg}\pars{z}} < \pi}}
\ln\pars{\verts{\lambda}z^{2} + 2z + \verts{\lambda} \over 2z}\,{\dd z \over z}
\end{align}
  The zeros $\ds{z_{\pm}}$ of $\ds{\verts{\lambda}z^{2} + 2z + \verts{\lambda}}$ are
  given by:
  $$
z_{\pm} \equiv {-1 \pm \root{1 - \lambda^{2}} \over \verts{\lambda}}\,,\qquad
z_{-} < -1\,,\quad -1 < z_{+} < 0
$$

Then,
$$
\fermi\pars{\lambda \not=0}=
-\,\half\,\ic
\int_{\verts{z} = 1 \atop {\vphantom{\Huge A}\verts{{\rm Arg}\pars{z}} < \pi}}
\ln\pars{\bracks{z - z_{-}}\bracks{z - z_{+}}}\,{\dd z \over z}
+\
\overbrace{\half\,\ic
\int_{\verts{z} = 1 \atop {\vphantom{\Huge A}\verts{{\rm Arg}\pars{z}} < \pi}}
\ln\pars{2z \over \verts{\lambda}}\,{\dd z \over z}}
^{\ds{\pi\ln\pars{\verts{\lambda} \over 2}}}
$$

\begin{align}
&\color{#c00000}{\fermi\pars{\lambda\not=0} - \pi\ln\pars{\verts{\lambda} \over 2}}
\\[3mm]&=\half\,\ic\int_{-1}^{z_{+}}{\ln\pars{\verts{x - z_{-}}\verts{x - z_{+}}} + \ic\pi
\over x + \ic 0^{+}}\,\dd x
+
\half\,\ic\int_{z_{+}}^{-1}{\ln\pars{\verts{x - z_{-}}\verts{x - z_{+}}} - \ic\pi
\over x - \ic 0^{+}}\,\dd x
\\[3mm]&=\half\,\ic\int_{-1}^{z_{+}}2\pi\ic\,{\dd x \over x}
=-\pi\ln\pars{\verts{z_{+}}}
=-\pi\ln\pars{1 - \root{1 - \lambda^{2}} \over \verts{\lambda}}
=\color{#c00000}{-\pi\ln\pars{\verts{\lambda} \over 1 + \root{1 - \lambda^{2}}}}
\end{align}

$$\color{#00f}{\large%
\fermi\pars{\lambda}
=
\int_{0}^{\pi}\ln\pars{1 + \lambda\cos\pars{x}}\,\dd x
=-\pi\ln\pars{2 \over 1 + \root{1 - \lambda^{2}}}}\,,\qquad
\lambda \in \pars{-1,1}
$$
A: I have not been able to find the error but, numerically, your formula does not lead to the results provided by Sasha. Using your formula, it seems that the result of the infinite summation is
$$
    f(\lambda) =  \ln\left(\frac{1+\sqrt{1-\lambda^2}}{2}\right) / \lambda
$$
which is not correct.
