# two dimensional integral of delta function

For $$x,y \in \mathbb{R}$$, function $$f(x,y)$$ is defined as $$f(x,y) = 1 \quad\textrm{if}\quad x=y$$ $$f(x,y) = 0 \quad\textrm{if}\quad x\neq y$$

It seems to me that the integral $$I = \int_0^1 \int_0^1 f(x,y) dxdy$$ should equal to the diagonal of the unit square, hence $$I = \int_0^1 \int_0^1 f(x,y) dxdy = \sqrt{2} \tag{1}$$

However, in writing the integral mathematically, I got $$I = \int_0^1 \int_0^1 f(x,y) dxdy= \int_0^1 1 dx = 1 \tag{2}$$

Could anyone please show me where I was wrong in (1) and/or (2)?

## 3 Answers

Not sure how you think in (1) but (2) is the correct answer.

Imagine the x- and y-axes and that you start in the origin (0,0). Now do the integral of your function over dx i.e. move over the x-axis from (0,0) to (1,0). The only time your integral is not zero is when x=y=0, you get that the first integral is equal to 1 and you have ended up at the point (1,0). Now do the integral over dy. You move from (1,0) to (1,1) and your integral will only be non-zero were x=y=1 and the second integral is thus also equal to 1 and the entire two dimensional integral is therefore one.

Hope this helps!

The double integral represents the area of the diagonal line, not the length. This is $$0$$.

When doing the innermost integral, $$\int_0^1f(x,y)dx$$, the $$y$$ is considered a fixed number, so the integrand is $$0$$ everywhere except at a single point, where it is $$1$$. This integral becomes $$0$$, so when you do the outer integral, you get $$\int_0^10\,dy$$.

What you have is the ordinary function $$[x = y]$$, which is not the same as $$\delta(x - y)$$; the latter isn't an ordinary function at all. The double integral of $$[x = y]$$ is trivially zero.

If you adopt some natural assumptions about how $$\delta(f)$$ is defined, then the formula giving the length of a curve cannot be just $$\iint \delta(f(x, y)) \, dx dy$$, see this answer. The formula you get is $$l = \int_0^1 \int_0^1 \delta(x - y) \, |\nabla (x - y)| \, dx dy,$$ which is then equal to $$\int_0^1 \sqrt 2 \, dy$$.