Problem: Evaluate the definite integral

$$\int_0^{\infty} dx \, \frac{\log^2{x} \, \log{(1+x)}}{1+x^2} $$

This integral may be evaluated using the residue theorem. The analysis involves two branch points with respective branch cuts that must be treated separately. Further, as well will see, the log-squared term in the integral will produce several levels of recursion. I will demonstrate the evaluation of all steps so that it is clear how to treat the several nuances in this approach. While not the most quick-and-dirty approach, this approach demonstrates several techniques used for evaluating real integrals using complex integration techniques.

We begin by evaluating the contour integral

$$\oint_C dz \frac{\log^3{z} \log{(1+z)}}{1+z^2} $$

where $C$ is the following contour:

The radius of the outer arcs in the contour $C$ is $R$, which will increase without bound. Note that the integral about the outer arcs vanishes as $\log^4{R}/R$ as $R \to \infty$, so we may ignore the integrals over those arcs.

The radius of the small arcs about the branch points in the contour $C$ is $\epsilon$. The integrals about those small arcs also vanish as $\epsilon^2 \log^3{\epsilon}$ or $\epsilon \log{\epsilon}$ as $\epsilon \to 0$.

Note a first branch cut, corresponding to the branch point at the origin, is along the real axis, while a second branch cut, corresponding to the branch point $z=-1$, is along the line $(-\infty,-1]$. In the vicinity of the first branch cut, $\arg{z} \in [0,2 \pi]$ and in the vicinity of the second branch cut, $\arg{z} \in [-\pi,\pi]$.

Keeping all of the above in mind, we may write out the contour integral in terms of real integrals as follows:

$$\int_0^{\infty} dx \, \frac{\log^3{x} \log{(1+x)}}{1+x^2} + \int_{\infty}^0 dx \, \frac{(\log{x}+i 2 \pi)^3 \log{(1+x)}}{1+x^2} \\ + e^{i \pi} \int_{\infty}^1 dx \, \frac{(\log{x}+i \pi)^3 [\log{(x-1)}+i \pi]}{1+x^2} + e^{-i \pi} \int_1^{\infty} dx \, \frac{(\log{x}+i \pi)^3 [\log{(x-1)}-i \pi]}{1+x^2} $$

It should be noted that, around the first branch cut, $\arg{z}=0$ above and $\arg{z} = 2 \pi$ below, so that $\log{z}=\log{x}$ above and $\log{z}=\log{x}+i 2 \pi$ below. Around the second branch cut, $\arg{z}=\pi$ above and $\arg{z}=-\pi$ below, so that $\log{(1+z)}=\log{(x-1)}+i \pi$ above and $\log{(1+z)}=\log{(x-1)}-i \pi$ below.

Further, and the importance of this fact needs to be stressed, because $\log{z}$ is governed by the first branch cut, $\arg{z} = \pi$ for $\log{z}$ in the vicinity of the negative real axis, so that $\log{z}=\log{x}+i \pi$ both above and below the second branch cut. This is one crucial detail that needs pointing out in the face of the two separate branch points in this integral.

The above expressions may be expanded and combined to reveal several real integrals, so that the contour integral is equal to the following:

$$-i 6 \pi \int_0^{\infty} dx \, \frac{\log^2{x} \log{(1+x)}}{1+x^2} + 12 \pi^2 \int_0^{\infty} dx \, \frac{\log{x} \log{(1+x)}}{1+x^2} \\ +i 8 \pi^3 \int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} + i 2 \pi \int_1^{\infty} dx \, \frac{(\log{x}+i \pi)^3}{1+x^2}$$

By the residue theorem, the contour integral is also equal to $i 2 \pi$ times the sum of the residues at the poles $\pm i$. Again, we have to be very careful about what we mean by $\pm i$. For example, $\log{i} = i \pi/2$ and $\log{(-i)}= i 3 \pi/2$. On the other hand, $\log{(1+i)} = \log{\left ( \sqrt{2} e^{i \pi/4} \right )}$ and $\log{(1-i)} = \log{\left ( \sqrt{2} e^{-i \pi/4} \right )}$. This is a result of the separate branch cuts with separate ranges of $\arg{z}$.

Thus, the contour integral is also equal to

$$i 2 \pi \left [\frac{\left (i \frac{\pi}{2} \right )^3 \left (\frac12 \log{2} + i \frac{\pi}{4} \right )}{i 2} + \frac{\left (i \frac{3 \pi}{2} \right )^3 \left (\frac12 \log{2} – i \frac{\pi}{4} \right )}{-i 2} \right ] = \frac{7 \pi^5}{8} + i \frac{13 \pi^4}{8} \log{2}$$

Going back to the four integrals above, the first integral is the one we seek, we will return to the second and third integrals, while the fourth integral may be split up into four integrals that are readily computed. Along these lines, define

$$J_k = \int_1^{\infty} dx \, \frac{\log^k{x}}{1+x^2} $$

Then

$$J_0 = \frac{\pi}{4}$$

$$J_1 = G_2$$

$$J_2 = \frac{\pi^3}{16}$$

$$J_3 = 6 G_4$$

where

$$G_m = \sum_{\ell=0}^{\infty} \frac{(-1)^{\ell}}{(2 \ell+1)^m} $$

so that $G_2$ is Catalan’s constant ($\approx 0.915$), and $G_4$ is, well, some other constant ($\approx 0.988$). Both of these may be expressed in terms of polygamma functions, but there really is no simpler expression for these. We will take $G_2$ and $G_4$ as given constants in terms of which the final answer will be expressed.

(Note that the derivation of the expressions for $J_0$, $J_1$, and $J_3$ are straightforward. The derivation of $J_2$ may be found here.)

Thus, we have

$$-i 6 \pi \int_0^{\infty} dx \, \frac{\log^2{x} \log{(1+x)}}{1+x^2} + 12 \pi^2 \int_0^{\infty} dx \, \frac{\log{x} \log{(1+x)}}{1+x^2} \\ +i 8 \pi^3 \int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} = \frac{3 \pi^5}{4} + i \frac{13 \pi^4}{8} \log{2} + i 6 \pi^3 G_2 – i 12 \pi G_4 $$

Again, the first integral is the one we seek. We are now tasked with evaluating the second and third integrals. And this is where the concept of recursion comes into play, because we may attack these integrals exactly as we attacked the original one. If we begin with the third integral, then using the exact contour integration process above, we will get an integral we may evaluate on its own.

So let’s begin evaluating the third integral. Following the example above, we evaluate

$$\oint_C dz \, \frac{\log{z} \, \log{(1+z)}}{1+z^2} $$

Using the exact same reasoning outlined above, we find that the integral is equal to

$$-i 2 \pi \int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} + i 2 \pi \int_1^{\infty} dx \frac{\log{x}+i \pi}{1+x^2} $$

which is equal to

$$-i 2 \pi \int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} + i 2 \pi G_2 – \frac{\pi^3}{2}$$

and, by the residue theorem, is also equal to

$$i 2 \pi \left [\frac{\left (i \frac{\pi}{2} \right ) \left (\frac12 \log{2} + i \frac{\pi}{4} \right )}{i 2} + \frac{\left (i \frac{3 \pi}{2} \right ) \left (\frac12 \log{2} – i \frac{\pi}{4} \right )}{-i 2} \right ] = – \frac{\pi^3}{2} – i \frac{\pi^2}{2} \log{2}$$

Therefore

$$\int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} = \frac{\pi}{4} \log{2} + G_2 $$

Now for the second integral – almost exactly as we did the third. Consider

$$\oint_C dz \, \frac{\log^2{z} \, \log{(1+z)}}{1+z^2} $$

Using the exact same reasoning outlined above, we find that the integral is equal to

$$-i 4 \pi \int_0^{\infty} dx \, \frac{\log{x} \, \log{(1+x)}}{1+x^2} + 4 \pi^2 \int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} + i 2 \pi \int_1^{\infty} dx \, \frac{(\log{x}+i \pi)^2}{1+x^2} $$

Note that we may now use the above result to simplify this expression to

$$-i 4 \pi \int_0^{\infty} dx \, \frac{\log{x} \, \log{(1+x)}}{1+x^2} + \pi^3 \log{2} – i \frac{3 \pi^4}{8} $$

which, by the residue theorem, is equal to

$$i 2 \pi \left [\frac{\left (i \frac{\pi}{2} \right )^2 \left (\frac12 \log{2} + i \frac{\pi}{4} \right )}{i 2} + \frac{\left (i \frac{3 \pi}{2} \right )^2 \left (\frac12 \log{2} – i \frac{\pi}{4} \right )}{-i 2} \right ] =\pi^3 \log{2} – i \frac{5 \pi^4}{8} $$

Therefore

$$ \int_0^{\infty} dx \, \frac{\log{x} \, \log{(1+x)}}{1+x^2} = \frac{\pi^3}{16} $$

And now, with these pieces in hand, we may go back to the result for the original contour integral and just plug the pieces in and solve. The final result is

$$\int_0^{\infty} dx \, \frac{\log^2{x}\, \log{(1+x)}}{1+x^2} = \frac{\pi^3}{16} \log{2} + \frac{\pi^2}{3} G_2 + 2 G_4 $$

I do hope this illustrated how to use contour integration in the presence of multiple branch points and powers of logarithms. It can be confusing, but if done right, has its own butlt-in checking system. (Note that the real part of the LHS and RHS had to match, otherwise we would have gotten nonsense results.)

]]>$$\int_0^1 dx \, f(x) = \int_0^1 dx \, x f(x) = 1$$

show that

$$\int_0^1 dx \, f(x)^2 \ge 4$$

The way to the solution here is not trivial. I started by always recognizing that, with integral inequalities, it never hurts to start with the integral of something squared is greater than or equal to zero. But…what? Well, given the integral constraints above, we can guess what we need to do.

We begin with

$$\int_0^1 dx \left [f(x) – (a x+b) \right ]^2 \ge 0 $$

for any $a,b \in \mathbb{R}$. Expand the integrals and use the info provided to get that

$$\int_0^1 dx \, f(x)^2 \ge 2 a+2 b – \frac13 a^2-a b-b^2 $$

We then maximize the expression on the right. Let the expression on the RHS be $g(a,b)$.

We may maximize by taking derivatives of $g(a,b)$ wrt $a$ and $b$ and setting them equal to zero. We then get a system of equations

$$2 a + 3 b = 6$$

$$a+2 b=2$$

which implies that $a=6$ and $b=-2$. Note that $g_{aa} g_{bb} – g_{ab}^2 = \frac13 \gt 0$ and $g_{aa} = -\frac23 \lt 0$, so the critical point we found is indeed a maximum. It is then easy to verify that $g(6,-2)=4$. The assertion is proven.

]]>$$ \int_0^{\infty} dx \, \frac{\coth^2{x}-1}{\displaystyle (\coth{x}-x)^2+\frac{\pi^2}{4}} = \frac{4}{5} $$

The OP actually seemed to know what he was doing but could not get the correct residue that would allow him to get the stated result. In showing a link to Wolfram Alpha, the OP revealed that he was simply finding the residue of the integrand at a pole without defining a complex integral (including a contour of integration). Thus, this guy was making a very common mistake by thinking the Residue Theorem is a formula and not a procedure.

It needs to be internalized by those who wish to use the Residue Theorem that it is a complex integral which is equal to $i 2 \pi$ times the sum of the residues of the poles inside the contour of integration. The contour of integration, when parametrized, needs to produce the real integral of interest. (Then we can solve for the real integral in terms of the residues and maybe some other stuff related to contributions from others parts of the contour.) It is NOT the real integral being equal to $i 2 \pi$ times the residues!

To give the OP the benefit of the doubt, perhaps he merely thought that the contour is a semicircle in the upper half-plane. While this is a valid contour to use, the problem is that there are an infinite number of poles of the integrand within this contour. And aside from the pole at $z=i \pi/2$, the poles are not realizable in closed form and are difficult to obtain.

Better is a closed contour that contains only the pole at $z=i \pi/2$. In this case, we need to determine the form of the integrand we need in the contour integral. Remember, somehow we should get the original integral back using a direct parameterization of the contour. So, without further ado…

Consider the contour integral

$$\oint_C dz \, \tanh{\left [z-\operatorname{arctanh}{\left (z-i \frac{\pi}{2} \right )} \right ]} $$

which is equal to

$$\oint_C dz \, \frac{\displaystyle 1-z \coth{z} + i \frac{\pi}{2} \coth{z}}{\displaystyle \coth{z}-z+i \frac{\pi}{2}} $$

where $C$ is the rectangle with vertices $\pm R$ and $\pm R+i \pi$.

The contour integral is then equal to

$$\int_{-R}^R dx \frac{\displaystyle 1-x \coth{x} + i \frac{\pi}{2} \coth{x}}{\displaystyle \coth{x}-x+i \frac{\pi}{2}} + i \int_0^{\pi} dy \, \frac{\displaystyle 1-(R+i y)\coth{(R+i y)} + i \frac{\pi}{2} \coth{(R+i y)}}{\displaystyle \coth{(R+i y)} – (R+i y) + i \frac{\pi}{2}} \\ + \int_{R}^{-R} dx \frac{\displaystyle 1-x \coth{x} – i \frac{\pi}{2} \coth{x}}{\displaystyle \coth{x}-x-i \frac{\pi}{2}}\\ + i \int_{\pi}^0 dy \, \frac{\displaystyle 1-(-R+i y)\coth{(-R+i y)} + i \frac{\pi}{2} \coth{(-R+i y)}}{\displaystyle \coth{(-R+i y)} – (-R+i y) + i \frac{\pi}{2}}$$

Now consider the second and fourth integrals, i.e., those over the vertical edges of the rectangle. We consider the limit as $R \to \infty$. Note that the integrand of the second integral approaches $1$ in this limit, while the integrand of the fourth integral approaches $-1$. (Exercise for the reader.) Thus, the sum of these two integrals is $i 2 \pi$.

We can also combine the integrand of the first and third integrals to get the integrand of the integral we seek, times $i \pi$. Thus, the contour integral is equal to (after exploiting the evenness of that integrand)

$$i 2 \pi \int_0^{\infty} dx \, \frac{\coth^2{x}-1}{\displaystyle (\coth{x}-x)^2+\frac{\pi^2}{4}} + i 2 \pi$$

By the residue theorem, the contour integral is also equal to $i 2 \pi$ times the residue at the pole $z=i \pi/2$. Interestingly enough, this pole is not simple, but is instead a third-order pole. Given the integrand, I find it easier to compute the Laurent series directly and use that to find the residue. However, I will simply state the result as follows:

$$\operatorname*{Res}_{z=i \pi/2} \frac{\displaystyle 1-z \coth{z} + i \frac{\pi}{2} \coth{z}}{\displaystyle \coth{z}-z+i \frac{\pi}{2}} = \frac{9}{5} $$

so that

$$i 2 \pi \int_0^{\infty} dx \, \frac{\coth^2{x}-1}{\displaystyle (\coth{x}-x)^2+\frac{\pi^2}{4}} + i 2 \pi = i 2 \pi \frac{9}{5} $$

or

$$ \int_0^{\infty} dx \, \frac{\coth^2{x}-1}{\displaystyle (\coth{x}-x)^2+\frac{\pi^2}{4}} = \frac{4}{5} $$

**ADDENDUM**

Let’s take a look at that residue calculation. For this, it helps to know that

$$\coth{\left ( z + i \frac{\pi}{2} \right )} = \tanh{z}$$

and

$$\tanh{z} = z – \frac13 z^3 + \frac{2}{15} z^5 + O \left ( z^7 \right )$$

so that the integrand looks like, in the neighborhood of $z=i \pi/2$,

$$ \frac{1-z \tanh{z}}{\tanh{z}-z} $$

Now we can find the Laurent expansion of this function about $z=0$, which looks like

$$-\frac{3}{z^3} \frac{\displaystyle 1-z^2 +O \left ( z^4 \right )}{\displaystyle 1-\frac{2}{5} z^2+O \left ( z^4 \right )} = -\frac{3}{z^3} \left [1-z^2 +O \left ( z^4 \right ) \right ] \left [1+\frac{2}{5} z^2+O \left ( z^4 \right ) \right ]$$

The residue is the coefficient of $z^2$ in the numerator, which may simply be read off as $9/5$ as stated above.

**ADDENDUM II**

How do we show that $z=i \pi/2$ is the only pole inside the rectangle? We can use Rouche’s theorem. For example, we would just need to show that, on the rectangle,

$$\left | \coth{z}-z \pm i \frac{\pi}{2} \right | \gt |\coth{z} | $$

On the horizontal sides of the rectangle, we see that

$$\left | \coth{x}-x \pm i \frac{\pi}{2} \right |^2 – |\coth{x} |^2 = \frac{\pi^2}{4} – \left (2 x \coth{x}-x^2 \right ) $$

which is indeed $\gt 0$ for all $x \in \mathbb{R} $.

On the vertical sides of the rectangle, the inequality is obviously satisfied because $|\coth{(R + i y)}|$ approaches $1$ as $R \to \pm \infty$.

Therefore, by Rouche’s theorem, the denominator of the integrand has the same number of zeroes inside the rectangle as $\coth{z}$, which is just the one at $z=i \pi/2$ and no others. Thus, the only pole inside the rectangle is at $z=i \pi/2$.

]]>$$\int_0^{\infty} dx \frac{\sin{\left (\pi x^2 \right )}}{\sinh^2{(\pi x)}} \cosh{(\pi x)}$$

Given the trig functions in the integrand, it makes sense to use the residue theorem based on a complex integral around a rectangular contour. As has been my experience with these integrals, the integrand of the complex integral will not match the integrand of the real integral to be evaluated.

I am asked frequently how I determine the integrand of the complex integral when I am performing a residue theorem evaluation of a real integral. Of course, first one must determine a contour of integration in the complex plane. In general, this can be difficult but for problems involving trig functions or periodic functions in general, a rectangular contour is used. That said, once the contour is determined, if I do not know any better I experiment with the integrand. So perhaps I evaluate the integral around the contour using the integrand of the real integral to be evaluated. In most cases, that will not produce the real integral, but it will provide insight into what the integrand should be.

I encourage the reader to try integrating the original integrand about the rectangular contour described below to see what happens.

Without further ado, consider the complex integral

$$\oint_C dz \frac{\cos{\left (\pi z^2\right )}}{\sinh^3{\left (\pi z\right )}} $$

about the rectangle with vertices $\pm R \pm i$ with small semicircular detours around the poles at $z=\pm i$. The contour integral is then equal to

$$PV \int_{-R}^R dx \frac{\cos{[\pi (x-i)^2]}}{\sinh^3{[\pi (x-i)]}} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\cos{\left [\pi \left (-i+\epsilon e^{i \phi} \right )^2 \right ]}}{\sinh^3{\left [\pi \left (-i+\epsilon e^{i \phi} \right ) \right ]}} \\ + PV \int_R^{-R} dx \frac{\cos{[\pi (x+i)^2]}}{\sinh^3{[\pi (x+i)]}} + i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\cos{\left [\pi \left (i+\epsilon e^{i \phi} \right )^2 \right ]}}{\sinh^3{\left [\pi \left (i+\epsilon e^{i \phi} \right ) \right ]}} \\ + i \int_{-1}^1 dy \frac{\cos{\left [\pi \left (R+i y \right )^2 \right ]}}{\sinh^3{\left [\pi \left (R+i y \right ) \right ]}}+i \int_1^{-1} dy \frac{\cos{\left [\pi \left (-R+i y \right )^2 \right ]}}{\sinh^3{\left [\pi \left (-R+i y \right ) \right ]}}$$

Note that the first and third integrals are actually expressed as Cauchy principal values because the individual integrals themselves do not converge. That said, when combined, the resulting integral does converge and we may remove the $PV$ label.

As $R \to \infty$, the last two integrals go to zero.

The second integral approaches, in the limit as $\epsilon \to 0$:

$$i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{-1-2 \pi^2 \epsilon^2 e^{i 2 \phi}+\cdots}{\left (\pi \epsilon e^{i \phi} \right )^3 \left (1 + \frac16 \pi^2 \epsilon^2 e^{i 2 \phi} + \cdots \right )^3} \\ = i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{-1-2 \pi^2 \epsilon^2 e^{i 2 \phi}}{\left (\pi \epsilon e^{i \phi} \right )^3} \left (1-\frac12 \pi^2 \epsilon^2 e^{i 2 \phi} \right ) \to -i \frac32$$

The fourth integral approaches an identical limit as $\epsilon \to 0$.

The first and third integrals combine to produce, as $R \to \infty$,

$$i 4 \int_{-\infty}^{\infty} dx \frac{\sin{\left ( \pi x^2 \right )}}{\sinh^2{(\pi x)}} \cosh{(\pi x)} $$

The contour integral is also equal to $i 2 \pi$ times the residue of the integrand at $z=0$. The residue may be computed by expanding the integrand in a Laurent series about $z=0$, which is

$$\frac1{(\pi z)^3} \left (1 – \frac12 \pi^2 z^4+\cdots \right ) \left (1 – \frac12 \pi^2 z^2+\cdots \right )$$

The residue is the coefficient of $z^{-1}$, or $-1/(2 \pi)$. Thus,

$$i 4 \int_{-\infty}^{\infty} dx \frac{\sin{\left ( \pi x^2 \right )}}{\sinh^2{(\pi x)}} \cosh{(\pi x)} – i 3 = -i$$

Rearranging things a bit, we find that the original integral is

$$\int_0^{\infty} dx \frac{\sin{\left ( \pi x^2 \right )}}{\sinh^2{(\pi x)}} \cosh{(\pi x)} = \frac14 $$

]]>$$\int_{-1}^1 dx \frac{|x-y|^{\alpha}}{(1-x^2)^{(1+\alpha)/2}}$$

I will show how to compute this integral using Cauchy’s theorem. It was remarked that it should not be possible to use Cauchy’s theorem, as Cauchy’s theorem only applies to analytic functions, and an absolute value certainly does not qualify. True. Nevertheless, for the special case of the integral in question, things work out quite nicely as you will see.

Consider the contour integral

$$\oint_C dz \frac{(z-y)^{\alpha}}{(z^2-1)^{(1+\alpha)/2}} $$

where $C$ is the following contour:

The radii of the small arcs is $\epsilon$ and the large arc is $R$. The left arc is centered at $z=-1$, the right arc is centered at $z=1$, and the center arc is centered at $z=y$.

Note that the integrals about the small arcs vanish in the limit as $\epsilon \to 0$. The integrals along the segment $AB$ cancels with that along $KL$. Thus, the contour integral is equal to, in this limit,

$$e^{-i \left ( \frac{1+\alpha}{2}\right ) \pi} \left [e^{i \pi \alpha} \int_{-1}^y dx \frac{(y-x)^{\alpha}}{(1-x^2)^{(1+\alpha)/2}} + \int_y^1 dx \frac{(x-y)^{\alpha}}{(1-x^2)^{(1+\alpha)/2}}\right ]\\ – e^{i \left ( \frac{1+\alpha}{2}\right ) \pi} \left [e^{-i \pi \alpha} \int_{-1}^y dx \frac{(y-x)^{\alpha}}{(1-x^2)^{(1+\alpha)/2}} + \int_y^1 dx \frac{(x-y)^{\alpha}}{(1-x^2)^{(1+\alpha)/2}}\right ]\\ + i R \int_{-\pi}^{\pi} d\theta \, e^{i \theta} \frac{(R e^{i \theta}-y)^{\alpha}}{(R^2 e^{i 2 \theta}-1)^{(1+\alpha)/2}}$$

In the limit as $R \to \infty$, the last integral about the big arc approaches $i 2 \pi$. Meanwhile, the first four integrals may be greatly simplified to be

$$-i 2 \sin{\left [\left ( \frac{1-\alpha}{2} \right ) \pi \right ]} \int_{-1}^y dx \frac{(y-x)^{\alpha}}{(1-x^2)^{(1+\alpha)/2}} – i 2 \sin{\left [\left ( \frac{1+\alpha}{2} \right ) \pi \right ]} \int_y^1 dx \frac{(x-y)^{\alpha}}{(1-x^2)^{(1+\alpha)/2}}$$

which may be written in more compact form such that the contour integral is equal to

$$-i 2 \cos{\left ( \frac{\pi \alpha}{2} \right )} \int_{-1}^1 dx \frac{|x-y|^{\alpha}}{(1-x^2)^{(1+\alpha)/2}} + i 2 \pi$$

By Cauchy’s theorem, the contour integral is zero. Therefore,

$$\int_{-1}^1 dx \frac{|x-y|^{\alpha}}{(1-x^2)^{(1+\alpha)/2}} = \frac{\pi}{\cos{\left ( \frac{\pi \alpha}{2} \right )}} $$

Note how the absolute value was introduced naturally because we got to the point where we could simply add the pieces of the integral back together. In general, the above methodology will not work. But it is nice to be able to recognize when it will work.

]]>Solution: I chose this problem because the answer is highly nontrivial and just out of left field. But the process of getting there seems so straightforward; it is not really.

Substitute $x=u^{1/n}$ in the integral and get

$$I(n) = \int_0^1 \frac{dx}{1+x^n} = \frac1n \int_0^1 du \frac{u^{\frac1n-1}}{1+u} = \frac1n \int_0^1 du \, u^{1/n} \left (\frac1u – \frac1{1+u} \right ) \\= 1-\frac1n \int_0^1 du \frac{u^{1/n}}{1+u}$$

We then note that $u^{1/n} = e^{\log{u}/n}$ and that $n$ is large enough for the following series expansion to be valid:

$$I(n) = 1- \sum_{j=0}^{\infty} \frac1{n^{j+1} \, j!} \int_0^1 du \frac{\log^j{u}}{1+u} $$

Is it really straightforward that this approach would work, never mind be valid? Not sure. It took me about four failed attempts before I stumbled upon this approach. I guess when you write things up, it all looks so easy. Trust me, it isn’t. (And there are other ways to solve this problem as well.)

OK, enough ranting. Due to the nature of the limit we are posed, we go out to second order; thus

$$I(n) = 1-\frac{\log{2}}{n} + \frac{\pi^2}{12 n^2} +O \left ( \frac1{n^3} \right ) $$

Then

$$\begin{align}I(n)^n &= e^{n \log{\left [1-\frac{\log{2}}{n} + \frac{\pi^2}{12 n^2} +O \left ( \frac1{n^3} \right )\right ]} } \\ &= e^{n\left [-\frac{\log{2}}{n} + \frac{\pi^2}{12 n^2} – \frac{\log^2{2}}{2 n^2}+O \left ( \frac1{n^3} \right ) \right ] } \\ &= \frac12 \left [1+\left (\frac{\pi^2}{12} – \frac12 \log^2{2} \right ) \frac1n +O \left ( \frac1{n^2} \right ) \right ]\end{align}$$

The sought after limit is then

$$\lim_{n \to \infty} n \left [I(n)^n-\frac12 \right ] = \frac{\pi^2}{24} – \frac14 \log^2{2} $$

]]>$$\int_0^{12\pi} dx \frac{x}{6+\cos 8x}$$

It looks like the OP is trying to compute the antiderivative and use the fundamental theorem of calculus. With multiple periods, that approach is paved with all sorts of difficulty that is really an artifice related to the functional form of the antiderivative. In truth, there should be no such difficulty. A better approach involves the residue theorem, which I will outline below. Note that the presence of the linear term in the numerator provides a slight complication, but one that has been treated before in this site several times.

$$\int_{0}^{12 \pi} dx \frac{x}{6+\cos{8 x}} = \frac1{64} \int_0^{96 \pi} du \frac{u}{6+\cos{u}}$$

$$\int_{n 2 \pi}^{(n+1) 2 \pi} du \frac{u}{6+\cos{u}} = \int_0^{2 \pi} dv \frac{v+2 \pi n}{6+\cos{v}} = \int_0^{2 \pi} dv \frac{v}{6+\cos{v}} + 2 \pi n \int_0^{2 \pi} \frac{dv}{6+\cos{v}}$$

Thus, summing over $n$:

$$\int_{0}^{12 \pi} dx \frac{x}{6+\cos{8 x}} = \frac{48}{64} \int_0^{2 \pi} dv \frac{v}{6+\cos{v}} + \frac{48 (47) \pi}{64} \int_0^{2 \pi} \frac{dv}{6+\cos{v}}$$

We may now compute each of these integrals. The second integral is straightforward by the residue theorem, i.e., let $z=e^{i v}$, then

$$\int_0^{2 \pi} \frac{dv}{6+\cos{v}} = -i 2 \oint_{|z|=1} \frac{dz}{z^2+12 z+1}$$

The only pole of the integrand inside the unit circle is at $z=-6+\sqrt{35}$. The integral is then $i 2 \pi$ times the residue of the integrand at this pole, or $2 \pi/\sqrt{35}$.

To compute the first integral, we consider the complex integral

$$ \oint_C dz \frac{\log{z}}{z^2+12 z+1} $$

where $C$ is the unit circle with a detour up and back about the positive real axis. (A circular piece about the origin vanishes.) This integral is equal to

$$-\frac12 \int_0^{2 \pi} dv \frac{v}{6+\cos{v}} + \int_1^0 dx \frac{\log{x}+i 2 \pi}{x^2+12 x+1} + \int_0^1 dx \frac{\log{x}}{x^2+12 x+1}$$

or, simplifying,

$$-\frac12 \int_0^{2 \pi} dv \frac{v}{6+\cos{v}} – i 2 \pi \int_0^1 \frac{dx}{x^2+12 x+1} $$

The contour integral is also equal to $i 2 \pi$ times the residue at the pole $z=-6+\sqrt{35}$. Note that the negative sign is taken to be $e^{i \pi}$. Thus we have

$$-\frac12 \int_0^{2 \pi} dv \frac{v}{6+\cos{v}} = i 2 \pi \int_0^1 \frac{dx}{x^2+12 x+1} + i 2 \pi \frac{-\log{\left ( 6+\sqrt{35} \right )}+i \pi}{2 \sqrt{35}} $$

Now,

$$\frac1{x^2+12 x+1} = \frac1{2 \sqrt{35}} \left (\frac1{x+6-\sqrt{35}} – \frac1{x+6+\sqrt{35}} \right ) $$

so that

$$\int_0^1 \frac{dx}{x^2+12 x+1} = \frac1{2 \sqrt{35}} \log{\left (\frac{7+\sqrt{35}}{7-\sqrt{35}} \right )} = \frac1{2 \sqrt{35}} \log{\left (6+\sqrt{35}\right )}$$

Note the cancellation with the real part of the residue. Thus,

$$\int_0^{2 \pi} dv \frac{v}{6+\cos{v}} = \frac{2 \pi^2}{\sqrt{35}} $$

Putting these results altogether, we have

>$$\int_0^{12 \pi} dx \frac{x}{6+\cos{8 x}} = \frac{72 \pi^2}{\sqrt{35}} $$

]]>However, once in a blue moon, we find an integral that is really something else. The trick that will allow us to locate the closed form is no mere algebraic transformation but is something else entirely. Yes, there is the use of symmetry, but there is something else entirely that just comes with experience.

The problem before us is to evaluate the following double integral:

$$\int_0^{2 \pi} dx \, \int_0^{\pi} dy\, \sin{y} \, e^{\sin{y} (\cos{x}-\sin{x})} $$

A direct evaluation of this integral is at best a mess. No matter what we will have some intermediate step involving a Bessel function or worse. Maybe that is the way we must proceed. However, I know the answer is quite simple and, thus, I do not want to involve Mr. Bessel.

Instead, the first insight I had was to notice the integral element $\sin{y} \,dx \, dy $. This describes an element of solid angle in a unit sphere, and wouldn’t you know, the integration limits imply we are integrating over the full unit sphere.

Notation becomes crucial at a time like this, so if we are going to think unit sphere, let’s notate the integration variables as azimuthal and polar angles, respectively. Thus, we write the integral as

$$\int_0^{2 \pi} d\phi \, \int_0^{\pi} d\theta \, \sin{\theta} \, e^{\sin{\theta} (\cos{\phi}-\sin{\phi})} $$

All we have done is write the integral suggestively – we have done nothing to actually transform it into something else.

Now, note that we can replace the $\cos{\phi}-\sin{\phi}$ in the exponential with simply $\sqrt{2} \cos{\phi}$, as we are integrating over the whole azimuth anyway. Thus, the integral is

$$\int_0^{2 \pi} d\phi \, \int_0^{\pi} d\theta \, \sin{\theta} \, e^{\sqrt{2} \sin{\theta} \cos{\phi}} $$

Now, note that on the unit sphere, $\sin{\theta} \cos{\phi} = x$, the $x$-coordinate. Thus, by simple geometry, we can replace this double integral with a single integral over $x$ by noting that the function we are integrating over only depends on $x$. The contribution to the integral from a ring a distance $x$ from the plane $x=0$ is $2 \pi \sqrt{1-x^2} e^{\sqrt{2} x} ds$, where $ds$ is an element of arc length. Of course, over a cross-section of the sphere, $y=\pm \sqrt{1-x^2}$ and

$$ds = \sqrt{1+\left ( \frac{dy}{dx} \right )^2} dx = \frac{dx}{\sqrt{1-x^2}}$$

Thus the integral is simply

$$2 \pi \int_{-1}^1 dx \, e^{\sqrt{2} x} = 2 \sqrt{2} \pi \sinh{\sqrt{2}} $$

I have independently verified the numerical value.

]]>$$\prod_{n=2}^{\infty} \left (1+\frac{(-1)^{n-1}}{a_n} \right ) $$

where

$$a_n = n! \sum_{k=1}^{n-1} \frac{(-1)^{k-1}}{k!} $$

This is one of those cases where trying out a bunch of numbers really isn’t going to help all that much. The $a_n$ look kind of like $n!$, except off by some. Even so, I can find no closed form to the product by subbing $a_n$ with $n!$.

However, we make the following simple observation:

$$\frac{a_{n+1}}{(n+1)!} = \frac{a_n}{n!} + \frac{(-1)^{n-1}}{n!}$$

Accordingly, the given sequence satisfies

$$a_{n+1} = (n+1) (a_n + (-1)^{n-1}) $$

Then

$$1+\frac{(-1)^{n-1}}{a_n} = \frac{a_n+(-1)^{n-1}}{a_n} = \frac1{n+1} \frac{a_{n+1}}{a_n}$$

Then

$$\prod_{n=2}^N \left (1+\frac{(-1)^{n-1}}{a_n} \right ) = \frac{2}{(N+1)!} \frac{a_{N+1}}{a_2} = \frac{a_{N+1}}{(N+1)!}$$

The product sought is just the limit of this ratio as $N \to \infty$, which is just

$$\lim_{N \to \infty} \sum_{k=1}^{N} \frac{(-1)^{k-1}}{k!} = 1-\frac1{e} $$

This is a very deceptively simple result given the awkward pattern of numbers one gets from computing the sequence $a_n$.

]]>$$\sum_{n=1}^{\infty} \frac{1}{n^3\sin{\left (\sqrt{2} \, n\pi \right)}}$$

*NB (20 Nov 2016) I just got word that Wolfram fixed the problem described below. See below for details.*

It should be clear that the sum converges…right? No? Then how do we show this?

Numerical experiments are more or less helpful, but as one might expect, there is a bit of jumping around about some value. So, even though the OP stated that he had proven convergence, I just want to illustrate how convergence is achieved.

At issue is the factor $\sin{\sqrt{2} \pi n}$ of each term in the sum: when is this sine term dangerously close to zero? If we think about it for a bit, the worst-case scenario is when $2 n^2$ is one less or more than a perfect square. (Recall that $2 n^2$ can never be a perfect square.) That is, when

$$2 n^2 = m^2 \pm 1$$

for some $m \in \mathbb{N}$. In this case,

$$\sin{\sqrt{2} \pi n} = \sin{\left (\sqrt{m^2 \pm 1} \pi \right )} $$

For $n$ sufficiently large, i.e., $m$ large as well, we have

$$\sin{\sqrt{2} \pi n} \approx \sin{\left [m \pi \left (1 \pm \frac1{2 m^2} \right ) \right ]} = (-1)^m \sin{\frac{\pi}{2 m}} \approx (-1)^m \frac{\pi}{2 m}$$

Thus,

$$\left | \frac1{n^3 \sin{\sqrt{2} \pi n}} \right | \le \frac1{n^3 \frac{\pi}{2 \sqrt{2} n}} = \frac{2 \sqrt{2}}{\pi n^2}$$

and, because the worst-case scenario term is bounded by something times $1/n^2$, the series converges by comparison with the sum of $1/n^2$.

OK, now that we have established convergence, we may now evaluate the sum. I would like to use the residue theorem, but the sum doesn’t exactly fit the typical pattern of sums that are residue-friendly. Some measure of creativity will be necessary. In this case, note that, when we have introduced a factor of $\csc{\pi z}$, the residue at $z=n \in \mathbb{Z}$ has a factor of $(-1)^n$, which this sum does not have. To blunt this factor, we may introduce a term $\csc{(\sqrt{2}-1) \pi z}$ which, at $z=n$ is equal to $(-1)^n \csc{\sqrt{2} \pi n}$.

For this reason, we consider the contour integral

$$\oint_{C_N} \frac{dz}{z^3 \sin{\pi z} \, \sin{\left [\left ( \sqrt{2}-1 \right ) \pi z \right ]}}$$

where $C_N$ is the square having vertices $\pm \left (N-\frac12 \right )(1 \pm i)$. You can show that, as $N \to \infty$, the contour integral over $C_N$ goes to zero.

However, the contour integral has poles at the integers and at the integers times $\sqrt{2}+1$. The residue at $z=0$ may be evaluated by expansion in a Laurent series, as the pole here is of order $5$. This expansion looks like

$$\frac1{z^3} \frac1{\pi z \left (1-\frac{\pi^2 z^2}{3!} + \frac{\pi^4 z^4}{5!}+\cdots \right )} \frac1{(\sqrt{2}-1)\pi z \left (1-\frac{(\sqrt{2}-1)^2\pi^2 z^2}{3!} + \frac{(\sqrt{2}-1)^4 \pi^4 z^4}{5!}+\cdots \right )}$$

The coefficient of $1/z$ in this expansion is essentially the coefficient of $z^4$ in the expansion of the sine terms in parentheses, or

$$\frac{13 \pi^2}{90} \left ( \sqrt{2}-1 \right )$$

The residue at each pole $z=n \ne 0$ is simply

$$\frac{(-1)^n}{\pi n^3 \sin{(\sqrt{2}-1) \pi n}} = \frac1{\pi n^3 \sin{\sqrt{2} \pi n}}$$

The residue at each pole $z=(\sqrt{2}+1) n \ne 0$ is

$$\frac{(-1)^n (\sqrt{2}+1)}{(\sqrt{2}+1)^3 \pi n^3 \sin{(\sqrt{2}+1) \pi n}} = \frac{(\sqrt{2}-1)^2}{\pi n^3 \sin{\sqrt{2} \pi n}}$$

Thus,

$$2 \sum_{n=1}^{\infty} \frac{1+(\sqrt{2}-1)^2}{\pi n^3 \sin{\sqrt{2} \pi n}} + \frac{13 \pi^2}{90} \left ( \sqrt{2}-1 \right ) = 0$$

because the contour integral is zero. Thus, I get that

$$\sum_{n=1}^{\infty} \frac{1}{n^3 \sin{\sqrt{2} \pi n}} = -\frac{13 \pi^3}{360 \sqrt{2}} $$

As a bonus, it looks like we have discovered a bug in Mathematica. As a matter of routine, I checked the result against a straight evaluation in Mathematica. To my horror, Mathematica returned $-13 \pi^{\color{red}{2}}/(360 \sqrt{2})$. How was I off by a factor of $\pi$? I checked and checked my work but found nothing wrong.

The solution to this problem lay in simply evaluating the sum numerically for an increasingly large number of terms. However, in order to assess whether there would be any surprises waiting for us from the sine term, I had to estimate the worst possible “spike” near an integer times $\pi$. What I found above is that, worst case, the terms decrease as some constant times $1/n^2$, so the effect of any spike is limited.

Armed with this information, I was able to verify in Mathematica that, indeed, numerical evaluations of finite sums converged to the answer I gave above rather than Mathematica’s result. Mr. Wolfram has received yet another letter.

20 Nov 2016

I just got the following email:

Hello Ron Gordon,

In Febuary 2016 you reported an issue with Mathematica wherein Sum returns a wrong answer for some expressions.

We believe that the issue has been resolved in the current release of Mathematica.

Thank you for your report and we look forward to a continued, productive relationship with you.

Best regards,