Solution (source code)

= Solution

The <Birkhoff ergodic theorem> says that for a measure-preserving transformation on a finite measure space and $f\in L^1$, the averages $A_nf=n^{-1}\sum_{k=0}^{n-1}f\circ\theta^k$ converge almost everywhere to an invariant integrable function $f^*$. This limit is the conditional expectation of $f$ given the invariant sigma-algebra, and $\int f^*\,d\mu=\int f\,d\mu$. If the transformation is ergodic and $\mu(E)>0$, then $f^*$ equals the constant $\mu(E)^{-1}\int f\,d\mu$ almost everywhere.