If $g\in L^2(X)$ satisfies the given condition, then $g\in L^{\infty}(X)$. I got stuck with the following while going through Lemma $3.20$ from the book 'Ergodic Theory, Independence and Dichotomies' by Kerr and Li.
Problem: Let $(X,\mu)$ be a probability measure space, and let $g\in L^2(X)$. If for all $h_1,h_2\in L^{\infty}(X)$ with $\|h_1\|_2,\|h_2\|_2\leq 1$, there exists a constant $c$ (independent of $h_1$ and $h_2$) such that $|\langle gh_1,h_2\rangle|\leq c$, then prove that $g\in L^{\infty}(X)$.
Thanks in advance for any help or suggestion.
 A: Suppose that $g$ is not $L^{\infty}.$ So for every $n,$ we know that there's a set $A_n$ of positive measure on which $g > n.$
Pick $h_1 = \frac{1}{\sqrt{\mu(A_n)}}\chi_{A_n}$, which is $L^2$ of norm 1, and $h_2 = 1.$ Then $\langle gh_1, h_2\rangle = n/\sqrt{\mu(A_n)}.$
Now, as we let $n\rightarrow\infty,$ we find that $||g||_2 \geq n\mu(A_n).$ Since $||g||_2$ is some finite number, this means that $n/\sqrt{\mu(A_n)} \geq n^{1.5}/\sqrt{||g||_2}$ which goes to infinity as $n\rightarrow\infty$. Thus, $\langle gh_1, h_2\rangle$ can become arbitrarily large, and in particular no such $c$ exists. By contrapositive the claim follows.
A: We even have $\|g\|_\infty \le c$: For an arbitrary measurable $A$ we set
$$
h_1 = \frac{\chi_A}{\sqrt{\mu(A)}}
,
\qquad
h_2 = \operatorname{sign}(g) h_1.
$$
Then, $\|h_1\|_2 = \|h_2\|_2 = 1$ and both functions belong to $L^\infty$. Hence,
$
c \ge \langle g h_1, h_2\rangle = \int_A |g| \, \mathrm d\mu$,
i.e.,
$$
\int_A |g| \, \mathrm{d} \mu \le c \mu(A).$$
From this, we easily find $\|g\|_\infty \le c$.
