How to treat $\int_{0}^{\infty} \sin(kx)dx =\frac {1}{k}$ as a distribution? How to evaluate the following integral? 
$\int_{0}^{\infty}  \sin(kx)dx=\frac 1 k$ 
The book Mathematical Physics by Butkov reads "The sequence $f_N(k)=\int_{0}^{N} \sin(kx) dx=\frac{(1-\cos kN)}k$diverges as N approaches $\infty$, but it is weakly convergent for a suitable chosen set of test functions $g(k)$ defined $0<k<\infty$."
The problem is how to choose the test function?
 A: Take $\varphi \in C_c^\infty ((0,\infty))$ and call $f_n(k) = \int_0^n \sin(ky) dy = \frac{1-\cos(nk)}{k}$.  We would like to show that
\begin{align*}
\lim_{n \to \infty} \int_{0}^\infty \varphi(k) f_n(k) dk = \int_{0}^\infty \varphi(k) \frac{1}{k} dk
\end{align*}
which would show that as distributions on $C_c^\infty ((0,\infty))$, $f_n(k) \to \frac{1}{k}$. It suffices to show that
\begin{align*}
\lim_{n \to \infty} \int_0^\infty \frac{\varphi(k)}{k}\cos(nk)dk = 0
\end{align*}
Notice that since $\varphi$ is a smooth function compactly supported away from $0$, $\frac{\varphi(k)}{k}$ is a continuous function of compact support on $\mathbb{R}$ and is therefore an $L^1$ function.  The result now follows from the Riemann Lebesgue Lemma.
A: We should calculate the limit: $\displaystyle\lim_{k\rightarrow\infty}\int_{0}^\infty\sin(kx)\phi(x)dx$ for every $\phi\in C_0^\infty(0, \infty)$, i.e, $\phi$ is a test function. Integration by parts implies that $$\displaystyle\lim_{k\rightarrow\infty}\int_{0}^\infty\sin(kx)\phi(x)dx$$
$$=-\displaystyle\lim_{k\rightarrow\infty}\int_{0}^\infty\frac{\cos(kx)}{k}\phi'(x)dx$$
and since $$\bigg|\int_{0}^\infty\frac{\cos(kx)}{k}\phi'(x)dx\bigg|\leq\frac{1}{k}\int_0^\infty\cos(kx)\phi'(x)dx\leq\frac{1}{k}\int_0^\infty|\phi'(x)|dx,$$
where the latter integral is finite (this is because $\phi(x)$ has a compact support in $(0, \infty)$), the result of the integral is zero as $k\rightarrow\infty$.
