How do we show that the given result by Mathematica is correct?

$$\int_{0}^{\infty}{\cos(x^n)-\cos(x^{2n})\over x}\cdot{\ln{x}}\mathrm dx={12\gamma^2-\pi^2\over 2(4n)^2}\tag1$$ $n>0$

Where $\gamma=0.577216...$

I would try substitution, because it may help to simplify the problem into a manage integral to deal with.



$${1\over n}\int_{0}^{\infty}{\cos(u)-\cos(u^2)\over u^{1\over n}}\cdot{\ln{u^{1\over n}}}{\mathrm dx\over u^{n-1\over n}}={12\gamma^2-\pi^2\over 2(4n)^2}$$

Simplified to

$${1\over n^2}\int_{0}^{\infty}{\cos(u)-\cos(u^2)\over u}\cdot{\ln{u}}\mathrm du={12\gamma^2-\pi^2\over 2(4n)^2}$$

We can remove $\ln{u}$ by doing another substitution



$${1\over n^2}\int_{-\infty}^{\infty}{\cos(e^v)-\cos(e^{2v})\over e^v}\cdot{v}\cdot{e^v}\mathrm du={12\gamma^2-\pi^2\over 2(4n)^2}$$

Then we finally simplified to

$$={1\over n^2}\int_{-\infty}^{\infty}v\cos(e^v)\mathrm dv -{1\over n^2}\int_{-\infty}^{\infty}v\cos(e^{2v})\mathrm dv$$

At this stage I would apply integration by parts but it seems to show a problem for me to do. So I need some help. Thank you.


Define $$\mathcal{I}=\int_{0}^{\infty }\frac{\cos x-\cos x^2}{x}\, \ln x\, \mathrm{d}x$$ and $$\mathcal{I}\left ( \alpha \right )=\int_{0}^{\infty }x^{\alpha-1}\left ( \cos x-\cos x^{2} \right )\mathrm{d}x$$ and $\mathcal{I}\left(0\right)=-\dfrac{\gamma}{2} $, see a proof here.

Now let's see the integral below

$$\int_{0}^{\infty}x^{a-1}\cos\left(x^{b}\right)\,\mathrm{d}x=\frac{1}{b}\cos\left(\frac{\pi a}{2b}\right)\Gamma \left(\frac{a}{b} \right), \;\ b>a, \;\ a>1$$

Proof: Let $\displaystyle r = a/b \in (0, 1)$. Then \begin{align*} &\int_{0}^{\infty} x^{a-1} \cos(x^{b}) \, \mathrm{d}x = \frac{1}{b} \int_{0}^{\infty} \frac{\cos t}{t^{1-r}} \, \mathrm{d}t = \frac{1}{b \Gamma(1-r)} \int_{0}^{\infty} \left( \int_{0}^{\infty} u^{-r} e^{-tu} \, \mathrm{d}u \right) \cos t \, \mathrm{d}t \\ &= \frac{1}{b \Gamma(1-r)} \int_{0}^{\infty} \left( \int_{0}^{\infty} e^{-ut} \cos t \, \mathrm{d}t \right) u^{-r} \, \mathrm{d}u = \frac{1}{b \Gamma(1-r)} \int_{0}^{\infty} \frac{u^{1-r}}{u^{2} + 1} \, \mathrm{d}u \\ &= \frac{1}{b \Gamma(1-r)} \int_{0}^{\frac{\pi}{2}} \tan^{1-r} \theta\,\mathrm{d}\theta \end{align*} Simplifying using the beta function identity, we have \begin{align*} \int_{0}^{\infty} x^{a-1} \cos(x^{b}) \, \mathrm{d}x &= \frac{\Gamma\left(1-\dfrac{r}{2}\right)\Gamma\left(\dfrac{r}{2}\right)}{2b \Gamma(1-r)\Gamma(r)} \, \Gamma(r)= \frac{ \sin (\pi r)}{2b \sin \left(\dfrac{\pi r}{2}\right)} \, \Gamma(r) = \frac{1}{b} \Gamma(r) \cos \left( \frac{\pi r}{2} \right)\\ &=\frac{1}{b}\cos\left(\frac{\pi a}{2b}\right)\Gamma \left(\frac{a}{b} \right) \end{align*} Hence $$\mathcal{I}\left ( \alpha \right )=\Gamma \left ( a \right )\cos\left ( \frac{a\pi }{2} \right )-\frac{1}{2}\Gamma \left ( \frac{a}{2} \right )\cos\left ( \frac{a\pi }{4} \right )$$ Using

$$\Gamma \left ( x \right )\sim \frac{1}{x}-\gamma +\frac{6\gamma ^{2}+\pi ^{2}}{12}x+o(x)$$

Proof: \begin{align*} \lim_{x\to 0}x\Gamma(x)=\lim_{x\to 0}\Gamma(1+x)=1 \end{align*} \begin{align*} \lim_{x\to 0}\Gamma(x)-\frac{1}{x}&=\lim_{x\to 0}\frac{x\Gamma(x)-1}{x}\\ &=\lim_{x\to 0}\Gamma(x+1)\psi (x+1)=-\gamma\\ \end{align*} \begin{align*} \lim_{x\to 0}\frac{1}{x}\left(\Gamma(x)-\frac{1}{x}+\gamma\right)&=\lim_{x\to 0}\frac{\Gamma(x+1)-1+\gamma x}{x^2}\\ &=\lim_{x\to 0}\frac{\Gamma(x+1)\psi(x+1)+\gamma }{2x}\\ &=\lim_{x\to 0}\frac{\Gamma(x+1)\psi^2(x+1)+\psi'(x+1)\Gamma(x+1)}{2}\\ &=\frac{1}{2}\left(\gamma^2+\frac{\pi^2}{6}\right) \end{align*}

So, we have \begin{align*} \mathcal{I}&=\mathcal{I}'\left(0\right)\\ &=\lim_{a\rightarrow 0}\frac{\mathcal{I}\left(a\right)-\mathcal{I}\left(0\right)}{a-0}\\ &=\frac{-\dfrac{1}{2}\cos\dfrac{a\pi}{4}\Gamma\left(\dfrac{a}{2}\right)+\cos\dfrac{a\pi}{2}\Gamma\left(a\right)+\dfrac{\gamma}{2}}{a}\\ &=\lim_{a\rightarrow 0}\frac{-\dfrac{1}{2}\left(1-\dfrac{a^2\pi^2}{32}+o\left(a^2\right)\right)\left(\dfrac{2}{a}-\gamma +\dfrac{1}{12}\left(6\gamma^2+\pi^2\right)\dfrac{a}{2}+o\left(a\right)\right)+\left(1-\dfrac{a^2\pi^2}{8}+o\left(a^2\right)\right)\left(\dfrac{1}{a}-\gamma +\dfrac{1}{12}\left(6\gamma^2+\pi^2\right)a+o\left(a\right)\right)+\dfrac{\gamma}{2}}{a}\\ &=\lim_{a\rightarrow 0}\frac{\dfrac{a\pi^2}{32}-\dfrac{a}{48}\left(6\gamma^2+\pi^2\right)-\dfrac{a\pi^2}{8}+\dfrac{a}{12}\left(6\gamma^2+\pi^2\right)+o\left(a\right)}{a}\\ &=\frac{3\gamma^2}{8}-\frac{\pi^2}{32} \end{align*} Hence $$\int_{0}^{\infty}{\cos x^n-\cos x^{2n}\over x}\, {\ln{x}}\, \mathrm dx={1\over n^2}\int_{0}^{\infty}{\cos x-\cos x^2\over x}\,{\ln x}\, \mathrm dx={12\gamma^2-\pi^2\over 2(4n)^2}$$

  • 1
    $\begingroup$ Neat solution. I used complex analysis (again) for this one and arrived at the same answer! It has always fascinated me when two different paths forward converge. Well done. (+1). -Mark $\endgroup$ – Mark Viola Jan 17 '17 at 2:38
  • $\begingroup$ I am very sure that your answer was up voted to around 17 the last time I saw it, how come now is 8? $\endgroup$ – user343373 Feb 7 '17 at 5:52

In THIS ANSWER, I used complex analysis to prove the identity

$$\int_0^\infty \frac{\cos(x)-\cos(x^2)}{x}\,dx=-\frac12 \gamma$$

We proceed analogously to tackle the problem of interest herein.

We begin with the integral $I(n)$ as given by

$$I(n)=\int_0^\infty \log(x)\,\frac{\cos(x^n)-\cos(x^{2n})}{x}\,dx \tag 1$$

Enforcing the substitution $x\to x^{1/n}$ into $(1)$ reveals

$$\begin{align} I(n)&=\frac{1}{n^2}\int_0^\infty \log(x)\,\frac{\cos(x)-\cos(x^2)}{x}\,dx\\\\ &=\frac{1}{n^2}\text{Re}\left(\int_0^\infty \log(x)\,\frac{e^{ix}-e^{ix^2}}{x}\,dx\right) \tag 2 \end{align}$$

Using Cauchy's Integral Theorem, we can show that (See the Note at the end of this post)

$$I(n)=\frac{1}{n^2}\int_0^\infty \frac{e^{-x}-e^{-x^2}}{x}\,\log(x)\,dx -\frac{3\pi^2}{32n^2}\tag 3$$

Integrating by parts the integral in $(3)$ with $u=e^{-x}-e^{-x^2}$ and $v=\frac12 \log^2(x)$ reveals

$$\begin{align} I(n)&=-\frac1{2n^2} \int_0^\infty \log^2(x)(e^{-x}-2xe^{-x^2})\,dx-\frac{3\pi^2}{32n^2}\\\\ &=-\frac{3}{8n^2}\Gamma''(1)-\frac{3\pi^2}{32n^2}\\\\ &=\frac{3}{8n^2}\left(\gamma^2+\pi^2/6\right)-\frac{3\pi^2}{32n^2}\\\\ &=\frac{3}{8n^2}\gamma^2-\frac{\pi^2}{32n^2} \end{align}$$

as was to be shown!


In arriving at $(3)$ we analyzed the integrals

$$\begin{align} \int_{\epsilon}^R \log(x)\,\frac{e^{ix}}{x}\,dx&=\int_0^{\pi/2} \log(\epsilon e^{i\phi})\,\frac{e^{i\epsilon e^{i\phi}}}{\epsilon e^{i\phi}}\,i\epsilon e^{i\phi}\,d\phi\\\\ &-\int_0^{\pi/2} \log(R e^{i\phi})\,\frac{e^{iR e^{i\phi}}}{R e^{i\phi}}\,iR e^{i\phi}\,d\phi\\\\ &+\int_\epsilon^R \log(ix)\,\frac{e^{-x}}{x}\,dx \tag 4 \end{align}$$


$$\begin{align} \int_{\epsilon}^R \log(x)\,\frac{e^{ix^2}}{x}\,dx&=\int_0^{\pi/4} \log(\epsilon e^{i\phi})\,\frac{e^{i\epsilon^2 e^{i2\phi}}}{\epsilon e^{i\phi}}\,i\epsilon e^{i\phi}\,d\phi\\\\ &-\int_0^{\pi/4} \log(R e^{i\phi})\,\frac{e^{iR^2 e^{i2\phi}}}{R e^{i\phi}}\,iR e^{i\phi}\,d\phi\\\\ &+\int_\epsilon^R \log(e^{i\pi/4}x)\,\frac{e^{-x^2}}{x}\,dx \tag 5 \end{align}$$

Combining the results of $(4)$ and $(5)$, taking the real part, and letting $\epsilon\to 0$ and $R\to \infty$ yields $(3)$.

  • $\begingroup$ (+1)It's also a nice approach! But I'm not familiar with complex analysis,so I prefer solving integrals with real methods. $\endgroup$ – Renascence_5. Jan 17 '17 at 2:45
  • $\begingroup$ @Renascence_5. I posted a question earlier today that asks for real analysis methods to prove $\int_0^\infty \frac{\cos(x)-\cos(x^2)}{x}\,dx=-\frac12 \gamma$. HERE it is. I requested refraining from tabulated results of special functions as much as possible. So, this approach might or might not be completely what I'm looking for. $\endgroup$ – Mark Viola Jan 17 '17 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy