I came across this integral when doing calculus homework (Integration by parts) $$\int \frac{\cos x}x \, dx $$ It turned out in the end that there was a typo in the original question and this integral is not actually necessary, but I was curious and decided to attempt it. My first step was to turn cosine into its series and divide by X to leave a polynomial (series) that is easy to integrate. After doing so, I was left with this but without the symbol on the left. After some googling, I discovered that the actual integral is what I thought it was + the Euler-Mascheroni constant. Can anyone tell me why the constant is there?

For backround information, I am currently a senior in High School taking Calculus. So I don't have extensive knowledge of more complicated methods like linear or abstact algebra.

  • 7
    $\begingroup$ In order to discuss constants, you need to clarify what are the bounds of integration you are interested in. $\endgroup$
    – Doug
    Commented Jan 19, 2023 at 17:28
  • 1
    $\begingroup$ The result is supposedly shown in this book by Havil, according to MathWorld's CosineIntegral entry. $\endgroup$
    – user170231
    Commented Jan 19, 2023 at 17:39
  • 1
    $\begingroup$ This integral representation also has $\gamma$. Also, Wolfram functions assumes $\int_\infty^z\frac{\cos(t)}t dt=\text{Ci}(z)$ as integration bounds $\endgroup$ Commented Jan 19, 2023 at 18:21

1 Answer 1


$\newcommand{\ci}{\operatorname{Ci}}\newcommand{\cin}{\operatorname{Cin}}\newcommand{\d}{\,\mathrm{d}}$You want to know why, for $z>0$: $$\int_z^\infty\frac{\cos(t)}{t}\,\mathrm{d}t=-\gamma-\ln z-\sum_{n\ge1}^\infty(-1)^n\frac{z^{2n}}{2n\cdot(2n)!}=-\gamma-\ln z+\int_0^z\frac{1-\cos(t)}{t}\,\mathrm{d}t$$

This is not at all obvious. I do have a proof in my notes I took from two years ago, I'll share it here. I probably found this proof somewhere obvious but a quick explore with Approach0 hasn't shown any duplicates.

Let's define: $$\begin{align}\cin(x)&=\int_0^x\frac{1-\cos t}{t}\d t\\\ci(x)&=-\int_x^\infty\frac{\cos t}{t}\d t\end{align}$$For positive real $x$. We want to show: $$\cin(x)+\ci(x)=\gamma+\ln x$$For all $x>0$. As a corollary (this was the result I originally had wanted to research): $$\lim_{x\to0^+}\ci(x)-\ln x=\gamma$$Since $\cin(x)\in o(x)$ as $x\to0^+$.

Let $n\in\Bbb N$ be arbitrary and $t=2\pi n u$ in the integrand of $\cin$: $$\begin{align}\cin(\pi n)&=\int_0^{1/2}\frac{1-\cos2\pi n u}{u}\d u\\&=\pi\int_0^{1/2}\frac{1-\cos2\pi nu}{\sin\pi u}\d u+\int_0^{1/2}f(u)\d u-\int_0^{1/2}f(u)\cdot\cos2\pi n u\d u\\&=2\pi\sum_{k=1}^n\int_0^{1/2}\sin((2k-1)\pi u)\d u+\left[\ln\left(u\cot\left(\frac{\pi}{2}u\right)\right)\right]_0^{1/2}\\&\quad\quad-\int_0^{1/2}f(u)\cos2\pi nu\d u\\&=2\sum_{k=1}^n\frac{1}{2k-1}+\ln\pi-2\ln2-\int_0^{1/2}f(u)\cos2\pi nu\d u\end{align}$$Where: $$f:[0,1/2]\ni u\mapsto\begin{cases}0&u=0\\u^{-1}-\pi\csc\pi u&u>0\end{cases}\in\Bbb R$$Is a continuous function, and we used: $$\begin{align}2\sum_{k=1}^n\sin((2k-1)\pi u)&=2\Im\left[e^{-i\pi u}\sum_{k=1}^ne^{2\pi i ku}\right]\\&=2\Im\left[e^{i\pi u}\cdot\frac{e^{2\pi i nu}-1}{e^{2\pi i u-1}}\right]\\&=2\Im\left[e^{\pi inu}\cdot\frac{2i}{e^{\pi i u}-e^{-\pi i u}}\cdot\frac{e^{\pi i nu}-e^{-\pi i nu}}{2i}\right]\\&=2\Im\left[e^{\pi i nu}\frac{\sin(\pi nu)}{\sin(\pi u)}\right]\\&=\frac{2\sin^2(\pi nu)}{\sin(\pi u)}\\&=\frac{1-\cos(2\pi nu)}{\sin(\pi u)}\end{align}$$For all suitable values of $u$.

Now define: $$\begin{align}c_n&:=\cin(\pi n)-\ln(\pi n)=\int_0^1\frac{1-\cos t}{t}\d t+\int_1^{\pi n}\frac{1-\cos t}{t}\d t-\ln(\pi n)\\&=\cin(1)-\int_1^{\pi n}\frac{\cos t}{t}\d t\end{align}$$For all $n\in\Bbb N$.

It follows that $\lim_{n\to\infty}c_n=\cin(1)+\ci(1)$. But: $$c_n=2\sum_{k=1}^n\frac{1}{2k-1}-\ln n-2\ln2-\int_0^{1/2}f(u)\cos(2\pi nu)\d u$$

Using: $$\lim_{n\to\infty}2\sum_{k=1}^{4n}\frac{1}{k}-2\ln4n=2\gamma,\,\lim_{n\to\infty}\sum_{k=1}^{2n}\frac{1}{k}-\ln2n=\gamma$$A subtraction gives: $$\lim_{n\to\infty}2\sum_{k=1}^{2n}\frac{1}{2k-1}-\ln n-3\ln 2=\gamma,\,\lim_{n\to\infty}2\sum_{k=1}^n\frac{1}{2k-1}-\ln n=\gamma+2\ln 2$$

The above used the definition of $\gamma$ as the limiting difference between the natural logarithm and the harmonic numbers, some sum manipulations, and the results: $$\begin{align}\lim_{n\to\infty}\sum_{k=n+1}^{2n}\frac{2}{2k-1}&=\lim_{n\to\infty}\sum_{k=1}^{n}\frac{2}{2n+2k-1}\\&=\lim_{n\to\infty}\frac{1}{n}\sum_{k=1}^{n}\frac{1}{1+\frac{2k-1}{2n}}\\&=\int_0^1\frac{1}{1+x}\d x\\&=\ln2\\2\sum_{k=1}^{4n}\frac{1}{k}-\sum_{k=1}^{2n}\frac{1}{k}&=2\sum_{k=1}^{2n}\frac{1}{2k-1}\end{align}$$

By the Riemann-Lebesgue lemma (or just integrating by parts) we see: $$\lim_{n\to\infty}\int_0^{1/2}f(u)\cos2\pi n u\d u=0$$Hence: $$\lim_{n\to\infty}c_n=\gamma$$

Then for any $x>0$ we have: $$\begin{align}\gamma&=\lim_{n\to\infty}c_n\\&=\cin(1)+\ci(1)\\&=\color{red}{\int_0^x\frac{1-\cos t}{t}\d t}+\int_x^1\left(\color{brown}{\frac{1}{t}}-\color{blue}{\frac{\cos t}{t}}\right)\d t-\int_1^x\color{blue}{\frac{\cos t}{t}}\d t\color{orange}{-\int_x^\infty\frac{\cos t}{t}\d t}\\&=\color{brown}{-\ln x}+\color{red}{\cin(x)}+\color{orange}{\ci(x)}+\color{blue}{0}\end{align}$$

Finally concluding: $$\cin(x)+\ci(x)=\gamma+\ln x$$For all real $x>0$, as was to be shown.


  • $\begingroup$ how do I show $\lim_{n\to\infty}\int_0^{1/2}f(u)\cos2\pi n u \d u=0$ using integration by parts? I have tried differentiating $f(u)$ and Integrating $\cos(2\pi nu)$, but can't seem to derive the result. $\endgroup$ Commented May 15, 2023 at 7:54
  • 1
    $\begingroup$ @jphys $f$ is an analytic function on $[0,1/2]$: its derivative is in particular continuous and bounded on this interval. $\sin(2\pi nu)$ vanishes as $u=0,1/2$ so one round of integration by parts gives the expression: $$-\frac{1}{2\pi n}\int_0^{1/2}f’(u)\sin(2\pi n u)\,\mathrm{d}u$$The integrand is bounded! So this expression is bounded in magnitude by a constant multiple of $1/n$ and as such it vanishes as $n\to\infty$. $\endgroup$
    – FShrike
    Commented May 15, 2023 at 8:18
  • 1
    $\begingroup$ P.S. \d is not natively supported here on MSE so I always use \newcommand{\d}{\,\mathrm{d}} at the beginning of my posts so that I can use \d to easily write nice integral or derivative notation $\endgroup$
    – FShrike
    Commented May 15, 2023 at 8:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .