# Using differentiation under integral sign to calculate a definite integral

I want to calculate the integral $$\int^{\pi/2}_0\frac{\log(1+\sin\phi)}{\sin\phi}d\phi$$ using differentiation with respect to parameter in the integral $$\int^{\pi/2}_0\frac{\log(1+a\sin\phi)}{\sin\phi}d\phi$$

I know that I have to solve from differentiate under the integral and I must use a suitable substitution for integrands involving trigonometric functions but I can't complete the solution. Could you help me?

• Do you know the theorem? – Ali Caglayan Oct 26 '14 at 18:02
• Good luck with that choice of parameter. – Gahawar Oct 26 '14 at 18:08
• The integral is equal to $\pi^2/8$, it would seem. – Gahawar Oct 26 '14 at 18:30
• I don't know the purpose of your question, but the integral is easily treated with a Weierstrass substitution and the use of well known series espansions. In my experience (which is, admittedly, limited) when you use differentiation under the integral sign with logarithms you usually run into problems. – Gennaro Marco Devincenzis Oct 27 '14 at 12:40
• @GennaroMarcoDevincenzis Hey!? You're the one on Quora? I didn't know that you're a M.SE user too. Nice to see you here. I saw your ava in OP as a previous editor when I post an answer to this OP 👋≧◉ᴥ◉≦ – Anastasiya-Romanova 秀 Oct 28 '14 at 19:19

Let's consider the integral

Differentiating $I(\alpha)$ with respect to $\alpha$, we have

\begin{align} {I}'(\alpha) &= \int_0^{\Large\frac{\pi}{2}} \frac{\partial}{\partial\alpha} \left(\frac{\ln(1 + \cos\alpha \cos \phi)}{\cos \phi}\right)\,d\phi \\ &=-\int_0^{\Large\frac{\pi}{2}}\frac{\sin \alpha}{1+\cos \alpha \cos \phi}\,d\phi \\ &=-\int_0^{\Large\frac{\pi}{2}}\frac{\sin \alpha}{\left(\cos^2 \frac{\phi}{2}+\sin^2 \frac{\phi}{2}\right)+\cos \alpha\,\left(\cos^2\,\frac{\phi}{2}-\sin^2 \frac{\phi}{2}\right)}\,d\phi \\ &=-\frac{\sin\alpha}{1-\cos\alpha} \int_0^{\Large\frac{\pi}{2}} \frac{1}{\cos^2\frac{\phi}{2}}\frac{1}{\left[\left(\frac{1+\cos \alpha}{1-\cos \alpha}\right) +\tan^2 \frac{\phi}{2} \right]}\,d\phi \\ &=-\frac{2\,\sin\alpha}{1-\cos\alpha} \int_0^{\Large\frac{\pi}{2}}\,\frac{\frac{1}{2}\,\sec^2\,\frac{\phi}{2}}{\left[\,\left(\dfrac{2\,\cos^2\,\frac{\alpha}{2}}{2\,\sin^2\,\frac{\alpha}{2}}\right) + \tan^2\,\frac{\phi}{2} \right]} \,d\phi \\ &=-\frac{2\left(2\,\sin\,\frac{\alpha}{2}\,\cos\,\frac{\alpha}{2}\right)}{2\,\sin^2\,\frac{\alpha}{2}}\,\int_0^{\Large\frac{\pi}{2}}\,\frac{1}{\left[\left(\dfrac{\cos \frac{\alpha}{2}}{\sin\,\frac{\alpha}{2}}\right)^2\,+\,\tan^2\,\frac{\phi}{2}\,\right]}\,d\left(\tan\,\frac{\phi}{2}\right)\\ &=-2\cot \frac{\alpha}{2}\,\int_0^{\Large\frac{\pi}{2}}\,\frac{1}{\left[\,\cot^2\,\frac{\alpha}{2} + \tan^2\,\frac{\phi}{2}\,\right]}\,d\left(\tan \frac{\phi}{2}\right)\,\\ &=-2\,\left.\tan^{-1} \left(\tan \frac{\alpha}{2} \tan \frac{\phi}{2} \right) \right|_0^{\Large\frac{\pi}{2}}\\ &=-\alpha \end{align}

Therefore:

$$I(\alpha) = C - \frac{\alpha^2}{2}$$

However by definition, $I\left(\frac{\pi}{2}\right) = 0$, hence $C = \dfrac{\pi^2}{8}$ and

$$I(\alpha) = \frac{\pi^2}{8}-\frac{\alpha^2}{2}.$$

The integral we want to evaluate is

$$I(0) = \int_0^{\Large\frac{\pi}{2}}\frac{\ln\,(1+\sin\,\phi)}{\sin\,\phi}\;d\phi=\frac{\pi^2}{8}.$$

Define

$$I(a) = \int_0^{\pi/2} d\phi \frac{\log{(1+a\sin{\phi})}}{\sin{\phi}}$$

Then

$$I'(a) = \int_0^{\pi/2} \frac{d\phi}{1+a\sin{\phi}}$$

To evaluate the latter integral, sub $t=\tan{\phi/2}$. Then $d\phi = 2/(1+t^2) dt$ (why?), and $\sin{\phi} = 2 t/(1+t^2)$ (why again?), and the integral is

$$I'(a) = 2 \int_0^1 \frac{dt}{1+t^2} \frac1{1+2 a t/(1+t^2)} = 2 \int_0^1 \frac{dt}{1+2 a t+t^2}$$

This is easily evaluated by completing the square in the denominator:

\begin{align}I'(a) &= 2 \int_0^1 \frac{dt}{(t+a)^2+1-a^2} \\ &= \frac{2}{\sqrt{1-a^2}} \left [\arctan{\frac{t+a}{\sqrt{1-a^2}}} \right ]_0^1 \\ &=\frac{2}{\sqrt{1-a^2}} \left [\arctan{\frac{1+a}{\sqrt{1-a^2}}}- \arctan{\frac{a}{\sqrt{1-a^2}}}\right ]\\ &= \frac{2}{\sqrt{1-a^2}} \arctan{}\frac{\sqrt{1-a^2}}{1+a+a^2} \end{align}

Now we must integrate with respect to $a$. To do this, we integrate over each of the separate terms in the penultimate line. To begin

$$\int da \, \frac{2}{\sqrt{1-a^2}} \arctan{\frac{a}{\sqrt{1-a^2}}}$$

Sub $a=\sin{\theta}$, and it should be straightforward to see that this antiderivative is simply

$$2 \int d\theta \, \theta = \theta^2 = \arcsin^2{a}$$

(Yes I am ignoring the constant of integration for now.)

Now the second piece:

$$\int da \, \frac{2}{\sqrt{1-a^2}} \arctan{\frac{1+a}{\sqrt{1-a^2}}}$$

Sub $a=\cos{\theta}$. Note that the argument of the arctan becomes $\cot{(\theta/2)}$, so the integral becomes

$$-2 \int d\theta \left (\frac{\pi}{2} - \frac{\theta}{2} \right ) = \frac12 \theta^2 - \pi \theta = \frac{\pi}{2} \arcsin{a} + \frac12 \arcsin^2{a}-\frac{3 \pi^2}{8}$$

Including the constant of integration, then,

$$I(a) = \frac12 \theta^2 - \pi \theta = \frac{\pi}{2} \arcsin{a} - \frac12 \arcsin^2{a}-\frac{3 \pi^2}{8} + C$$

Given $I(0)=0$, then $I(a) = \frac{\pi}{2} \arcsin{a} - \frac12 \arcsin^2{a}$. The desired integral is $I(1)$, so that

$$\int_0^{\pi/2} d\phi \frac{\log{(1+\sin{\phi})}}{\sin{\phi}} = \frac{\pi^2}{4} - \frac{\pi^2}{8} = \frac{\pi^2}{8}$$

EDIT

I should have mentioned above that $a$ is restricted to values such that $|a| \le 1$ in the above analysis.

• There is a faster way, put $t=\tan\phi$ we will obtain \begin{align*} I'(a)&=\int_0^\infty\frac{dt}{t^2+2at+1}\\ &=\frac{1}{\sqrt{1-a^2}} \left[\frac{\pi}{2}-\arctan{\frac{a}{\sqrt{1-a^2}}}\right]\\ I(a)&=\frac{\pi}{2}\arcsin a-\arcsin^2 a \end{align*} Nice answer anyway, +1. I was tempted to answer this question but since it's not received enough attention I'd not get lots of upvotes if I answered it. – Anastasiya-Romanova 秀 Oct 28 '14 at 11:09
• @Anastasiya-Romanova: "...but since it's not received enough attention I'd not get lots of upvotes if I answered it." No offense, but that's a silly, shallow reason for not posting a solution. Upvotes be damned: if it's a good solution, post it. – Ron Gordon Oct 28 '14 at 12:47
• But I'm a needy, lol. Oh forgot to mention, $a$ should be restricted: $|a|\le1$ – Anastasiya-Romanova 秀 Oct 28 '14 at 12:57
• @YiorgosS.Smyrlis: the integrand satisfies the conditions for the Leibniz integration rule. See here, for example: en.wikipedia.org/wiki/Differentiation_under_the_integral_sign – Ron Gordon Oct 28 '14 at 13:13
• Mr. @RonGordon I change my mind, I decide to post my answer. Also, I rectify my first comment. You were correct by setting $t=\tan\frac{\phi}{2}$. After substituting, we get \begin{align*} I'(a)&=2\int_0^1\frac{dt}{t^2+2at+1}\\ &=\int_0^\infty\frac{dt}{t^2+2at+1}\\ &=\frac{1}{\sqrt{1-a^2}} \left[\frac{\pi}{2}-\arctan{\frac{a}{\sqrt{1-a^2}}}\right]\\ I(a)&=\frac{\pi}{2}\arcsin a-\arcsin^2 a \end{align*} Sorry... (ㆆ_ㆆ) – Anastasiya-Romanova 秀 Oct 28 '14 at 19:13

We can use the following Taylor expansion $$\begin{eqnarray} \ln(1+x)&=&\sum_{n=1}^\infty\frac{(-1)^{n-1}}{n}x^n. \end{eqnarray}$$ Then $$\begin{eqnarray} \int_0^{\pi/2}\frac{\ln(1+\sin\phi)}{\sin\phi}d\phi&=&\int_0^{\pi/2}\sum_{n=1}^\infty\frac{(-1)^{n-1}}{n}\sin^{n-1}\phi d\phi\\ &=&\sum_{n=1}^\infty\frac{(-1)^{n-1}}{n}\frac{\sqrt{\pi}\Gamma(\frac{n}{2})}{2\Gamma(\frac{n+1}{2})}\\ &=&\frac{\sqrt{\pi}}{2}\sum_{n=1}^\infty\frac{\Gamma(\frac{2n-1}{2})}{(2n-1)\Gamma(n)}-\frac{\sqrt{\pi}}{4}\sum_{n=1}^\infty\frac{\Gamma(n)}{n\Gamma(\frac{2n+1}{2})}\\ \end{eqnarray}$$ Let $$f(x)=\frac{\sqrt{\pi}}{2}\sum_{n=1}^\infty\frac{\Gamma(\frac{2n-1}{2})}{(2n-1)\Gamma(n)}x^{2n}, g(x)=\frac{\sqrt{\pi}}{4}\sum_{n=1}^\infty\frac{\Gamma(n)}{n\Gamma(\frac{2n+1}{2})}x^{2n}.$$ Then $$\left(\frac{f(x)}{x}\right)'=\frac{\sqrt{\pi}}{2}\sum_{n=1}^\infty\frac{\Gamma(\frac{2n-1}{2})}{\Gamma(n)}x^{2n-2}=\frac{\pi}{2\sqrt{1-x^2}}$$ and hence $$f(x)=\frac{\pi}{2} x\arcsin x.$$ Also $$g(x)=\frac{1}{2}\arcsin^2x.$$ So $$f(1)=\frac{\pi^2}{4}, g(1)=\frac{\pi^2}{8}$$ and hence $$\int_0^{\pi/2}\frac{\ln(1+\sin\phi)}{\sin\phi}d\phi=\frac{\pi^2}{8}.$$