Alternate proof of Dirichlet integral $\frac{\sin(x)}{x}$. 
Prove:
  $$\int_{0}^{\infty} \frac{\sin(x)}{x} dx=\frac{\pi}{2}$$
  starting with the facts that:
  $$\int_{-\pi}^{\pi}D_N(\theta)=2\pi, \ \ \ \ \ \text{and  }\ f(\theta)=\frac{1}{\sin(\frac{\theta}{2})}-\frac{2}{\theta}\ \text{ is continuous on} \ [-\pi, \pi] $$
  (apply the Riemann-Lebesgue lemma)

I realize there are many different proofs of this fact already but I haven't seen one using the given facts. 
What I have so far is that as is given:
$$\int_{- \pi}^{\pi} \frac{\sin((N+\frac{1}{2})\theta)}{\sin(\frac{\theta}{2})} =2\pi$$
and in order to use the Riemann-Lebesgue lemma I need to find a useful function $g(x)$ and use $\lim_{n \to \infty} \hat{g}(n)=0$. Given what I know, it seems like if I were able to have:
$$\hat{g}(n) =\int_{0}^{n} \frac{\sin(x)}{x}dx -\frac{\pi}{2}  $$
then I would be done, so I attempted to find the Fourier coefficients of the given $f(\theta)$ but this did not seem particularly fruitful.
 A: You can start by integrating the trigonometric form of the Dirichlet kernel.
$$\int_{-\pi}^{\pi}D_N(x)dx=2\pi=\int_{-\pi}^{\pi}\frac{\sin((N+1/2)x)}{\sin(x/2)}dx$$
Rewrite the integrand to make use of the second fact from the prompt.
$$\int_{-\pi}^{\pi}\sin((N+1/2)x)(\frac{1}{\sin(x/2)}-\frac{2}{x}+\frac{2}{x})dx=2\pi$$
Split up the integral and consider the limit as $N\to\infty$.
$$\lim_{N\to\infty}\left[\int_{-\pi}^{\pi}\sin((N+1/2)x)(\frac{1}{\sin(x/2)}-\frac{2}{x})dx+\int_{-\pi}^{\pi}\sin((N+1/2)x)(\frac{2}{x})dx\right]=2\pi$$
The first integral vanishes in the limit per the Riemann-Lebesgue lemma. The second has an even integrand, so take the part from zero to $\pi$ and simplify.
$$\lim_{N\to\infty}\int_{0}^{\pi}\sin((N+1/2)x)(\frac{1}{x})dx=\frac{\pi}{2}$$
Finally, change variables to $y=(N+1/2)x$.
$$\lim_{N\to\infty}\int_{0}^{(N+1/2)\pi}\frac{\sin(y)}{y}dy=\frac{\pi}{2}$$
A: Here's a simplified version of a proof with which Richard Feynman popularised differentiation under the integral sign among physicists, who to this day call it Feynman's trick. (He integrated $\int_0^\infty\sin x\,e^{-xy}dx$ with respect to $y$, but we can make it simpler.) Using $\dfrac{1}{x}=\int_0^\infty e^{-xy}dy$ we have $$\int_0^\infty\frac{\sin x}{x}dx=\int_0^\infty dy\int_0^\infty dx \,e^{-xy}\sin x=\int_0^\infty \frac{dy}{1+y^2}=\frac{\pi}{2}.$$
A: Rewrite the original integral 
$$\int^{\infty}_0\frac{\sin x}{x}\,dx=\sum_{k=1}^{\infty}\int^{k\pi}_{(k-1)\pi}\frac{\sin x}{x}\,dx$$
You can show that the above alternating series is convergent by some appropriate convergence test. Denote by $$S_n:=\sum_{k=1}^{n}\int^{k\pi}_{(k-1)\pi}\frac{\sin x}{x}\,dx$$
Let $b\geqslant\pi$ then there is an integer $n$ such that $n\pi\leqslant b<(n+1)\pi$. Then we have the following
$$S_n\leqslant \int^b_0\frac{\sin x}{x}\,dx\leqslant S_{n+1}$$
Since the alternating series above is convergent i.e. $\lim_n S_n$ exists then it follows that 
$$\lim_{b\to\infty}\int^b_0\frac{\sin x}{x}\,dx=\lim_nS_n=\int^{\infty}_0\frac{\sin x}{x}\,dx$$
From the given condition 
$$\int^{\pi}_{-\pi}\frac{\sin(n+1/2)x}{\sin x/2}\,dx=2\pi$$
and the deinition of $f(x)$ we get
$$2\int^{\pi}_{-\pi}\frac{\sin(n+1/2)x}{x}\,dx=\int^{\pi}_{-\pi}\frac{\sin(n+1/2)x}{\sin x/2}\,dx-\int^{\pi}_{-\pi}f(x)\sin(n+1/2)x\,dx$$
Since $f(x)$ is continous on $[-\pi,\pi]$ then it is integrable on this interval which is compact (by Weierstrass maximum is attained so it is bounded etc.). By Lebesgue-Riemann lemma then it follows that 
$$\lim_{n\to\infty}\int^{\pi}_{-\pi}f(x)\sin(n+1/2)x\,dx=0$$
Therefore we obtain 
$$2\lim_n\int^{\pi}_{-\pi}\frac{\sin(n+1/2)x}{x}\,dx=\lim_n\int^{\pi}_{-\pi}\frac{\sin(n+1/2)x}{\sin x/2}\,dx=\lim_n 2\pi=2\pi$$
This finally yields
$$\pi=\lim_n\int^{\pi}_{-\pi}\frac{\sin(n+1/2)x}{x}\,dx=\lim_n\int^{(n+1/2)\pi}_{-(n+1/2)\pi}\frac{\sin x}{x}\,dx=\int^{\infty}_{-\infty}\frac{\sin x}{x}\,dx$$
But $\sin x/x$ is an even function (since both $\sin x$ and $x$ are odd) therefore
$$\int^{\infty}_{-\infty}\frac{\sin x}{x}\,dx=2\int^{\infty}_{0}\frac{\sin x}{x}\,dx\Rightarrow \int^{\infty}_{0}\frac{\sin x}{x}\,dx=\frac{\pi}{2}$$
