# Differentiation under integration $\int_0^{\frac{\pi}{2}}\frac{\ln(1+\cos\alpha\cos x)}{\cos x}dx$

Question: Discuss the method of differentiation under the sign of integration. Hence evaluate following integrals: $$(i)\int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx\quad(ii)\int_0^{\frac{\pi}{2}}\frac{\ln(1+\cos\alpha\cos x)}{\cos x}dx\quad\cdots$$

First of all I am confused which parameter I take. Although I tried to take both parameter individually to get some intuition. \begin{align*} I(b) &= \int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx \\ I'(b)&=\frac{d}{db}\int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx\\ I'(b)&=\int_0^{\infty}\frac{\partial}{\partial b}\left(\frac{\ln(1+a^2x^2)}{1+b^2x^2}\right)dx\\ I'(b)&=\int_0^{\infty}-\frac{2x^2b\ln \left(1+a^2x^2\right)}{\left(1+x^2b^2\right)^2}dx \end{align*} Now I feel I choose wrong parameter. Then try again, \begin{align*} I(a) &= \int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx \\ I'(a)&=\frac{d}{da}\int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx\\ I'(a)&=\int_0^{\infty}\frac{\partial}{\partial a}\left(\frac{\ln(1+a^2x^2)}{1+b^2x^2}\right)dx\\ I'(a)&=\int_0^{\infty}\frac{2ax^2}{\left(1+x^2b^2\right)\left(1+a^2x^2\right)}dx \end{align*} Now I am frustrated and think I am missing something or didn't understand the concept.

questions:
$$(1)$$ Actually how to deal with them$$?$$
$$(2)$$ How to choose parameter wisely or assure that I am going right direction because after that partial derivatives those look more ugly to integrate/handle and backtracking isn't possible in Exam Hall$$?$$

• For the second integral your second attempt is okay, proceed to use partial fraction and you're there. The goal when differentiating under the integral sign is to simplify some of the integrand (in this case the logarithm), your first attempt not only complicates the denominator, but also keeps the logarithm in place. // I'm pretty sure your second integral has incorrect bounds, that is a trigonometric function yells for $\pi$. Anyway see here how to solve it (and edit the typo): math.stackexchange.com/a/3263639/515527 after the substitution $\frac{\pi}{2}-x=t$. – Zacky Nov 22 '19 at 17:49
• Thanks @Nyssa Yes it's a typo. I wrongly copy it from my lecture – Dr.Antidode Nov 22 '19 at 18:05

For (i), let

$$I(t)=\int_0^{\infty}\frac{\ln(1+tx^2)}{1+b^2x^2}dx\quad$$

Then,

$$I'(t)=\int_0^{\infty}\frac{x^2}{(1+b^2x^2)(1+tx^2)}dx$$ $$=\frac1{b^2-t}\int_0^{\infty}\left(\frac{1}{1+tx^2}-\frac{1}{1+b^2x^2}\right)dx$$

$$=\frac\pi2\frac1{\sqrt t(b^2-t)} -\frac\pi2\frac1{b(b^2-t)}$$

Thus,

$$I(t)=\frac\pi2 \int_0^t\frac{ds}{\sqrt s(b^2-s)} -\frac\pi2 \int_0^t\frac{ds}{b(b^2-s)}$$ $$=\frac\pi2 \frac1b\ln\frac{b+\sqrt t}{\left|b-\sqrt t\right|}+\frac\pi2 \frac1{b}\ln\frac{\left|b^2-t\right|}{b^2}=\frac\pi{b}\ln\frac{b+\sqrt t}b$$

The original integral is

$$I(a^2)=\int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx =\frac\pi{b}\ln\frac{b+a}b$$

• I compute the definite integral(first) $\frac{1}{\sqrt t}\tan^{-1}(\sqrt t x)+C$ but how to substitute $\infty$ there$?$ @Quanto – Dr.Antidode Nov 22 '19 at 19:20
• @Dr.Antidode - Note $\tan^{-1}\infty = \frac\pi2$. – Quanto Nov 22 '19 at 19:21
• Maybe I am overthink. How can't I notice that$?$ Anyway thanks I will accept your answer. Can you look my answer where I am wrong$?$ And if you have time then can you suggest me some reference to learn technique like that$?$ – Dr.Antidode Nov 22 '19 at 19:24
• @Dr.Antidode - No problem. Thanks. I'll take a look – Quanto Nov 22 '19 at 19:25
• @Dr.Antidode - I simplified my results. We seem to have arrived at the same results. Be mindful that we just assume that both a and b are positive to avoid carrying absolute bracket all over places. – Quanto Nov 22 '19 at 20:32

Using Nyssa's comment I tried like that: \begin{align*} I(a) &= \int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx \\ I'(a)&=\frac{d}{da}\int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx\\ &=\int_0^{\infty}\frac{\partial}{\partial a}\left(\frac{\ln(1+a^2x^2)}{1+b^2x^2}\right)dx\\ &=\int_0^{\infty}\frac{2ax^2}{\left(1+x^2b^2\right)\left(1+x^2a^2\right)}dx\\ &=\int_0^{\infty}\left(\frac{2a}{(a^2-b^2)(1+x^2b^2)}-\frac{2a}{(a^2-b^2)(1+x^2a^2)}\right)dx\\ &=\frac{2a}{a^2-b^2}\frac{1}{b}\arctan(bx)\bigg|_0^\infty -\frac{2a}{a^2-b^2}\frac{1}{a}\arctan(ax)\bigg|_0^\infty\\ &=\frac{\pi}{a^2-b^2}\left(\frac{a}{b}-1\right)=\frac{\pi}{(a-b)(a+b)}\frac{a-b}{b}=\frac{\pi}{b(a+b)} \end{align*} Now we integrate back: \begin{align*} I(a)&=\frac{\pi}b\int\frac{1}{a+b}da\\ &=\frac{\pi}b\ln(a+b)+C\\ I(0)=0\implies C=-\frac{\pi}{b}\ln b \implies I(a)=\frac{\pi}{b}\ln\left(\frac{a+b}{b}\right) \end{align*} For $$(2)$$ I personally now think to choose parameter such a way that it remove $$\ln,\sin^{-1}\cdots$$ stuff. Please correct me If I am wrong. I put my answer as community so that anyone can edited it.

As others have noted, (i) is best done by differentiating with respect to $$a$$; you just need to write $$\frac{x^2}{(1+a^2x^2)(1+b^2x^2)}$$ as a linear combination of $$\frac{1}{1+c^2x^2}$$ with $$c\in\{a,\,b\}$$, use $$\int_0^\infty\frac{dx}{1+c^2x^2}=\frac{\pi}{2c}$$, and integrate $$I^\prime$$ using $$I(0)=0$$.

For (ii), differentiate with respect to $$k:=\cos\alpha$$, so you'll need to evaluate $$\int_0^{\pi/2}\frac{dx}{1+k\cos x}$$ with $$t:=\tan\frac{x}{2}$$. For $$\alpha\in[0,\,\pi)$$, you should find$$\int_0^{\pi/2}\frac{dx}{1+k\cos x}=\frac{\alpha}{\sin\alpha}\implies\int_0^{\pi/2}\frac{\ln(1+k\cos x)dx}{\cos x}=\int_{\pi/2}^\alpha\frac{\alpha^\prime}{\sin\alpha^\prime}\frac{dk^\prime}{d\alpha^\prime}d\alpha^\prime=\frac{\pi^2-4\alpha^2}{8}.$$

• That's great. Thanks @J.G. But suddenly I feel if my question isn't provide those parameter it will hard to pick up,isn't it$?$ – Dr.Antidode Nov 22 '19 at 19:45
• @DrAntidote Well, there's a bit of trial and error. And now I've done this on paper, I've realised we don't need to bring in $k$ at all. The $\alpha$-differentiated integral only needs $t=\tan\frac{x}{2}=\cot\frac{\alpha}{2}\tan\theta$. – J.G. Nov 22 '19 at 19:47

For (ii),

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

Use the standard substitution $$\cos x =\frac{1-t^2}{1+t^2}$$ and $$dx =\frac{2dt}{1+t^2}$$ to evaluate its derivative,

$$I'(\alpha) = \int_0^{\frac{\pi}{2}}\frac{-\sin\alpha \>dx}{1+\cos\alpha\cos x} = \int_0^1\frac{-2\sin\alpha\> dt}{(1-\cos\alpha)t^2+(1+\cos\alpha)}$$

$$= -2\int_0^1 \frac{d(t\tan\frac{\alpha}2)}{(t\tan\frac{\alpha}2)^2+1} =-2\tan^{-1}\left(t\tan\frac{\alpha}2\right)_0^1=-\alpha$$

where $$\tan^2\frac{\alpha}2 = \frac{1-\cos\alpha}{1+\cos\alpha}$$ and $$\tan\frac{\alpha}2 = \frac{\sin\alpha}{1+\cos\alpha}$$ are used. Thus, with $$I(\pi/2) = 0$$,

$$I(\alpha) = \int_{\pi/2}^{\alpha}I'(s)ds = \int_{\pi/2}^{\alpha}(-s)ds = \frac12\left(\frac{\pi^2}4-\alpha^2 \right)$$

• How did you come up with $$\int_0^1\frac{-2\sin\alpha}{(1-\cos\alpha)t^2+(1+\cos\alpha)}dt?$$ Because I am facing trouble to use $\cos x=\frac{1-t^2}{1+t^2}$ where $t=\tan\frac{x}{2}$ to get your expression. – Dr.Antidode Nov 23 '19 at 4:28
• @Dr.Antidode - you substitute $\cos x = \frac{1-t^2}{1+t^2}$ and $dx = \frac{2t}{1+t^2}$ to change variable from $x$ to $t$. You would get the expression when you simplify both numerator and denominator. – Quanto Nov 23 '19 at 4:56