# What tricks to integrate this $\int_0^\pi\mathrm{d}u\int_0^\pi\mathrm{d}v\cos{mu}\cos{nv}\ln|u-v|$?

In a famous paper I have been reading, I attempted to solve this integral in Appendix A

\begin{align} I_{mn}=\int_0^\pi\mathrm{d}u\int_0^\pi\mathrm{d}v\cos(mu)\cos(nv)\ln\left(\left\vert u-v\right\vert\right) \end{align} where $$m,~n\in\mathbb{Z}$$ and $$|m|+|n|>0$$, i.e., at least one is non-zero.

But neither IBP nor substitute $$x=\ln|u-v|\implies|u-v|=e^x$$ can be useful at all. I saw that the author Molin used this expansion of $$\ln$$ function

$$\ln|u-v|=\lim_{\epsilon\to0}\Bigl[\ln\epsilon+\int_0^\infty\frac{\mathrm{d}k}{k}e^{-k\epsilon}[1-\cos{k(u-v)}]\Bigr]$$, which is another mysterious $$\ln(x)$$ expansion I never seen before (my Math Handbook has 4 different ones).

Has anyone knew the techniques applied here?

• Man that log expansion is wild. Commented Apr 24 at 19:04
• This is probably not a technique to be applied ‘à la carte’. Your link doesn't lead to a particular website (you'd have to change it or reference the source) but it's quite likely that this approximation to the logarithm depends on the physical situation involved.
– Foxy
Commented Apr 24 at 19:07
• @Foxy, The link was fixed. Thanks for your reminding. Commented Apr 25 at 5:41
• Your function to integrate does not employ $n$ at all, maybe you forgot it somewhere. Commented Apr 25 at 5:57
• Mathematica can compute this double integral. Commented Apr 25 at 8:01

There is a solution involving the functions cosine integral (Ci) and sine integral (Si). I will be also skipping most of the hard work and show you only the main idea how to tackle this.

I assume that you meant this: $$\int_0^\pi\int_0^\pi\cos(mv)\cos(nv)\ln|u-v| \mathrm{d}u \mathrm{d}v$$ I replaced the second $$m$$ by $$n$$, maybe you meant it this way, otherwise the symbol $$n$$ would not be used anywhere in your formula. If you really meant it the way you wrote it, then just put $$n=m$$ and you get it too.

First note that cosine is an even function, so the signs of $$m$$ and $$n$$ do not matter. For simplicity, we will assume both to be positive.

At first, let's get rid of the absolute value: $$I_{mn} = \int_0^\pi\int_0^u\cos(mv)\cos(nv)\ln(u-v) \mathrm{d}u \mathrm{d}v + \int_0^\pi\int_u^\pi\cos(mv)\cos(nv)\ln(v-u) \mathrm{d}u \mathrm{d}v = I_1 + I_2$$ Let's take the first integral only. You can do the other one analogically. We can use a formula to get rid of the multiplication of cosines. From now on, I will be using the symbol $$D$$ to denote the area of the triangle we integrate in. $$I_1 = \frac12 \iint_D \bigl(\cos(mu-nv) + \cos(mu+nv)\bigr)\ln(u-v) \mathrm du \mathrm dv$$ Now we transform the coordinates in a way so $$mu-nv$$ becomes $$x$$ and $$mu+nv$$ becomes $$y$$. We also have to recalculate the points of the triangle $$D$$. I will let that for you, it should not be a problem, just takes a lot of paper. I will note the transformed triangle as $$D'$$. Here are the important formulae for the transform: $$x = mu - mv\\ y = mu + mv\\ u = \frac{x+y}{2m}\\ v = \frac{-x+y}{2m}\\ J = \frac1{2mn}$$ That way, you get: $$I_1 = \frac{1}{4mn}\iint_{D'}(\cos x + \cos y)\ln \frac{(n+m)x + (n-m)y}{2mn} \mathrm dx \mathrm dy =\\= \frac{1}{4mn}\iint_{D'}\cos x \ln \frac{(n+m)x + (n-m)y}{2mn} \mathrm dx \mathrm dy + \frac{1}{4mn}\iint_{D'}\cos y\ln \frac{(n+m)x + (n-m)y}{2mn} \mathrm dx \mathrm dy = \frac{1}{4mn}(I_{1a} + I_{1b})$$ To calculate these two integrals, you first integrate the functions by the axis which is used only inside the logarithm. So you integrate the term inside $$I_{1a}$$ by $$y$$ and the term $$I_{1b}$$ by $$x$$. I will skip this step, as this should be straightforward.

After you do this, you still need to integrate the terms by the other axis. You get terms such as $$\cos x\ln(ax+b)$$ and $$x\cos x\ln(ax+b)$$, where $$a$$ and $$b$$ are some constants which pop up from the previous steps. Now I show you how to integrate these terms. We perform per-partes on both of them: $$\int \cos x\ln(ax+b) \mathrm dx = \sin x \ln(ax+b) - \int \frac{\sin x}{ax + b} \\ \int x\cos x\ln(ax+b) \mathrm dx = (x\sin x+\cos x) \ln(ax+b) - \int \frac{x\sin x+\cos x}{ax + b} \\$$ To integrate $$\sin x/(ax+b)$$ we do this (works similarly for $$\cos x/(ax+b)$$): $$\int \frac{\sin x}{ax + b} \mathrm dx = \frac{1}{a}\int \frac{\sin x}{x + \frac{b}{a}}\mathrm dx=\frac{1}{a}\int\frac{\sin\bigl(t-\frac{b}{a}\bigr)}{t}\mathrm dt$$ Then we expand the term $$\sin\bigl(t-\frac{b}{a}\bigr)$$ and use the fact that $$\int \sin x \mathrm dx / x = \mathrm{Si}(x) + C$$ and $$\int \cos x \mathrm dx / x = \mathrm{Ci}(x) + C$$

For $$x \sin x/(ax+b)$$, it works similarly: $$\int \frac{x \sin x}{ax + b}\mathrm dx = \frac{1}{a}\int \frac{x \sin x}{x + \frac{b}{a}}\mathrm dx=\frac{1}{a}\int\frac{\bigl(t-\frac{b}{a}\bigr)\sin\bigl(t-\frac{b}{a}\bigr)}{t}\mathrm dt=\frac{1}{a}\int\frac{t\sin\bigl(t-\frac{b}{a}\bigr)}{t}-\frac{1}{a}\int\frac{\frac{b}{a}\sin\bigl(t-\frac{b}{a}\bigr)}{t}\mathrm dt$$ The $$t$$ cancels out in the first part and the second part is analogous to the situation above.

So this is the way how you can tackle this integral. I left out the parts where you just need to do the hard work. I hope that it should be obvious now.

• Thanks for the smart and heavy computation! The key step is to get rid of the absolute value, right? Did you try the squared? I mean $\frac12\ln(u-v)^2$. Commented Apr 25 at 12:17
• That is equivalent to $\ln|u-v|$ as $\ln x^2 = 2\ln|x|$, so it would give me the same result. One of the steps here is, indeed, getting rid of the absolute value, by splitting the integration area into two parts, where the expression in the absolute value is positive in one part and negative in the other part. Commented Apr 25 at 12:23