TITLE: If $f$ is measurable and $fg$ is in $L^1$ for all $g \in L^q$, must $f \in L^p$?
QUESTION [34 upvotes]: Let $f$ be a measurable function on a measure space $X$ and suppose that $fg \in L^1$ for all $g\in L^q$. Must $f$ be in $L^p$, for $p$ the conjugate of $q$? If we assume that $\|fg\|_1 \leq C\|g\|_q$ for some constant $C$, this follows from the Riesz Representation theorem. But what if we aren't given that such a $C$ exists?

REPLY [9 votes]: Oops. Someone asked me a question in a comment to this answer. So I sort of assumed it was an Answer from me, and replied to the comment with an edit. Oops, no it's an Answer from someone else.  Sorry, didn't mean to revise his post. Although I didn't change anything, just added more content, so I'm tentatively leaving this as it is.
Original Answer
The answer is NO. All the proofs presented in above are invalid.
Counter-example: Consider the measure space $(X,\mathcal{M},\mu)$, where $X=\{x_0\}$, $\mathcal{M}= \{\emptyset,X\}$, and $\mu(\emptyset)=0$, $\mu(X)=\infty$. Let $p,q\in(1,\infty)$ be such that $\frac{1}{p}+\frac{1}{q}=1$. In this case, $L^q=\{0\}$. Therefore, if we define $f:X\rightarrow\mathbb{R}$ by $f(x_0)=1$, then $fg\in L^1$ for all $g\in L^q$. However, $f\notin L^p$.
(Third-party) Edit
Just  now I've been asked what's the problem with the accepted answer. It seems maybe worthwhile explaining, since it's actually a bit more subtle than  I realized at first.
With apologies lest I misrepresent what someone had in mind; nobody included details for the wrong part, so to explain where the error is I have to start by inserting my own version of the details:
So assume that $fg\in L^1$ for all $g\in L^p$. Just to give a name to what we've correctly proved above:


Lemma. $||fg||_1\le C||g||_p$.


At this point everyone says that the lemma plus RRT imply $f\in L^p$. The wrong argument is this: Define $\Lambda g=\int fg$. Then $\Lambda\in (L^q)^*$. But RRT says $(L^q)^*=L^p$, hence $f\in L^p$.
The problem arises only at the very last step. At first I assumed the problem was with $(L^q)^*=L^p$ if the measure is not $\sigma$-finite, but that's not quite it:
Assume in addition that $1<p<\infty$. Then it is true that $(L^q)^*=L^p$ for any measure. But that doesn't show $f\in L^p$. Again we need to insert details: RRT does show that there exists a unique $F\in L^p$ with $\int Fg=\int fg$ for all $g\in L^q$. And now


Error. If $\int Fg=\int fg$ for all $g\in L^q$ then $f=F$ almost everywhere.


That's easy in the $\sigma$-finite case, but as we see in the example at the top, in general there need not be enough $L^q$ functions to separate points of $L^p$.