# How can one solve this integral analytically?

Integrals of the following form show up frequently in Physics, especially in electrodynamics. I have the following integral that I have no idea how to approach solving it:

$$\int_{-\infty}^{\infty}\left[\frac{1}{\sqrt{(x-x')^2+(y-a)^2+z^2}}-\frac{1}{\sqrt{x'^2+a^2}}\right]dx'.$$

I can solve each of them separately, or look them up in table integrals, but, the caveat is that separately, the integrals diverge, but as a whole, the integral converges. The only way I have been able to solve this is via Walfram Alpha and only with numbers--that is, replacing $z^2$ by 4 say and trying to figure out what goes where in the final answer.

I would love for someone to guide me as to how I can solve this integral exactly on paper. Additionally, could someone explain why the integral diverges when analyzed separately compared to when analyzed as a whole? This seems to break the general rule:

$$\int_a^b[f(x)+g(x)]dx=\int_a^bf(x)dx+\int_a^bg(x)dx.$$

[Perhaps some condition such as smoothness or continuity of functions is being broken in the presented case, but I am not sure.]

• $dx'$ is the integration variable. $x$, $y$, $z$, and $a$ are constants with respect to this integration. – Ptheguy Feb 15 '18 at 18:35
• @Moo that means integrating with respect to $x'$. – Botond Feb 15 '18 at 18:36
• You can find the indefinite integral by trigonmetric substitution, but I don't know if that will help you find your improper integral. – Jonathan Feb 15 '18 at 18:37
• The splitting rule is not broken, it simply holds iff the two functions are both singularly integrable, that is if the two separated integrals both converge. – Turing Feb 15 '18 at 18:37
• @VonNeumann, Do you mind explaining singularly integrable. Does it mean they each individually converge? – Ptheguy Feb 15 '18 at 18:39

To find $$\int \frac{1}{\sqrt{u^2+a^2}} du$$ (a > 0), let $x = a \tan \theta$, Then $dx = a \sec^2 \theta d \theta$, and $\sqrt{u^2+a^2} = a \sec \theta$ (here we are using the identity $\sec^2 \theta = 1 + \tan^2 \theta$). This transforms the integral to $$\int \frac{a \sec^2 \theta}{a \sec \theta} d \theta = \int \sec \theta d \theta = \ln | \sec \theta + \tan \theta| = \ln | \frac{\sqrt{u^2+a^2}}{a}+\frac{u}{a}| + C.$$ Furthermore, properties of logs allow as to slurp the $a$'s in the denominator into the $+C$, so $$\int \frac{1}{\sqrt{u^2+a^2}} du = \ln | \sqrt{u^2+a^2}+u|+C$$

Now if we let $b = \sqrt{(y-a)^2+z^2}$, this and a simple substitution gives that your indefinite integral is equal to $$\ln | \sqrt{(x'-x)^2+b^2}+x'-x|-\ln|\sqrt{x'^2+a^2}+x'| + C = \ln|\frac{\sqrt{(x'-x)^2+b^2}+x'-x}{\sqrt{x'^2+a^2}+x'}| +C.$$ So if $f(x')$ is this expression, we want $\lim_{x' \to \infty} f(x') - \lim_{x' \to -\infty} f(x')$. It's a standard Calc I exercise to show that $\lim_{x' \to \infty} f(x') = \ln(1)=0$. To find $\lim_{x' \to -\infty} f(x')$ multiply the top and bottom by the conjugates of both the top and bottom to get $$f(x') = \ln|\frac{b^2}{a^2} \frac{\sqrt{x'^2+a^2} - x'}{\sqrt{(x'-x)^2+b^2}-(x'-x)}|.$$ Again the Calc I technique shows that $\lim_{x' \to -\infty} f(x') = \ln\frac{b^2}{a^2}$.

So your over answer is $-\ln(\frac{b^2}{a^2}) = 2 \ln(\frac{a}{b})= 2 \ln \frac{a}{\sqrt{(y-a)^2+z^2}}$.

To answer your second question, improper integrals are defined in terms of limits, and the limit law $$\lim_{x \to a} (f(x)+g(x))=\lim_{x\to a} f(x) + \lim_{x \to a} g(x)$$ only holds when both $\lim_{x\to a} f(x)$ and $\lim_{x\to a} g(x)$ exist.

• Thank you for such a detailed explanation – Ptheguy Feb 16 '18 at 0:45

FOREOWRD: this answer doesn't represent a proper answer to the above question because instead of $x'^2 + a^2$ I wrote $x'^2 - a^2$. Yet I find it "cool and useful" and I will leave it here the same. I will however provide for another answer about the second terms of the integral.

Before a numerical analysis, it's better to rewrite it in another way.

Let's define:

$$(x-x') = p$$

$$(y-a)^2 + z^2 = k^2$$

$$x'^2 - a^2 = (x'+a)(x'-a) = (x-p+a)(x-p-a) = -(p-a+x)(-p-a-x) = p^2 - c^2$$

Where $c = a+x$

Hence

$$-\int_{-\infty}^{+\infty} \left[\frac{1}{\sqrt{p^2 + k^2}} - \frac{1}{\sqrt{p^2-c^2}}\right]dp$$

The indefinite integrals, separately, are trivial:

$$\int \frac{1}{\sqrt{p^2 + k^2}}\ dp = \log \left(\sqrt{k^2+p^2}+k\right)$$

$$\int \frac{1}{\sqrt{p^2-c^2}}\ dp = \log \left(\sqrt{k^2+p^2}+p\right)$$

Which shows you why they are separately divergent.

The the indefinite integral of them both is:

$$-\int \left[\frac{1}{\sqrt{p^2 + k^2}} - \frac{1}{\sqrt{p^2-c^2}}\right]dp = \log \left(\sqrt{p^2-c^2}+p\right) - \log \left(\sqrt{k^2-c^2}+p\right)$$

The problem now is: What are $c$ and $k$?

From how we defined it, $k$ is surely always positive, and it also doesn't cause problems.

But $c$, well $c = a+x$, and we don't know if it's always positive. Also it appears as $-c^2$ hence $p^2 - c^2 \geq 0$ is required to use log unifying property.

We also need $p$ such that the two logarithm arguments will be strictly positive.

Why am I telling you all this? Because log of negative argument "exist" in the comple field, but we couldn't use the usual properties. This is why we cannot say anything a propri, unless we make strong assumptions.

Anyway, assuming it is all good, we can write the result as

$$\log\left(\frac{\sqrt{p^2 - c^2} + p}{\sqrt{p^2 + k^2} + p}\right)$$

Evaluating it as $p\to \pm \infty$ we easily find

$$\to 0 ~~~~~~~ \text{for} ~~ p\to +\infty$$ $$\to \log \left(-\frac{c^2}{k^2}\right) ~~~~~~~ \text{for} ~~ p\to -\infty$$

The final result is anyway complex.

• Don't you want $x'^2+a^2$ instead of $x'^2-a^2$? – Jonathan Feb 15 '18 at 19:08
• @JonathanBrown Damn. I messed all up. – Turing Feb 15 '18 at 19:10
• @VonNeumann, so does that mean this solution is not correct? A complex final answer is a bit weird since this integral represents the potential of two infinitely long wires :) – Ptheguy Feb 15 '18 at 21:03
• @Ptheguy My final answer is not correct because at the beginning I messed up a sign. That sign is what will make the final result real, as Jonatan Brown showed you here down. I left the answer because for someone it may come helpful (for other purposes), but please: up vote and accept Jonatan's one because it's complete and correct! – Turing Feb 15 '18 at 22:27