Determining two iterated integrals over the diagonal line of the cube $[0, 1]^2$ Consider the interval $[0, 1]$ with the Borel-$\sigma$-algebra $\mathcal{B}([0, 1])$. Let $\lambda$ be the Lebesgue-measure and $\mu$ the counting measure on $\mathcal{B}([0, 1])$. For the characteristic function $1_D: [0, 1] \to \mathbb{R}$ of the diagonal $D = \{(x, y) \in [0, 1]^2: x = y\}$ (meaning that $1_D(x, y) = 1$ if $(x, y) \in D$, and $0$ otherwise), I want to calculate the two iterated integrals:
$$\int_{[0, 1]}\left( \int_{[0, 1]} 1_D (x, y) d \lambda(x)\right) d \mu(y) \text{ and } \int_{[0, 1]} \left( \int_{[0, 1]} 1_D (x, y) d \mu(y) \right) d \lambda(x)$$
Finally, I'm asked on why this result doesn't contradict Tonelli's theorem.
To answer the question at the end (I'm assuming here that the two integrals are different from each other): I think the problem is that the counting measure isn't a $\sigma$-finite measure, as required for applying Tonelli's theorem, because $[0, 1]$ is an uncountable set, hence, can't be written as a countable union of sets which all have finite (counting) measure.
I'm having trouble though evaluating these two iterated integrals. For the first integral: if we "fix" an $y \in [0, 1]$, then $1_D(y, y) = 1$, but $1_D(x, y) = 0$ for $x ≠ y$. Since the inner integral is $≠ 0$ at only one point, the Lebesgue integral is $0$, I believe? But how does the integration over the counting measure work, then? Since the result of the inner integral is always $0$, does that mean the outer integral is $= 1$ since $0$ is only one point? I'm having trouble understanding how the integration over the counting measure works, and also, how to evaluate these iterated integrals in general.
Thanks in advance.
 A: In the expression on the left hand side
$$\int_{[0, 1]}\left( \int_{[0, 1]} 1_D (x, y) d \lambda(x)\right) d \mu(y),$$
you are right about the inner integral being $0$, so we are left with
$$\int_{[0,1]} 0\ d \mu(y).$$
This integral is $0$. Maybe it helps your understanding to compare it to the integral
$$\int_{[0,1]} 1_{\{y=0\}}\ d \mu(y),$$
whose value is $1$. The integrand is $1$ at exactly one point, which the counting measure tallies up.
Let me give you a few other examples of integrating with respect to the counting measure.
$$\int_{[0,1]} 1_{\{1/y\ \in\mathbb{N}\}}\ d \mu(y) = 1+1+1+1+\cdots = \infty,$$
because the contributions from the integral come from the values of $y$ in the set $\{1,1/2,1/3,1/4,1/5,\ldots\}$. Another example is
$$\int_{[0,1]} y^21_{\{1/y\ \in\mathbb{N}\}}\ d \mu(y)=1+\frac{1}{4}+\frac{1}{9}+\cdots = \frac{\pi}{6},$$
where I use the well-known sum $\sum_{n=1}^{\infty}\frac{1}{n^2} = \frac{\pi}{6}$.
In general, the counting measure looks for points where the integrand is non-zero, and then sums up the values of the integrand at these non-zero points.
