# Integral $\int_0^\infty \frac{|\sin\sqrt{qx}|-|\sin\sqrt{px}|}{x}dx$

Prove that $$\int_{0}^{\infty} \frac{\left\vert\sin\left(\sqrt{qx}\right)\right\vert- \left\vert\sin\left(\sqrt{px}\right)\right\vert}{x}\,\mathrm{d}x = \frac{2}{\pi}\,\log\left(\frac{q}{p}\right)$$

This is a Frullani integral, but I am not sure if it converges. Anyway, I investigated it in my article on "fascinating integrals" (see here) if you are interested about how I came to that result.

My interest in this integral is because I solved it using non-traditional methods ( purely based on statistical analysis ), Wolfram Alpha is unable to compute it ( thought it provides the exact value of other Frullani integrals ), and I want to make sure my answer is correct or makes sense, maybe not in the context of Rienman integrals, but some other types of integrals.

• What is your solution, then? That'll help get the question reopened. – Andrew Chin Feb 9 at 23:20
• See section "How to compute such integrals?" in my article at datasciencecentral.com/profiles/blogs/…. I can add this into my MSE question if you believe it adds value. It is not very rigorous, indeed this is the reason for me asking my question in the first place. – Vincent Granville Feb 10 at 0:00
• Technically, the function $|\sin(x)|$ does not qualify for application of Frullani's integral. The principal reason is that the limit $\lim_{L\to\infty}\sin(x)$ fails to exist and the limit $\lim_{L\to\infty}\int_{aL}^{bL}\frac{|\sin(x)|}{x}\,dx$ does not approach $0$. I've provided a solution herein that I hope you find useful. – Mark Viola May 10 at 1:11

Let $$F(p,q)$$ be given by the integral

\begin{align} F(p,q)&=\int_0^\infty \frac{|\sin(\sqrt{qx})|-|\sin(\sqrt{px})|}{x}\,dx\\\\ &\overbrace{=}^{x\mapsto x^2}2\int_0^\infty \frac{|\sin(\sqrt{q}x)|-|\sin(\sqrt{p}x)|}{x}\,dx\tag1 \end{align}

We will evaluate the integral on the right-hand side of $$(1)$$ using two distinct approaches. In the first approach, we begin with a common way of evaluating a standard Frullani integral and finish with an heuristic evaluation. In the second, we simply integrate by parts and reduce the integral in $$(1)$$ to a standard Frullani integral. To that end, we now proceed.

METHODOLOGY $$1$$:

We proceed by writing the improper integral on the right-hand side of $$(1)$$ as the limit

\begin{align} \int_0^\infty \frac{|\sin(\sqrt{q}x)|-|\sin(\sqrt{p}x)|}{x}\,dx&=\lim_{L\to\infty}\int_0^L \frac{|\sin(\sqrt{q}x)|-|\sin(\sqrt{p}x)|}{x}\,dx\tag2 \end{align}

Next, writing the integral in $$(2)$$ as the difference of integrals, enforcing substitutions $$\sqrt{q}x\mapsto x$$ and $$\sqrt{p}x\mapsto x$$, and adding the resulting integrals reveals

\begin{align} F(p,q)&=2\lim_{L\to\infty}\int_0^L \frac{|\sin(\sqrt{q}x)|-|\sin(\sqrt{p}x)|}{x}\,dx\\\\ &=\lim_{L\to\infty}2\int_0^L \frac{|\sin(\sqrt{q}x)|}{x}\,dx-2\lim_{L\to\infty}\int_0^L \frac{|\sin(\sqrt{p}x)|}{x}\,dx\\\\ &=2\lim_{L\to\infty}\int_0^{\sqrt{qL}} \frac{|\sin(x)|}{x}\,dx-2\lim_{L\to\infty}\int_0^{\sqrt{pL}} \frac{|\sin(x)|}{x}\,dx\\\\ &=2\lim_{L\to\infty}\int_{\sqrt{pL}}^{\sqrt{qL}} \frac{|\sin(x)|}{x}\,dx\tag3 \end{align}

The following heuristic analysis can be made rigorous and we leave the details to the reader. We break the integral in $$(3)$$ into a sum of integrals over intervals $$[k\pi,(k+1)\pi]$$ and write (for "large" $$L$$)

\begin{align} \int_{\sqrt{pL}}^{\sqrt{qL}} \frac{|\sin(x)|}{x}\,dx&\approx\sum_{k=\lfloor \sqrt{pL}/\pi\rfloor}^{\lfloor\sqrt{qL}/\pi\rfloor}\int_{k\pi}^{(k+1)\pi}\frac{|\sin(x)|}{x}\,dx\\\\ &\approx \sum_{k=\lfloor \sqrt{pL}/\pi\rfloor}^{\lfloor\sqrt{qL}/\pi\rfloor}\frac{2}{k\pi}\\\\ &\approx \frac2\pi \left(\log\left(\frac{\lfloor\sqrt{qL}/\pi\rfloor}{\lfloor\sqrt{pL}/\pi\rfloor}\right)\right) \\\\ &\approx \frac1\pi \log(q/p)\tag4 \end{align}

Using $$(4)$$ into $$(3)$$ yields

$$\bbox[5px,border:2px solid #C0A000]{\int_0^\infty \frac{|\sin(\sqrt{qx})|-|\sin(\sqrt{px})|}{x}\,dx=\frac2\pi \log(q/p)}$$

as was to be shown!

METHODOLOGY $$2$$: Integrating by Parts

Let $$\bar S(x)$$ denote that average value the absolute value of the sine function on $$[0,x]$$. That is,

$$\bar S(x) =\frac1x\int_0^x |\sin(t)|\,dt$$

It is easy to see that the following limits hold:

\begin{align} \lim_{x\to0^+}\bar S(x)&=0\tag5\\\\ \lim_{x\to\infty}\bar S(x)&=\frac2\pi\tag6 \end{align}

Integrating by parts the integral on the right-hand side of $$(1)$$ with $$u=\frac1x$$ and $$v=\int_0^x \left(|\sin(\sqrt{q}t)|-|\sin(\sqrt{p}t)|\right)\,dt$$ reveals

$$F(p,q)=2\int_0^\infty \frac{\bar S(\sqrt{q}x)-\bar S(\sqrt{p}x)}{x}\,dx\tag7$$

The integral in $$(7)$$ is a Frullani integral. Therefore, using $$(5)$$ and $$(6)$$ in $$(7)$$ yields to coveted result

$$\bbox[5px,border:2px solid #C0A000]{\int_0^\infty \frac{|\sin(\sqrt{qx})|-|\sin(\sqrt{px})|}{x}\,dx=\frac2\pi \log(q/p)}$$

NOTE: The approach in the Methodology $$2$$ is generalized in This Answer.

I also posted the question on Quora, and Joel Campbell proved the result, see the answer on Quora. In short, it starts with a change of variable $$x=y^2$$, uses the Fourier series $$|\sin u|=\frac{2}{\pi} - \frac{4}{\pi}\sum_{n=1}^\infty \frac{\cos(2nu)}{4n^2-1}$$, and the fact that $$\int_0^\infty \frac{\cos(ax)-\cos(bx)}{x}dx = \log\frac{b}{a}$$.

• Hi Vincent. I noticed that Joel Campbell posted a supplementary solution that uses the Laplace Transform. Any way, now we have three quite different approaches to evaluate the integral. I'd be interested in seeing yet a fourth. ;-) I hope that you're staying safe and healthy. – Mark Viola Jul 2 at 18:05
• Thanks Mark. When I first looked into that integral (and somehow came up with a value) I was not sure it made any sense. – Vincent Granville Jul 2 at 20:40
• Hi Vincent. I hope that you are doing well and staying safe and healthy. I just added another way forward that is, I believe, the easiest by far. It relies on integration by parts and converts the integral of interest into a standard Frullani integral. The method can be easily be made general. Let me know your thoughts. ;-) – Mark Viola Jul 5 at 16:45
• Hi Vincent. I just posted a question entitled "An Extended Frullani Integral." If you have a chance, I'd enjoy hearing your comments/answer. – Mark Viola Jul 5 at 17:34