TITLE: When are definite integrals undefined?
QUESTION [12 upvotes]: We have $$\int_{-1}^{1} \dfrac{1}{x} \, dx$$ as undefined and then we have $$\int^1_{-1} f(x)\delta(x) = f(0)$$ 
assuming $f(x)$ is continuous everywhere and $$\delta(x) = \begin{cases} 0 & x\ne 0,
 \\ \infty & x = 0. \end{cases}$$
In both cases the integrand is infinite for $x = 0$, then why second integral is not undefined?

REPLY [3 votes]: Don't believe everyone telling you that you need to know functional analysis or measure theory... 
you just need to use the appropriate definition for $\delta$:
\begin{align*}
\delta(x) &= \frac{1}{2}\,\operatorname{sgn}'(x)  \\
\int_{-1}^{1} f(x)\,\delta(x)\,dx
&= \int_{-1}^{1} f(x)\,\frac{\operatorname{sgn}'(x)}{2}\,dx  \\
&= \left.f(x)\operatorname{sgn}(x)\right|_{-1}^{+1} - \int_{-1}^{1} \frac{\operatorname{sgn}(x)}{2}\,f'(x)\,dx  \\
&= \frac{f(1)+f(-1)}{2} + \int_{-1}^{0} \frac{f'(x)}{2}\,dx - \int_{0}^{1} \frac{f'(x)}{2}\,dx  \\
&= \frac{f(1)+f(-1)}{2} + f(0) - \frac{f(-1)+f(1)}{2}  \\
&= f(0)
\end{align*}
Note the following:

You don't actually need $f$ to be differentiable. If it can be approximated arbitrarily well by a differentiable function, the same arguments here work.
You don't need $\operatorname{sgn}$ to be the sign function. Just pretend it's a smooth approximation whose behavior only changes very close to the zero. Again, the proof holds just fine in that case, and as the approximation gets better, the error vanishes.

You don't need to know measure theory or functional analysis to understand any of this intuitively.