# Mean Ergodic Theorem for ergodic transformations

I understand how the ergodic averages for an $L^2$ function converge in norm to the orthogonal projection on the space of invariant functions, and I understand how for ergodic transformations this space is just the constant functions. What I'm not seeing is how the orthogonal projection operator coincides with the integral in this case. Everything I read states this as though it's apparent, but I don't see how it's a priori the case. What can we say about the subspace $\{g(T) - g:g \in L^2\}$?

Let $E(f)=\int f$.
$(E(f), f - E(f)) = \int E(f)f-E(f)^2=E(f)E(f-E(f))=E(f)(E(f)-E(E(f)))=E(f)(E(f)-E(f))=0.$