The entire question reads:
Let $f$ be a Lebesgue measurable function on $\mathbb{R}$ with the property that $\sup_{\{g \in L^2(\mathbb{R}):||g||_2 \leq 1\}}\int_{\mathbb{R}}|fg|d \lambda \leq 1$. Prove that $f \in L^2(\mathbb{R})$ and $||f||_2 \leq 1$.
I'm not quite sure where to begin on this problem. I'm trying to get more practice with $L^p$ spaces, but it's clear I'm still lacking in skill and know-how. Any tips or tricks are greatly appreciated.
For every $n\in\mathbb{N}$ let $$ A_n := \{x\in [-n,n]:\ |f(x)| \leq n\}, \qquad f_n := f \chi_{A_n}, $$ and define the linear functional $T_n\colon L^2\to\mathbb{R}$ $$ T_n(g) := \int_{\mathbb{R}} f_n g. $$ Clearly $T_n$ is a bounded functional in $L^2$, since, by Holder's inequality, $$ |T_n(g)| \leq \int_{\mathbb{R}} |f_n g| \leq \|f_n\|_2 \|g\|_2. $$ Since $$ |T_n(f_n)| = \left| \int_{\mathbb{R}} f^2\chi_{A_n}\right| = \int_{\mathbb{R}} f_n^2 = \|f_n\|_2^2 $$ we can thus conclude that $\|T_n\| = \|f_n\|_2$.
Moreover, $|f_n g| \nearrow |fg|$, so that $$ \sup_n |T_n(g)| \leq \int_{\mathbb{R}} |fg| < +\infty. $$ By the Uniform Boundedness Principle we can conclude that the sequence $(T_n)$ converges to a bounded linear functional $T$, and that $$ \|T\| \leq \liminf_n \|T_n\| < +\infty. $$ On the other hand, by the monotone convergence theorem, $$ \liminf_n \|T_n\| = \liminf_n \|f_n\|_2 = \left(\int_{\mathbb{R}} |f|^2\right)^{1/2}, $$ hence $f\in L^2$.
Finally, taking $g = f / \|f\|_2$ in the assumption, one get $$ \int_{\mathbb{R}} |fg| = \|f\|_2 \leq 1. $$