Why $\frac{1}{2\pi}\int_{-\infty}^{\infty}e^{iw(t-x)}dw$ is the Dirac delta function? I'm reading a book that says:
$$f(x) = \int_{-\infty}^{\infty}f(t)\left\{\frac{1}{2\pi}\int_{-\infty}^{\infty}e^{iw(t-x)}dw\right\}dt$$
and then says that the term in curly brackets can be seen as the Dirac Delta Function. 
As I understand, the Dirac Delta Function should be $0$ when $t\neq x$, right? 
$$\delta(t-x) = \frac{1}{2\pi}\int_{-\infty}^{\infty}e^{iw(t-x)}dw$$
why this thing is $0$ when $t\neq x$?
 A: Suppose $f$ is absolutely integrable on $\mathbb{R}$. And suppose $f$ has left- and right-hand limits at $x$, as well as left- and right-hand derivatives at $x$. Then the classical Fourier inversion theorem gives
\begin{align}
     \frac{f(x-0)+f(x+0)}{2}&=\lim_{R\rightarrow\infty}\frac{1}{\sqrt{2\pi}}\int_{-R}^{R}e^{ixs}\hat{f}(s)ds \\
   &=\lim_{R\rightarrow\infty}\frac{1}{2\pi}\int_{-R}^{R}e^{ixs}\int_{-\infty}^{\infty}f(y)e^{-isy}dyds \\
   &=\lim_{R\rightarrow\infty}\int_{-\infty}^{\infty}f(y)\left(\frac{1}{2\pi}\int_{-R}^{R}e^{is(x-y)}ds\right)dy.
\end{align}
That's the precise meaning of--and the origin of--the notation
$$
      ``\frac{1}{2\pi}\int_{-\infty}^{\infty}e^{is(x-y)}ds\mbox{"}=\delta(x-y).
$$
If you interpret the notation in this way, you won't go wrong.
A: Let $$\phi_N(x) = \frac{1}{2\pi}\int_{-N}^N e^{i \omega x}d\omega = \frac{\sin(Nx)}{2\pi x} =  \frac{N}{2\pi}\text{sinc}(Nx)$$
Then for $f \in C^0 \cap L^1,f' \in L^1$ such that $\lim_{x \to \pm\infty} f(x) = 0$, we can use integration by parts to obtain
$$\int_{-\infty}^\infty f(x) \phi_N(x)dx = \frac{-1}{2\pi}\int_{-\infty}^\infty f'(x) \left(\int_{-\infty}^{Nx} \text{sinc}(y)dy\right) dx $$
And hence, with $A = \int_{-\infty}^\infty \text{sinc}(y)dy = 2\pi$
$$\lim_{N \to \infty} \int_{-\infty}^\infty f(x) \phi_N(x)dx = -\frac{1}{2\pi}\int_0^\infty f'(x) A dx = f(0)$$
Which is the definition of $\phi_N \to \delta$ in the sense of distributions
$\scriptstyle \text{(also note how this proves the Fourier inversion theorem)}$
A: Here's the funny thing: it clearly isn't zero. Using Euler (and simplifying by setting $x=0)$, it is equal to $$\frac{1}{2\pi}\int_{-\infty}^\infty (\cos(wt) + i\sin(wt))dw.$$ For $t\ne 0$, both the real and imaginary parts just oscillate and the integral does not converge. 
However, what they say does have some truth to it. First of all let's clear a misconception: although it gives a nice intuitive picture, the Dirac delta $\delta(t)$ is not a function that takes the value $0$ everywhere but the origin and is infinite at the origin with $\int_{-\infty}^\infty \delta(t) dt = 1.$ No function exists with these properties, and in fact the only "essential property" is the last one. 
The delta function is really a not a function at all, but a distribution (also called generalized function). Although there's a more rigorous approach, you can think of a generalized function as an object that exists only to be integrated against a legitimate function. The Dirac delta is an object that obeys the property $$ \int_{-\infty}^\infty \delta(t)\phi(t)dt = \phi(0)$$ for any function $\phi$ (in a certain class of nice functions). 
(In fact it's more proper to think of "integrating against the delta function" as a linear map on a vector space of functions that takes a function $\phi(t)$ and spits out $\phi(0).$)
That said, we see that based on the first identity they give you, that object has the essential property of the delta function. But as we've pointed out, the inner integral in the expression doesn't exist, so the identity needs to be scrutinized further. 
We can change the order of integration and rewrite the identity as $$ f(0) = \frac{1}{2\pi}\int_{-\infty}^\infty dw \int_{-\infty}^\infty f(t)e^{iwt}dt.$$ This identity has the merit of being plausible, unlike the first. Provided that the function $f(t)$ is nice and decays, the inner integral will exist (this is the Fourier transform of $f$) and then perhaps the result will be a nice decaying function of $w$ whose integral exists and happens to equal $f(0).$ This happens to be true (it is just a case of the theorem about inverting Fourier transforms), but how to show it?
Well if we were being glib, we'd change the order back and use the delta function identity, but that would be begging the question. Instead, we can anticipate our problem and use a convergence factor from the get go like so: $$ \frac{1}{2\pi}\int_{-\infty}^\infty dw \int_{-\infty}^\infty f(t)e^{iwt}dt = \lim_{\epsilon\to 0}\frac{1}{2\pi}\int_{-\infty}^\infty dw e^{-\frac{1}{2}\epsilon^2w^2}\int_{-\infty}^\infty f(t)e^{iwt} dt \\= \lim_{\epsilon\to 0}\frac{1}{2\pi}\int_{-\infty}^\infty dt f(t) \int_{-\infty}^\infty e^{-\frac{1}{2}w^2\epsilon^2 + iwt}dw. $$ (We've been a bit sloppy and would need to justify a number of things, like bringing the limit outside the integral, changing of order of integration, and taking care with the distinction between integrals over $\mathbb R^2$ and iterated 1d integrals, but let's just say it works.) 
Now our inner integral converges and what's more, it's Gaussian and we can do it exactly. It comes out to $$ \sqrt{\frac{2\pi}{\epsilon^2}}e^{-\frac{t^2}{2\epsilon^2}}$$ so our expression becomes $$\lim_{\epsilon\to 0}\frac{1}{\sqrt{2\pi}} \frac{1}{\epsilon}\int_{-\infty}^\infty f(t) e^{-\frac{t^2}{2\epsilon^2}}dt.$$ Then we can substitute in the integral to get $$\lim_{\epsilon\to 0} \frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty f(\epsilon u) e^{-\frac{1}{2}u^2}du$$ and then (pending justification involving niceness conditions on $f$) pass the limit inside the integral to get $$ \frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty f(0) e^{-\frac{1}{2}u^2}du = f(0).$$
So that's a sketch of how changing the order of integration "really" works. Notice here we have a true function that serves as an approximation to the delta function: $$\delta_\epsilon(t) = \frac{1}{2\pi}\int_{-\infty}^\infty e^{-\frac{1}{2} \epsilon^2t^2 +iwt}dw =  \frac{1}{\sqrt{2\pi\epsilon^2}}e^{-\frac{t^2}{2\epsilon^2}}$$ which indeed becomes rather spiky around one and zero elsewhere as $\epsilon\to 0$ and always integrates to one for any nonzero value of $\epsilon,$ no matter how small. The expression in your book takes the limit $\epsilon \to 0$ inside the integral effectively here and calls the result the delta function, even though that's nonsense when taken literally. But if you put the limit outside the integral sign and take it at the end, it all works out. It's just rather easier to do these computations sloppily, knowing that it works out in the end. (Unfortunately it's also very confusing if you don't know what is going on behind the scenes and are attentive enough to detail to care.) 
Though I assumed $x=0$ to eliminate baggage from already ugly expressions, nothing essential changes when you add it back in.
EDIT
Other schemes of regularizing the inner integral also work and produce approximations to the delta function. For instance in DisintegratingByParts' (great name!) answer they use $$\delta_R(t) = \frac{1}{2\pi}\int_{-R}^R e^{iwt}dw = \frac{\sin(Rt)}{\pi t}$$ which may seem a bit more surprising as a delta function approximation as $R\to\infty$ (It doesn't converge to zero for $t\ne 0$). Nonetheless if you follow the same steps as I did for the regularization I chose you can see that it works. This, when done carefully, amounts to a proof of the Fourier inversion theorem.
As Hurkyl noted in the comments limits of the approximate delta functions make literal sense and converge to the delta function in the space of distributions (although denoting the limiting distribution by a particular divergent integral is arguably abuse of notation). This procedure of putting the limit of the regularization factor outside the integral is effectively the same thing as taking the distribution limit.
