What is $\int\limits_{-\infty}^{\infty} \frac{\cos(x)}{x} dx$ $$\int\limits_{-\infty}^{\infty} \frac{\cos(x)}{x} dx$$
I tried thinking along the following lines, but I get conflicting answers...


*

*$\frac{\cos(x)}{x}$ is an odd function. So the integral must be $0$ (Or does the value of this function being infinite at origin invalidate my assumption?)

*The integral is nothing but the fourier transform of this function evaluated at origin (in transform domain). When I plot the FT, it is $0$ at origin.

*But when I use the Cosine integral formula, $C_i(\infty) - C_i(-\infty)$, I get the result as $-i \pi$.


My question: Is the integral $0$ or $-i \pi$?
 A: To answer this question properly, one must make it precise that what do we mean by the integral of such function on $(-\infty,\infty)$. Riemann integrability are defined for bounded functions on closed and bounded subsets $[a,b]$ of $\mathbb R$. In case when we have interval like $[a,\infty)$, we say that a bounded function $f$ is improperly integrable if $f$ is integrable on every $[a,b]$ where $b>a$ and the following limit $$\lim_{b\to\infty}\int_a^b f(x)dx,$$ and in which case we say refer the improper integral as the above limit. 
In cases where $f(x)$ is unbounded on an endpoint $[a,b]$, say $\lim_{x\to a}f(x)$ tends to infinity, but $f(x)$ is integrable on every $[c,b]\subsetneq [a,b]$. If $$\lim_{c\to a}\int_c^b f(x)dx$$ exists. Then we refer the improper integral $\int_a^b f(x)dx$ to the above limit.
Now back to your question. If the integral exists, we can split it into $\int_0^{\infty}\frac{\cos x}x dx+\int_{-\infty}^0 \frac{\cos x}x dx$, and consider the two integrals separately. We can show that $\lim_{b\to\infty}\int_a^b \frac{\cos x}x dx$ exists for any $a>0$ by an epsilon argument. Given any $\epsilon>0$, we can find an $M>a$ such that for any $M_2>M_1>M$, we have $|\int_{M_1}^{M_2} f(x) dx|<\epsilon$. You can estimate the value of $M$ by considering integration by parts. However $\lim_{a\to 0}\int_a^{\infty} \frac{\cos x}x dx$ does not exist, to see this, it suffices to show that $\int_{a_1}^{a_2} \frac{\cos x}x dx$ can get arbitrarily big when we consider $a_1,a_2$ near $0$. So let's take $1>a_2>a_1>0$, then we can compare $\int_{a_1}^{a_2}\frac{\cos x}x dx>\int_{a_1}^{a_2} \frac{\cos(1)}x dx$. The latter is clearly divergent as we take limit as $a_1\to 0$. So that concludes that $\int_0^{\infty}\frac{\cos x}x dx $ is not improperly integrable. So in standard view of the integral, we would say that the original integral is undefined. 
A: 
The integral fails to exist as a Lebesgue integral and does not converge as an improper Riemann integral.  However, its Cauchy Principal Value (CPV) is $0$.

To see this, we write the Cauchy Principal Value of the integral as
$$\begin{align}
\text{PV}\left(\int_{-\infty}^\infty \frac{\cos(x)}{x}\,dx\right)&=\lim_{L\to\infty\\\epsilon\to 0^+}\left(\int_{-L}^{-\epsilon}\frac{\cos(x)}{x}\,dx+\int_{\epsilon}^L \frac{\cos(x)}{x}\,dx\right)\\\\
&=\lim_{L\to\infty\\\epsilon\to 0^+}\left(-\int_{\epsilon}^L\frac{\cos(x)}{x}\,dx+\int_{\epsilon}^L \frac{\cos(x)}{x}\,dx\right)\tag1
&=0
\end{align}$$


We can also evaluate the CPV of $\int_{-\infty}^\infty\frac{e^{ix}}{x}\,dx$, which is the Fourier Transform of $\frac1x$, $F(k)=\int_{-\infty}^\infty \frac{e^{ik x}}{x}\,dx$ evaluated at $k=1$.

Note that we can write
$$\begin{align}
\text{PV}\left(\int_{-\infty}^\infty \frac{e^{ix}}{x}\,dx\right)&=\lim_{L\to\infty\\\epsilon\to 0^+}\left(\int_{-L}^{-\epsilon}\frac{e^{ix}}{x}\,dx+\int_{\epsilon}^L \frac{e^{ix}}{x}\,dx\right)\\\\
&=\lim_{L\to\infty\\\epsilon\to 0^+}\left(-\int_{\epsilon}^L\frac{e^{-ix}}{x}\,dx+\int_{\epsilon}^L \frac{e^{ix}}{x}\,dx\right)\\\\
&=2i \lim_{L\to\infty\\\epsilon\to 0^+}\int_\epsilon^L\frac{\sin(x)}{x}\,dx\\\\
&=i\pi
\end{align}$$

The Fourier Transform, $F(k)$, of $f(x)=\frac{\cos(x)}{x}$ is given by the CPV
$$\begin{align}
F(k)&=\mathscr{F}\{f\}(k)\\\\
&=\text{PV}\left(\int_{-\infty}^\infty \frac{\cos(x)}{x}\,e^{ikx}\,dx\right)\\\\
&=\frac12\text{PV}\left(\int_{-\infty}^\infty \frac{e^{i(k+1)}+e^{i(k-1)}}{x}\,dx\right)\\\\
&=i\frac\pi2 \left(\text{sgn}(k+1)+\text{sgn}(k-1)\right)\\\\
\end{align}$$
from which we see that $F(0)=0$.


The Cosine Integral $\text{Ci}(x)$ is defined for $x>0$ as
$$\text{Ci}(x)=-\int_x^\infty \frac{\cos(x')}{x'}\,dx'$$
or alternatively as
$$\text{Ci}(x)=\gamma+\log(x)+\int_0^x \frac{\cos(x')-1}{x'}\,dx'\tag2$$

The last term on the right-hand side of $(2)$ is analytic and we may use $(2)$ to define the Cosine Integral as an analytic function of the complex variable $x$ such that $-\pi<\arg(x)<\pi$ (i.e., on the principal branch of the complex logarithm function).
Notice that if we choose the Principal Branch of the complex logarithm function, then it is easy to see from $(2)$ that
$$\text{Ci}(-|x|+i0^\pm)=\text{Ci}(|x|)\pm i\pi\tag3$$
Taking the limit as $|x|\to \infty$ in $(3)$, we find
$$\text{Ci}(-\infty+i0^\pm)=\pm i\pi\tag4$$
Alternatively, we can arrive at $(4)$ by writing $\text{Ci}(-\infty+i0^\pm)$ as
$$\begin{align}
\text{Ci}(-\infty+i0^\pm)&=-\lim_{L\to\infty\\\epsilon\to 0^+}\left(\int_{-L}^{-\epsilon}\frac{\cos(x)}{x}\,dx+\int_{\pm \pi}^0 \frac{\cos(\epsilon e^{i\phi})}{\epsilon e^{i\phi}}\,i\epsilon e^{i\phi}\,d\phi+\int_{\epsilon}^L \frac{\cos(x)}{x}\,dx\right)\\\\
&=\pm i\pi
\end{align}$$
A: I think that the value of this integral is 0, first you can use your first argument, is an odd  function and goes from minus infinity to infinity.
Also you can separate the integral
$$\int\limits_{-\infty}^{\infty} \frac{\cos(x)}{x} dx=\int\limits_{0}^{\infty} \frac{\cos(x)}{x} dx+\int\limits_{-\infty}^{0} \frac{\cos(x)}{x} dx$$
we can rewrite the second integral with -x=y.Then we left with 
$$\int\limits_{0}^{\infty} \frac{\cos(y)}{y} dx$$ 
and its the same put y or x because the result is a constant, that not depends in the variable  we use.So we left with
$$\int\limits_{0}^{\infty} \frac{\cos(x)}{x} dx-\int\limits_{0}^{\infty} \frac{\cos(x)}{x} dx$$
that is magically canceled.
