Prove that: $\int_0^{\infty}\sin x\, dx=1$ and $\int_0^{\infty}\cos x\,dx=0.$ Recently I was solving some problems on Fourier transform and in one of the problems I encountered the following integral:$$\int_0^{\infty}\cos x\,dx.$$ Surely the integral does not converge and also they are not Riemann integrable, according to me. Then I searched for it online and found out the two results mentioned in title. But the proof was done by Complex analysis. I haven't studied Complex analysis yet so was unable to understand those proofs. But seeing those proofs I got an idea to evaluate the integrals as follows:$$\int_0^{\infty}e^{-ix}\,dx=\frac1{-i}\Big[e^{-ix}\Big]_0^{\infty}=-i.$$Thus comparing real and imaginary parts,  we have:$\displaystyle\int_0^{\infty}\cos x\,dx=0$ and $\displaystyle\int_0^{\infty}\sin x\, dx=1.$
Is this a proper approach?
[Another approach which I could think of, uses the following property of Laplace Transform:
If $\mathscr{L}\{f(t)\}=\bar f(s).$ Then $$\int_0^{\infty}\bar f(s)\,ds=\int_0^{\infty}\frac{f(t)}t\, dt.$$ Letting $f(t)=t\sin t$ yeilds $\int_0^{\infty}\sin t\,dt=1$ and letting $f(t)=t\cos t$ yeilds $\int_0^{\infty}\cos t\, dt=0.$]
 A: By inserting a factor $e^{-\lambda x},$ where $\lambda>0,$ the integrals can be made convergent. The results will be analytical expressions in terms of $\lambda,$ which are valid also for $\lambda=0.$
For the cosine integral we get
$$\begin{align}
C(\lambda)
&:= \int_0^\infty e^{-\lambda x} \cos x \, dx \\
&= \left[ e^{-\lambda x} \sin x \right]_0^\infty - \int_0^\infty (-\lambda e^{-\lambda x}) \sin x \, dx \\
&= \lambda \int_0^\infty e^{-\lambda x} \sin x \, dx \\
&= \lambda \left( \left[ e^{-\lambda x} (-\cos x) \right]_0^\infty - \int_0^\infty (-\lambda e^{-\lambda x}) (-\cos x) \, dx \right) \\
&= \lambda \left( 1 - \lambda\int_0^\infty e^{-\lambda x} \cos x \, dx \right) \\
&= \lambda \left( 1 - \lambda C(\lambda) \right) \\
\end{align}$$
Thus $C(\lambda) = \frac{\lambda}{1+\lambda^2}$ so $C(0) = 0.$
Likewise, for the sine integral we get
$$\begin{align}
S(\lambda)
&:= \int_0^\infty e^{-\lambda x} \sin x \, dx \\
&= \left[ e^{-\lambda x} (-\cos x) \right]_0^\infty - \int_0^\infty (-\lambda e^{-\lambda x}) (-\cos x) \, dx \\
&= 1 - \lambda \int_0^\infty e^{-\lambda x} \cos x \, dx \\
&= 1 - \lambda \left( \left[ e^{-\lambda x} \sin x \right]_0^\infty - \int_0^\infty (-\lambda e^{-\lambda x}) \sin x \, dx \right) \\
&= 1- \lambda^2 \int_0^\infty e^{-\lambda x} \sin x \, dx \\
&= 1 - \lambda^2 S(\lambda) \\
\end{align}$$
Thus, $S(\lambda) = \frac{1}{1+\lambda^2}$ so $S(0) = 1.$
A: Note that $$\lim_{x \to \infty} e^{-ix}$$doesn't exist. You can see that using $e^{-ix} = -i\sin(x) + \cos (x)$. Increasing $x$ rotates the point $P(\cos x , -\sin x)$ around a unit circle. Alternatively, let $x = n\pi$ then $e^{-i x} = (-1)^n$ and this is a divergent sequence. Some related questions: 1 , 2 and 3.
We should use the generalized Fourier transform in the case of $f(x) = \cos(2\pi a x)$ and $g(x) =\sin(2\pi a x)$ because as improper Riemann integral, the integrals are divergent.
Let $$\mathcal{F}\{f(x)\} = \int_{-\infty}^{\infty}f(x)e^{-2\pi i sx}dx$$So we have $$\mathcal{F}\{\cos(2\pi a x)\} = \mathcal{F}\{\frac{e^{2\pi i x a} + e^{-2\pi i x a}}{2}\} = \frac{1}{2}(\delta(s-a) + \delta(s+a))$$It is true in the sense of distributions. For complete explanation, refer to this and this.
