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)?