# Weird $\sin(\ln (x))$, $\cos(\ln (x))$ pattern

I just came across these four integrals, evaluated them, and noticed they show this weird alternate pattern, I think its cool but I have no idea why they do. Anyone knows an intuitive reason for this?

$$\hspace{1cm} \int_0^\infty \frac{\cos(\ln(x))}{1+x}\mathrm{d}x=0 \hspace{2cm} \int_0^\infty \frac{\sin(\ln(x))}{1+x}\mathrm{d}x= \frac{\pi}{\sinh(\pi)}$$ $$\int_0^\infty \frac{\cos(\ln(x))}{(1+x)^2}\mathrm{d}x= \frac{\pi}{\sinh(\pi)} \hspace{1cm} \int_0^\infty \frac{\sin(\ln(x))}{(1+x)^2}\mathrm{d}x=0$$

• Welcome to Math.SE. Your question would benefit from more context such as showing how you evaluated one of these integrals. In terms of your question, consider each of these integrals as the Mellin transform of $(1+x)^{-k}$ with $s=1+i$ -- can you see why the pattern holds? Commented Apr 24, 2023 at 14:45
• I just found online that $\\M[(1+t)^{-b}]=\frac{\Gamma(s)\Gamma(b-s)}{\Gamma(b)}$ , I think this is what you mean, thank you
– Zima
Commented Apr 24, 2023 at 15:15

Consider the integral

$$I = \int_{0}^{\infty} \frac{e^{i\ln(x)}}{1+x} dx= \int_{0}^{\infty} \frac{x^i}{1+x}dx$$

Do the substitution $$\displaystyle w = \frac{1}{1+x}$$

$$I = \int_{0}^{1} (1-w)^{i}w^{-1-i} dw = B(1+i,-i) = \Gamma(1+i)\Gamma(-i) = -\frac{\pi}{\sin(\pi i)} = \frac{i\pi}{\sinh(\pi)}$$

Note that $$\displaystyle \frac{\pi}{\sinh(\pi)}$$ is real valued. Then take the real and imaginary parts:

$$\Im \int_{0}^{\infty} \frac{e^{i\ln(x)}}{1+x} dx= \int_{0}^{\infty} \frac{\cos(\ln(x))}{1+x} dx = 0$$

$$\Re \int_{0}^{\infty} \frac{e^{i\ln(x)}}{1+x} dx= \int_{0}^{\infty} \frac{\sin(\ln(x))}{1+x} dx = \frac{\pi}{\sinh(\pi)}$$

Edit: Similarly, if we make the same substitution $$\displaystyle w = \frac{1}{(1+x)}$$

\begin{align*}\int_{0}^{\infty} \frac{e^{i\ln(x)}}{(1+x)^2}dx = &\int_{0}^{\infty} \frac{x^i}{(1+x)^2}dx=\int_{0}^{1} (1-w)^{i}w^{-i} dw \\ =& \Gamma\left(1+i\right)\Gamma\left(1-i\right) \\ =& i\Gamma(i)\Gamma(1-i)\\ =& \frac{i\pi}{\sin\left(i\pi\right)}\\ =& \frac{\pi}{\operatorname{sinh}\left(\pi\right)}\end{align*}

This last is a real value

Take real and imaginary parts.

So

$$\Re \int_{0}^{\infty} \frac{e^{i\ln(x)}}{(1+x)^2}dx = \int_{0}^{\infty} \frac{\cos(\ln(x))}{(1+x)^2}dx = \frac{\pi}{\operatorname{sinh}\left(\pi\right)}$$

$$\Im \int_{0}^{\infty} \frac{e^{i\ln(x)}}{(1+x)^2}dx = \int_{0}^{\infty} \frac{\sin(\ln(x))}{(1+x)^2}dx = 0$$

Edit 2: Another approach for the second case.

\begin{align*} \int_{0}^{1} \frac{\sin(\ln(x))}{(1+x)^2} dx =& \frac{1}{2i} \left[\int_{0}^{\infty} \frac{x^i}{(1+x)^2} dx - \int_{0}^{\infty} \frac{x^{-i}}{(1+x)^2} dx\right]\\ =& \frac{1}{2i}\left[\int_{0}^{\infty} \frac{x^i}{(1+x)^2} dx - \underbrace{\int_{0}^{\infty} \frac{w^i}{(1+w)^2}dw}_{w \mapsto \frac{1}{x}}\right]\\ =& 0 \end{align*}

\begin{align*} \int_{0}^{1} \frac{\cos(\ln(x))}{(1+x)^2} dx =& \frac{1}{2} \left[\int_{0}^{\infty} \frac{x^i}{(1+x)^2} dx + \int_{0}^{\infty} \frac{x^{-i}}{(1+x)^2} dx\right]\\ =& \frac{1}{2}\left[\int_{0}^{\infty} \frac{x^i}{(1+x)^2} dx + \underbrace{\int_{0}^{\infty} \frac{w^i}{(1+w)^2}dw}_{w \mapsto \frac{1}{x}}\right]\\ =& \int_{0}^{\infty} \frac{x^i}{(1+x)^2} dx\\ =& \frac{\pi}{\sinh(\pi)} \end{align*}

• The question asks for $(1+x)^2$ instead of $1+x^2$. So to resolve that, we can take an indirect route noting that IBP gives $$I_2=\int_0^\infty\frac{x^i}{(1+x)^2}\,dx=\int_0^\infty\frac{ix^{i-1}}{1+x}\,dx$$ and since you already have $I=\int_0^\infty x^i/(1+x)\,dx=\pi i/\sinh\pi$ we just need $$I-iI_2=\int_0^\infty\frac{x^{i-1}(1+x)}{1+x}\,dx=\int_{-\infty}^\infty e^{it}\,dt=0$$ (this part can be made rigorous but is just regularised/PV) Commented Apr 24, 2023 at 15:26
• @TheSimpliFire True!, I did not notice where the exponent is, the substitution $\displaystyle w = \frac{1}{(1+x)^2}$ also does the trick. Commented Apr 24, 2023 at 15:30
• @TheSimpliFire I made an edit to evaluate the correct integral. Commented Apr 24, 2023 at 15:58

For at least the fourth integral quoted in the question, the zero value is proved by elementary means.

Define $$u=1/x$$, then

$$\int_0^\infty\dfrac{\sin[\ln(x)]dx}{(1+x)^2}=\int_\infty^0\dfrac{\sin[-\ln(u)][-du/u^2]}{[1+(1/u)]^2}=\int_\infty^0\dfrac{\sin[\ln(u)]du}{(1+u)^2}.$$

Noting the switched limits, the integral on the right is the negative of the equal integral on the left, thus zero if it converges. But the integrand (despite its ill behavior) is bounded as $$x\to0^+$$, and comparable with $$1/x^2$$ as $$x\to\infty$$; thus both ends converge (absolutely).

The first two integrals don't converge.

The easiest way to see that they don't converge is to make the substitution $$u = \ln (x)$$.

The first integral then becomes $$\int_{-\infty}^{\infty} \frac{\cos (u)}{1+e^{u}} \, e^{u} \, \mathrm du,$$ and the second integral becomes $$\int_{-\infty}^{\infty} \frac{\sin (u)}{1+e^{u}} \, e^{u} \, \mathrm du.$$

These are not convergent integrals since the integrand of the first integral oscillates like $$\cos(u)$$ as $$u \to + \infty$$, while the integrand of the second integral oscillates like $$\sin(u)$$ as $$u \to + \infty$$.

Wolfram Alpha, however, claims that $$\int_{0}^{\infty} \frac{x^{i}}{1+x} \,\mathrm dx = \int_{0}^{\infty} \frac{x^{(1+i)-1}}{(1+x)^{(1+i)-i }} \, \mathrm dx = i \pi \operatorname{csch}(\pi).$$

I assume it's using the integral formula $$\int_{0}^{\infty} \frac{x^{a-1}}{(1+x)^{a+b}} \, \mathrm dx = B(a, b).$$

But this formula is only valid if $$\Re(a)>0$$ and $$\Re(b) >0$$.

• Seems you are right, the integrals don't converge, but why Wolfram gets it wrong? @RandomVariable
– Zima
Commented Jun 26, 2023 at 16:56
• @Zima I assume it mistakenly thinks that the formula $B(a,b) = \int_{0}^{\infty} \frac{x^{a-1}}{(1+x)^{a+b}} \, \mathrm dx$ is valid for $a=1+i$ and $b=-i$. Commented Jun 26, 2023 at 17:22