How to prove that T is ergodic iff $$\lim_{n\to\infty} \frac{1}{n}\sum_{i=0}^{n-1}\langle U_T^i f, g \rangle=\langle f,1\rangle\langle g,1\rangle ?$$
Here, $U_T f=f\circ T$ and T is ergodic if for every two measurable sets A and B holds $$\lim_{n\to\infty} \frac{1}{n}\sum_{i=0}^{n-1} m(T^{-i} A\cap B)=m(A)m(B)$$.
One implication is clearly correct (just take $f=\chi_A$ and $g=\chi_B$), but how to prove another one? Any help is welcome. Thanks in advance.
You can rewrite $$\tag1 \lim_{n\to\infty} \frac{1}{n}\sum_{i=0}^{n-1} m(T^{-i} A\cap B)=m(A)m(B) $$ as $$\tag2 \lim_{n\to\infty} \frac{1}{n}\sum_{i=0}^{n-1}\langle 1_{T^{-i} A}\,1_B\rangle=\langle 1_A,1_B\rangle. $$ Since $1_{T^{-i}A}=1_A\circ T^{i}$, now $(2)$ becomes $$\tag3 \lim_{n\to\infty} \frac{1}{n}\sum_{i=0}^{n-1}\langle 1_{ A}\circ T^i,1_B\rangle=\langle 1_A,1_B\rangle. $$ As you are free to choose $A$ and $B$, now you can work first with one, then with the other to pass to positive simple functions, then to positive integrable functions via monotone convergence, and then to general $L^2$ functions by linearity.