# Evaluate this $\lim\limits_{n \to \infty}\int\limits_{1/n}^{n}\left(\cos x-\cos(x/2)\right)\frac{\ln x}{x}dx$

We seeking to evaluate this integral $$\lim_{n \to \infty}\int_{1/n}^{n}\left(\cos x-\cos(x/2)\right)\frac{\ln x}{x}\mathrm dx$$

using

$$\cos a -\cos b=-2\sin[(a+b)/2]\sin[(a-b)/2]$$

$$\lim_{n \to \infty}-2\int_{1/n}^{n}\sin\left(\frac{3x}{4}\right)\sin\left(\frac{x}{4}\right)\frac{\ln x}{x}\mathrm dx$$

I stuck, not sure what to do next.

$$v=\int \frac{\ln x}{x}=\frac{1}{2}\ln^2 x$$

$$u^{'}=-\sin x+\frac{1}{2}\sin(x/2)$$

$$\int \left(\cos x-\cos(x/2)\right)\frac{\ln x}{x}\mathrm dx=\left[\cos x-\cos(x/2)\right]\frac{\ln^2 x}{2}-\frac{1}{2}\int \left[-\sin x+\frac{1}{2}\sin(x/2)\right]\ln^2 x$$

this integral it getting more complicated due to $$\ln^2 x$$

• The result should be $$\gamma \log (2)-\frac{\log ^2(2)}{2}$$ – Dr. Sonnhard Graubner Jul 7 at 9:30

By letting $$t=x/2$$, we have that $$\int_{1/n}^{n}\cos(x/2)\frac{\ln (x)}{x}dx=\int_{1/(2n)}^{n/2}\cos(t)\frac{\ln(t) +\ln(2)}{t}dt$$ Hence \begin{align}\int_{1/n}^{n}\left(\cos x-\cos(x/2)\right)\frac{\ln(x)}{x}\,dx&= \int_{n/2}^{n}\frac{\cos(x)}{x}\ln(x)dx-\int_{1/(2n)}^{1/n}\frac{\cos(x)}{x}\ln(x)\,dx \\ &\qquad-\ln(2)\int_{1/(2n)}^{n/2}\frac{\cos(x)}{x}\,dx.\end{align} Now show that \begin{align} &\lim_{n\to \infty}\int_{n/2}^{n}\frac{\cos(x)}{x}\ln(x)\,dx=0,\\ &\lim_{n\to \infty}\int_{1/(2n)}^{1/n}\frac{\cos(x)-1}{x}\ln(x)\,dx=0. \end{align} Morever $$\lim_{n\to \infty}\left(\int_{1/(2n)}^{n/2}\frac{\cos(x)}{x}\,dx-\ln(n)\right) =\lim_{n\to \infty} (-\text{Ci}(\frac{1}{2n})-\ln(n))=\ln(2)-\gamma.$$ where $$\text{Ci}(x)$$ is the cosine integral (recall that $$\text{Ci}(x)=\ln(x)+\gamma+o(1)$$, as $$x\to 0$$).

Therefore $$\int_{1/(2n)}^{n/2}\frac{\cos(x)}{x}dx=\ln(n)+\ln(2)-\gamma+o(1),$$ and $$\int_{1/(2n)}^{1/n}\frac{\cos(x)}{x}\ln(x)\,dx =-\ln(2)\ln(n)-\frac{\ln^2(2)}{2}+o(1).$$ Thus we may conclude that $$\lim_{n \to \infty}\int_{1/n}^{n}\left(\cos x-\cos(x/2)\right)\frac{\ln (x)}{x} \, dx=\boxed{\gamma \ln (2)-\frac{\ln^2(2)}{2}}.$$


I'll "close" the integration around a quarter circle in the first quadrant with $$\ds{\left. z^{\nu}\right\vert_{\ {\large z\ \not=\ 0} \atop {\large\nu\ \in\ \pars{-1,1}}} = \verts{z}^{\nu}\expo{\ic\nu\arg\pars{z}}}$$ and $$\ds{\arg\pars{z} \in \pars{-1,1}}$$: \begin{align} &\bbox[10px,#fee]{\Re\int_{0}^{\infty}\pars{\expo{\ic x} - \expo{\ic x/2}}x^{\nu - 1}\,\dd x} \\[5mm] = &\ -\lim_{R \to \infty} \Re\int_{0}^{\pi/2}\bracks{\exp\pars{\ic R\expo{\ic\theta}} - \exp\pars{\ic\,{R\expo{\ic\theta} \over 2}}}\times \\[2mm] &\ R^{\nu - 1}\expo{\ic\pars{\nu - 1}\theta} R\expo{\ic\theta}\ic\,\dd\theta \\[5mm] &\ -\Re\int_{\infty}^{0}\pars{\expo{-y} - \expo{-y/2}} y^{\nu - 1}\expo{\ic\pars{\nu - 1}\pi/2}\ic\,\dd y \\[8mm] = &\ -\lim_{R \to \infty} \Re\int_{0}^{\pi/2}\bracks{\exp\pars{\ic R\expo{\ic\theta}} - \exp\pars{\ic\,{R\expo{\ic\theta} \over 2}}}\times \\[2mm] &\ R^{\nu - 1}\expo{\ic\pars{\nu - 1}\theta} R\expo{\ic\theta}\ic\,\dd\theta \\[5mm] &\ +\cos\pars{\nu\pi \over 2}\int_{0}^{\infty} \pars{\expo{-y} - \expo{-y/2}}y^{\nu - 1}\,\dd y \label{2}\tag{2} \end{align}

However,

\begin{align} 0 & < \verts{\int_{0}^{\pi/2}\exp\pars{\ic \Lambda\expo{\ic\theta}} \Lambda^{\nu - 1}\expo{\ic\pars{\nu - 1}\theta} \Lambda\expo{\ic\theta}\ic\,\dd\theta} _{\ \nu\ \in\ \pars{-1,1}} \\[5mm] & < \Lambda^{\nu}\int_{0}^{\pi/2} \exp\pars{-\Lambda\sin{\theta}}\,\dd\theta = {\pi \over 2}\, {1 - \exp\pars{-\Lambda} \over \Lambda^{1 - \nu}} \,\,\,\stackrel{\mrm{as}\ \Lambda\ \to\ \infty}{\to}\,\,\, \color{red}{0} \end{align}

such that the first term in the RHS of \eqref{2} vanishes out.

Then, \begin{align} &\bbox[10px,#fee]{\Re\int_{0}^{\infty}\pars{\expo{\ic x} - \expo{\ic x/2}}x^{\nu - 1}\,\dd x} = {1 - 2^{\nu} \over \nu}\cos\pars{\nu\pi \over 2}\Gamma\pars{\nu + 1} \end{align} With \eqref{1}, $$\bbx{\bbox[10px,#ffd]{\lim_{n \to \infty} \int_{1/n}^{n}\bracks{\cos\pars{x} -\cos\pars{x \over 2}}{\ln\pars{x} \over x}\,\dd x} = \gamma\ln\pars{2} - {1 \over 2}\,\ln^{2}\pars{2}}$$

Note that $$\ds{\gamma = -\Psi\pars{1}}$$.