How can we calculate the mathematical expectation of a Dirac delta? The expected value of a function $g$ of a random variable $X$ is defined as the Stieljes integral: 

$$E[g(x)] = \int_{-\infty}^\infty g(x) \,dF(x),$$

where $F(x)$ is the cumulative distribution function of $X$. In practice, we also have:

$$E[g(x)] = \int_{-\infty}^\infty g(x) f(x) \,dx,$$

where $f(x)$ is the density function. I am working with the function $g(x) = a \, \text{sech}^2(a \, x)$. From an engineer's point of view, this function resembles a Dirac delta (multiplied by 2) for large enough $a$. Consequently, I tried to calculate $E[\delta(x)]$ rather than $E[a \, \text{sech}^2(a \, x)]$ for very large $a$. On the one hand, I got:

$$E[\delta(x)] = \int_{-\infty}^\infty \delta(x) f(x)\, dx = f(0).$$

On the other hand, using the first formula, 

$$E[\delta(x)] = \int_{-\infty}^\infty \delta(x)\, dF(x).$$

Since $\delta$ is equal to zero almost everywhere, the set $\{x:\delta(x) \neq 0\} = \{ 0 \}$ is countable and hence has a Lebesgue measure of zero. I have read that if the Lebesgue measure is zero, the integral is zero even if the value of the function is infinite. Hence, it follows that

$$E[\delta(x)] = 0.$$

Obviously, there is a flaw in my calculations. Actually I am familiar with Riemann integration and have little understanding of Lebesgue integration.

P.S.: Computer simulations give one result or the other depending on the ratio between $a$ and the sample size.
The dirac delta is what is called a generalised function.

Basically, the dirac delta is defined to work as a useful exception to the usual rule of a discrete atom having zero Lebesgue measure.

As an exception, naturally it doesn't follow the rule. &nbsp; So, if it is useful to do so then we might extend the notion of expectation to say:

$$\mathsf E(\delta(X-c)) = f(c)$$
The dirac delta is what is called a generalised function.

Basically, the dirac delta is defined to work as a useful exception to the usual rule of a discrete atom having zero Lebesgue measure.

As an exception, naturally it doesn't follow the rule. &nbsp; So, if it is useful to do so then we might extend the notion of expectation to say:

$$\mathsf E(\delta(X-c)) = f(c)$$