# Ergodic if and only if time average of measure of intersection equals product of measures

I'm trying to prove the following from Brin and Stuck, exercise 4.5.1:

Let $T$ be a measure-preserving transformation of a finite measure space $(X, \mathfrak A, \mu)$. Prove that $T$ is ergodic if and only if $$\lim_{n \to \infty} \frac 1 n \sum_{k=0}^{n-1} \mu\left(T^{-k}(A) \cap B\right) = \mu(A) \cdot \mu(B)$$ for any $A, B \in \mathfrak A$.

I'm trying to use the following corollary of the Birkhoff ergodic theorem: that if $T$ is a measure-preserving transformation of a finite measure space $(X, \mathfrak A, \mu)$, then $T$ is ergodic if and only if $$\lim_{n \to \infty} \frac 1 n \sum_{k=0}^{n-1} \chi_A \left(T^k(x)\right) = \frac{\mu(A)}{\mu(X)}.$$ It seems straightforward, but I'm missing a factor of $\mu(X)$ somewhere and I can't find where.

My strategy: Let $A, B \in \mathfrak A$. Define the measurable functions $$f_n(x) = \frac 1 n \sum_{k=0}^{n-1} \chi_A \left(T^k(x)\right) = \frac 1 n \sum_{k=0}^{n-1} \chi_{T^{-k}(A)}(x).$$ Clearly $|f_n(x)| \leq 1$ for all $n$, and by the above corollary to the Birkhoff ergodic theorem, this sequence of functions converges $\mu$-a.e. pointwise to $\mu(A)/\mu(X)$. So by the dominated convergence theorem, we get \begin{align} \lim_{n \to \infty} \frac 1 n \sum_{k=0}^{n-1} \mu\left(T^{-k}(A) \cap B\right) &= \lim_{n \to \infty} \frac 1 n \sum_{k=0}^{n-1} \int_X \chi_{T^{-k}(A)}(x)\cdot \chi_B(x) \,d\mu \\ &= \lim_{n\to\infty} \frac 1 n \sum_{k=0}^{n-1} \int_B \chi_A \circ T^k \,d\mu\\ &\stackrel{(*)}{=} \int_B \frac{\mu(A)}{\mu(X)} \,d\mu \\ &= \frac{\mu(A)\cdot\mu(B)}{\mu(X)}, \end{align} where equality $(*)$ follows if and only if $T$ is ergodic, by the corollary to the Birkhoff ergodic theorem and by dominated convergence.

But there must be a mistake somewhere, and I can't find it; similar results suggest the problem should be true regardless of whether $\mu(X) = 1$. Was I supposed to multiply by a factor of $\mu(X)$ somewhere?

Nothing is wrong with your computations, simply Brin and Stuck assume that $\mu$ is a probability measure.
Indeed, if you take $B=X$ in $$\lim_{n \to \infty} \frac 1 n \sum_{k=0}^{n-1} \mu\left(T^{-k}(A) \cap B\right) = \mu(A) \mu(B),$$ then $$\lim_{n \to \infty} \frac 1 n \sum_{k=0}^{n-1} \mu(T^{-k}(A)) = \mu(A) \mu(X),$$ but the left-hand side is equal to $\mu(A)$.