I have a question regarding a confusion from reading the Princeton Companion to Mathematics on the topic of Ergodics Theorems. It is about proving a stronger version of Poincare Recurrence Theorem using Neumann's Mean Ergodic Theorem. I apologize if this question is too easy for this site.
Let $A$ be a subset of positive measure, $T$ a measure preserving transformation and $U$ a unitary operator defined by $Uf(x):=f(Tx)$. Define the ergodic average $A_{N,M}$ to be $$ A_{N,M}(f):=\frac 1{N-M}\sum_{n=M}^{N-1}U^nf. $$
It is not hard to verify that for $f:=1_A$, $\langle f,U^nf\rangle = \mu(A\cap T^{-n}A)$. Here's the passage that confuses me:
It follows that $$ \langle f,A_{N,M}(f)\rangle = \frac 1{N-M}\sum_{n=M}^{N-1}\mu(A\cap T^{-n}A). $$ If we let $N − M$ tend to infinity, then $A_{N,M}f$ tends to a $U$-invariant function $g$. Since $g$ is $U$-invariant, $\langle f,g\rangle = \langle U^nf,g\rangle$ for every $n$ and therefore $\langle f,g\rangle=\langle A_{N,M}(f),g\rangle$ for every $N$ and $M$ and finally $\langle f,g\rangle=\langle g,g\rangle$. By the Cauchy–Schwarz inequality, this is at least $$ \left(\int g(x)d\mu\right)^2 = \left(\int f(x)d\mu\right)^2=\mu(A)^2. $$ Therefore we deduce $$ \lim_{N-M\to\infty}\frac 1{N-M}\sum_{n=M}^{N-1}\mu(A\cap T^{-n}A)\ge \mu(A)^2. $$
How does one arrive at the final result from Cauchy–Schwarz inequality?
I understand everything prior to the statement "By the Cauchy-Schwarz ..." but not after that. Using Cauchy–Schwarz I could deduce $||g||\le ||f||$ and get $$ \lim_{N-M\to\infty}\frac 1{N-M}\sum_{n=M}^{N-1}\mu(A\cap T^{-n}A)\le \mu(A)^2. $$ which is the complete opposite of what was stated.
Here is the link to the same question posted on MSE with no answer.
Edit: As pointed out by John Griesmer, the inequality I derived should read $$ \lim_{N-M\to\infty}\frac 1{N-M}\sum_{n=M}^{N-1}\mu(A\cap T^{-n}A)\le ||f||^2 = \mu(A). $$ instead. A silly mistake there by me.