# A problem about parametric integral

How to solve the following integral.

$I(\theta) = \int_0^{\pi}\ln(1+\theta \cos x)dx$ where $|\theta|<1$

-

Differentiating under the integral sign yields: $$I'(\theta) = \int^{\pi}_0 \frac{\cos x}{1+ \theta \cos x} dx .$$

So $$\theta I'(\theta) = \int^{\pi}_0 1 - \frac{1}{1+\theta \cos x} dx= \pi - \int^{\pi}_0 \frac{1}{1+\theta \cos x} dx$$

To deal with the last integral, consider \begin{aligned} I & = \int_{0}^{\pi} \frac{1}{a+b\cos{x}}\;{dx} \\& = \int_{0}^{\pi} \frac{1}{a\left(\sin^2\frac{1}{2}x+\cos^2\frac{1}{2}x\right)+b\left(\cos^2\frac{1}{2}x-\sin^2\frac{1}{2}x\right)}\;{dx} \\& =\int_{0}^{\pi}\frac{1}{(a-b)\sin^2\frac{1}{2}x+(a+b)\cos^2\frac{1}{2}x}\;{dx} \\& =\int_{0}^{\pi}\frac{\sec^2{\frac{1}{2}x}}{(a+b)+(a-b)\tan^2\frac{1}{2}x}\;{dx} \\& = 2\int_{0}^{\infty}\frac{1}{(a+b)+(a-b)t^2}\;{dt} \\& = 2\int_{0}^{\infty}\frac{1}{(\sqrt{a+b})^2+(\sqrt{a-b})^2t^2}\;{dt}\\& = \frac{2}{{\sqrt{a^2-b^2}}}\tan^{-1}\bigg(\frac{\sqrt{a-b}}{\sqrt{a+b}}~t \bigg)\bigg|_{0}^{\infty} \\& = \frac{\pi}{\sqrt{a^2-b^2}}.\end{aligned}

Thus, $$\theta I'(\theta) = \pi \left(1 - \frac{1}{\sqrt{1-\theta^2}} \right).$$

You can now do some integration of your own to find $I'(\theta).$

-

Did you try that way?

$I(\theta) = \int_0^{\pi}\ln(1+\theta \cos x)dx$

$I'(\theta) = \int_0^{\pi}\frac{\cos x}{1+\theta \cos x}dx$

$\frac{\cos x}{1+\theta \cos x}=A+\frac{B}{1+\theta \cos x}$

$A+B=0$

$A.\theta=1$

$A=\frac{1}{\theta}$

$B=\frac{-1}{\theta}$

$I'(\theta) = \int_0^{\pi}\frac{\cos x}{1+\theta \cos x}dx=\int_0^{\pi}A+\frac{B}{1+\theta \cos x}dx=\int_0^{\pi}\frac{1}{\theta}+\frac{\frac{-1}{\theta}}{1+\theta \cos x}dx$

$I'(\theta) = \frac{\pi}{\theta}-\frac{1}{\theta}\int_0^{\pi}\frac{1}{1+\theta \cos x}dx$

Do transform $\tan(x/2)=u$

$\cos(x)=\frac{1-u^2}{1+u^2}$

$dx=\frac{2}{1+u^2} du$

I think after that you can handle the problem. If you cannot, please let me know

-

Note that the integrand always changes sign at $x=\frac\pi2$ for $\theta\ne0$. In fact, this is an even, nonpositive function, since $\cos(\pi-x)=-\cos x$ and since, for $r=\theta\cos x$, $|r|<1$ and $\ln(1+r)+$ $\ln(1-r)=$ $\ln(1-r^2)<0$ $\implies$ \eqalign{ \int_0^\pi~\ln\big(1+\theta\,\cos\,x\big)\;dx &= \int_0^\frac\pi2~\ln\big(1+\theta\cos x\big)\;dx + \int_\frac\pi2^\pi~\ln\big(1+\theta\cos x\big)\;dx \\ &= \int_0^\frac\pi2~\ln\big(1-\theta^2\cos^2 x\big)\;dx \le 0 \,, } with equality iff $\theta=0$. Out of perverse curiosity, let us define, slightly more generally (substituting $a$ for 1, $b$ for $\theta$ and $\theta$ for $x$) $$I(a,b)=\int_0^\pi\ln\big(a+b\cos\theta\big)\;d\theta.$$ Then $$\frac{\partial I}{\partial b} =\int_0^\pi \frac{\cos\theta\,d\theta}{a+b\cos\theta} =\frac{\pi}{b}-\frac{a}b\int_0^\pi\frac{d\theta}{a+b\cos\theta} \qquad \text{since} \qquad \frac{b\cos\theta}{a+b\cos\theta} =1-\frac{a }{a+b\cos\theta} .$$ But (thanks to Ragib Zaman): \eqalign{\frac\pi{a} - \frac{b}{a} \, \frac{\partial I}{\partial b} & = \int_0^\pi \frac{d\theta}{a+b\cos{\theta}} \\& = \int_0^\pi \frac{d\theta} {a\left(\sin^2\frac\theta2+\cos^2\frac\theta2\right) +b\left(\cos^2\frac\theta2-\sin^2\frac\theta2\right)} \\& = \int_0^\pi \frac{d\theta} {(a-b)\sin^2\frac\theta2+(a+b)\cos^2\frac\theta2} \\& = \int_0^\pi \frac{\sec^2\frac\theta2\;d\theta} {(a+b)+(a-b)\tan^2\frac\theta2} \\& = 2\int_0^\infty \frac{dt}{(a+b)+(a-b)t^2} \\& = 2\int_0^\infty \frac{dt}{(\sqrt{a+b})^2+(\sqrt{a-b})^2t^2} \\& = \frac{2}{{\sqrt{a^2-b^2}}}~ \left.\tan^{-1} \left( \frac{\sqrt{a-b}}{\sqrt{a+b}}~t \right) \right|_{0}^{\infty} \\& = \frac{\pi}{\sqrt{a^2-b^2}} } so that $$\frac{\partial I}{\partial b} = \frac\pi{b} \left( 1-\frac{a}{\sqrt{a^2-b^2}} \right)$$ or $$I(a,b) = \pi \int \frac{db}{b} - \pi a \int \frac{db}{b \sqrt{a^2-b^2}} \,.$$ For $a>|b|>0$, we can use the substitution $b=a\sin\phi,~db=a\cos\phi\,d\phi$ to continue thus: \eqalign{ I(a,b)&=\pi\ln|b| - \pi a \int \frac{d\phi}{\sin\phi} \\ &=\pi\ln|b| - \pi a \int \csc\phi ~d\phi \\ &=\pi\ln|b| + \pi a ~\ln\, \big| \csc\phi + \cot\phi \big| + c \\ &=\pi\ln|b| + \pi a ~\ln\, \left| \frac{1+\cos\phi}{\sin\phi} \right| + c \\ &=\pi\ln|b| + \pi a ~\ln\, \left| \frac{a}{b} +\sqrt{\left( \frac{a}{b} \right)^2-1} \right| + c \,. } Using $I(a,0)=\pi\,\ln a$, we find that $c$ depends on a limit which exists and is $\ln2$ iff $a=1$, $$\frac{\pi\ln a-c}{a} =\lim_{b\rightarrow0}\,\ln \left| \frac{ \frac{a}{b} +\sqrt{\left( \frac{a}{b} \right)^2-1} }{|b|^{-1/a}} \right| =\lim_{b\rightarrow0}\,\ln \left| b^{1/a-1} \left( a+\sqrt{a^2-b^2} \right) \right|$$ in which case $c=-\pi\ln2$. So for our original problem, $$\int_0^\pi~\ln\big(1+\theta\,\cos\,x\big)\;dx=I(1,\theta) = \pi \ln\frac{1+\sqrt{1-\theta^2}}{2} \,.$$ As already noted, this exists and is nonpositive for $|\theta|<1$. On the other hand we see from the RHS above that the integral is bounded below by $-\pi\ln2\approx-2.17758609030360$. Here is a plot of the solution using sage, with the factor of $\pi$ removed (in blue), and a comparable function (in red) from an earlier erroneous draft:

var('t')
#assume(t != 0)
G = plot(log( (1 + sqrt(1-t^2)) / 2 ), (t, -1, 1), color='blue')
G+= text('log((1 + sqrt(1-t^2)) / 2)', (-.6,-.65), color='blue')
G+= plot(      1 - arcsin(t)/t       , (t, -1, 1), color='red')
G+= text(     '1 - arcsin(t)/t'      , (.85,-.06), color='red')
G#.show(aspect_ratio=1)


In particular, the graph has a minimum of $-\ln2\approx-0.693147180559945$ at $\theta=\pm1$.

To check the endpoint, I computed an approximate numerical integral, which agrees with the above (the tuple gives the integral and error estimates):

numerical_integral(2*log(sin(x)), 0, pi/2)


$\left(-2.17758608788, 1.09713268507 \times 10^{-06}\right)$

-
$$I(a,b) = \pi \ln|b| - \pi\frac{a}{b} \int\frac{db}{\sqrt{a^2-b^2}}$$ this equation should be $$I(a,b) = \pi \ln|b| - \pi a \int\frac{db}{b\sqrt{a^2-b^2}}$$ ???? –  Mathlover Feb 29 '12 at 11:41
Thanks...of course! –  bgins Feb 29 '12 at 13:47