# How to integrate$I=\int\ln\left(\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2}\right)\ \mathrm dy$

I am stuck with the integration

$$I=\int\ln\left(\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2}\right)\ \mathrm dy$$

I got this from the question from the book

"Field and wave electromagnetics, Cheng, 2nd, Problem 3-18.

I tried to solve this equation using method of integration by parts, but my equation got worse.

I know the answer by Wolfram Alpha, but I can't get how.

• If you can do $\int \ln(a+(b+cx^2)^{1/2}) dx$, then you can specialize to your context ($a=L/2$,$b=L^2/4+z^2$). Judging by Wolfram's output, it looks like the first step is the "standard" logarithm integration by parts, with $u=\log(a+(b+cx^2)^{1/2})$ and $dv=dx$. Can you work this step out and then show us what you get? – Ian Jun 11 '15 at 3:07
• Alternately, you might begin with a trigonometric substitution: given a right triangle with legs $\sqrt{b}$ and $\sqrt{c}x$, the hypotenuse has length $(b+cx^2)^{1/2}$. So $(b+cx^2)^{1/2}=\sqrt{b} \sec(\theta)$ is a reasonable substitution to start with. Since the final answer involves inverse tangents, this approach is probably also productive. – Ian Jun 11 '15 at 3:11
• Integration isn't my strongest side, but an idea came to mind to add the integral $\int{\ln\left(-\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2}\right)dy}$, such that the resulting integral can be simplified to $\int{\ln\left(y^2+z^2\right)dy}$. I am not sure how to separate this integral into its original form though. – Kwin van der Veen Jun 11 '15 at 3:11
• @Dr.MV Your answer seems fine with me. I can proceed my problem with the help of your aid, without requiring any other materials. – user65452 Jun 11 '15 at 10:55

Following @ClaudeLeibovici, we have

$$I=y\log\left(\frac{L}2+\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}\right)-J$$

where

\begin{align} J&=\int\frac{y^2}{\left(\frac{L}2+\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}\right)\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}}dy\\\\ &=-\int\frac{y^2\left(\frac{L}2-\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}\right)}{(y^2+z^2)\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}}dy\\\\ &=-\frac{L}{2}\int\frac{y^2}{(y^2+z^2)\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}}dy+\int\frac{y^2}{(y^2+z^2)}dy\\\\ &=-\frac{L}{2}\int\frac{1}{\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}}dy+\frac{L}{2}z^2\int\frac{1}{(y^2+z^2)\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}}dy+y-z\arctan(y/z) \\\\ &=K_1+K_2+y-z\arctan(y/z) \end{align}

where in $(1)$

$$K_1=-\frac{L}{2}\int\frac{1}{\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}}dy$$

and

$$K_2=\frac{L}{2}z^2\int\frac{1}{(y^2+z^2)\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}}dy$$

We can easily evaluate $K_1$ by making the substitution $y=\sqrt{\left(\frac{L}{2}\right)^2+z^2}\tan t$. Then,

$$K_1=-\frac{L}{2}\log\left(y+\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}\right)$$

where the term $\sqrt{\left(\frac{L}{2}\right)^2+z^2}$ is an integration constant that we omitted.

We effect the same substitution for $K_2$. Then, we have

\begin{align} K_2&=\frac{L}{2}z^2\int\frac{1}{(y^2+z^2)\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}}dy\\\\ &=\frac{L}{2}z^2\int \frac{\cos t}{\left(\frac{L}{2}\right)^2+z^2\sin^2t}dt\\\\ &=z\arctan\left(\frac{(L/2)\sin t}{z}\right)\\\\ &=z\arctan\left(\frac{(L/2)y}{z\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}}\right)\\\\ \end{align}

Putting it all together reveals

\begin{align} I&=y\log\left(\frac{L}2+\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}\right)\\\\ &-y+z\arctan(y/z)\\\\ &+\frac{L}{2}\log\left(y+\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}\right)\\\\ &-z\arctan\left(\frac{(L/2)y}{z\sqrt{\left(\frac{L}{2}\right)^2+y^2+z^2}}\right) \end{align}

• brilliant... it's just simple substitution and product splitting. – user65452 Jun 11 '15 at 10:18
• @user65452 Wow! Thank you! – Mark Viola Jun 11 '15 at 13:24
• I noticed one minor mistake. In evaluating $K_2$, I got $\frac{L}{2}z^2\int \frac{\cos t}{\left(\frac{L}{2}\right)^2\sin^2t+z^2}dt$. But its result is same, $z\arctan\left(\frac{(L/2)\sin t}{z}\right)$. Can you check? – user65452 Jun 17 '15 at 3:19
• @user65452 That isn't actually a mistake. The term that you wrote is merely an integration constant. It depends only on $z$, not $y$. – Mark Viola Jun 18 '15 at 1:42

Considering $$I=\int\log\left(\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2}\right)\ \mathrm dy$$ what I would first do is to get rid of the logarithm by a first integration by parts $$u=\log\left(\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2}\right)$$ $$du=\frac{y\, dy}{\sqrt{\frac{L^2}{4}+y^2+z^2} \left(\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2}\right)}$$ $v'=dy$, $v=y$ which makes $$I=y \log\left(\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2}\right)- J$$ where $$J=\int\frac{y^2\, dy}{\sqrt{\frac{L^2}{4}+y^2+z^2} \left(\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2}\right)}$$ Now, an apparent change of variable could be $$\frac{L^2}{4}+y^2+z^2=t^2$$ $$y=\frac{1}{2} \sqrt{4 t^2-(L^2+4 z^2)}$$ $$dy=\frac{2 t}{\sqrt{4 t^2-(L^2+4 z^2)}}$$ which makes $$J=\int \frac{\sqrt{4 t^2-(L^2+4 z^2)}}{2t+L}\,dt$$ Again, $2t+L=w$, $t=\frac{w-L}{2}$, $dt=\frac{dw}{2}$ make $$J=\frac 12 \int\frac{\sqrt{w^2-2 L w-4 z^2}}{ w} dw$$ At this point, we find integrals which are given in the Table of Integrals, Series, and Products by I.S. Gradshteyn and I.M. Ryzhik (in the $7^{th}$ edition, look at section $2.267$).

It is effectively quite tedious !

• Thank you for that book, Table of Integrals, Series, and Products. It is truly helpful! – user65452 Jun 11 '15 at 4:54
• You are very welcome ! This book is very useful when you are as lazy as I am ! Be careful : it can help but it does not teach you !! Cheers. – Claude Leibovici Jun 11 '15 at 4:58
• @ClaudeLeibovici It wasn't quite as bad as one might have suspected. – Mark Viola Jun 11 '15 at 5:46
• @Dr.MV. It could have been worse but this was really tedious. – Claude Leibovici Jun 11 '15 at 10:06

This is incomplete. But it's close.

We want $I=\int\ln\left(\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2}\right)\ \mathrm dy$

If we look at $\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2} =\frac{L+\sqrt{L^2+4(y^2+z^2)}}{2}$, this is one of the roots of the quadratic $x^2-Lx-(y^2+z^2) =0$. Since the product of the roots is $-(y^2+z^2)$, if we define $J=\int\ln\left(\frac{L}{2}-\sqrt{\frac{L^2}{4}+y^2+z^2}\right)\ \mathrm dy$, then $I+J =\int\ln(-(y^2+z^2))dy$.

However, the inner expression is negative, so I'll define $J=\int\ln\left(-\frac{L}{2}+\sqrt{\frac{L^2}{4}+y^2+z^2}\right)\ \mathrm dy$. We now get then $I+J =\int\ln(y^2+z^2)dy$. This is, according to Wolfram Alpha, $y (log(y^2+z^2)-2)+2 z tan^{-1}(y/z)$.

What we need now is $I-J$.

The expression in the $\ln$ would be

$\begin{array}\\ \frac{L+\sqrt{L^2+4(y^2+z^2)}}{-L+\sqrt{L^2+4(y^2+z^2)}} &=\frac{L+\sqrt{L^2+4(y^2+z^2)}}{-L+\sqrt{L^2+4(y^2+z^2)}}\\ &=\frac{L+\sqrt{L^2+4(y^2+z^2)}}{-L+\sqrt{L^2+4(y^2+z^2)}} \frac{L+\sqrt{L^2+4(y^2+z^2)}}{L+\sqrt{L^2+4(y^2+z^2)}}\\ &=\frac{L^2+L^2+4(y^2+z^2)+2L\sqrt{L^2+4(y^2+z^2)}}{4(y^2+z^2)}\\ &=\frac{L^2}{2(y^2+z^2)}+1+\frac{L\sqrt{L^2+4(y^2+z^2)}}{2(y^2+z^2)}\\ \end{array}$

Again, according to WA,

$\int \frac{\sqrt{x^2+a}}{x^2+b} dx = \frac{\sqrt{a-b} \tan^{-1}\left(\frac{x \sqrt{a-b}}{\sqrt{b} \sqrt{a+x^2}}\right)}{\sqrt{b}}+\ln(\sqrt{a+x^2}+x)$

This would be enough to get $I-J$, and, from these, $I$ amd $J$.

However, it's late and I'm tired, so I'll stop here.

We can rework the constants to write the integral in the form $$\int\ln\left(b\left(\sqrt{x^2+4}+a\right)\right)dx$$with $a<2$. The constant $b$ can be pulled out.

Set $x=t-\dfrac 1t$ to get $$\int\ln\left(\sqrt{x^2+4}+a\right)dx=\int\ln\left(t+\frac1t+a\right)\left(1+\frac1{t^2}\right)dt.$$

You can decompose and transform the second term by inverting $t$: $$\int\ln\left(t+\frac1t+a\right)\frac1{t^2}dt=-\int \ln\left(\frac1s+s+a\right)ds=\int\ln(s)\,ds-\int \ln\left(s^2+as+1\right)ds.$$ Now, by parts $$\int\ln\left(t^2+at+1\right)dt=\frac12\left(2t+a\right)\ln\left(t^2+at+1\right)-\frac12\int\frac{4t^2+4at+1}{t^2+at+1}dt\\ =\frac12\left(2t+a\right)\ln\left(t^2+at+1\right)-2t+\frac32\int\frac{dt}{t^2+at+1},$$ and finally $$\int\frac{dt}{t^2+at+1}=\frac4{4-a^2}\int\frac{dt}{\left(\dfrac{2t+a}{\sqrt{4-a^2}}\right)^2+1}=\frac1{\sqrt{4-a^2}}\arctan\left(\frac{2t+a}{\sqrt{4-a^2}}\right).$$ All together, $$I(t)=\int\ln\left(t+\frac1t+a\right)dt=\frac12\left(2t+a\right)\ln\left(t^2+at+1\right)-t+\frac3{2\sqrt{4-a^2}}\arctan\left(\frac{2t+a}{\sqrt{4-a^2}}\right)-t\ln(t),$$ and $$\int\ln\left(b\left(\sqrt{x^2+4}+a\right)\right)dx=I\left(-\frac x2+\sqrt{\frac{x^2}4+1}\right)-I\left(-\frac x2-\sqrt{\frac{x^2}4+1}\right)+\ln(b)x.$$

• Quel boulot ! Nice solution. – Claude Leibovici Jun 11 '15 at 10:09
• Le travail c'est la santé ! I tried to make is as simple as possible, but didn't really succeed :( – Yves Daoust Jun 11 '15 at 10:28
• This is brilliant too. There are tones of variation in the method of integration I could use as reference, and this is quite a method. – user65452 Jun 11 '15 at 10:51
• @user65452: thanks for the appraisal. I like the substitution $x=t-1/t$ with radicals. – Yves Daoust Jun 11 '15 at 10:55