Suppose that $f$ and $g$ are two non negative real valued functions defined on a measure space $(X,\mu)$.
Let $0<p<\infty$. Holder's inequality says that $\int fg d\mu\le \|f\|_p \|g\|_q$ where $\frac{1}{p}+\frac{1}{q}=1$ with equality iff $a f^p=b g^q$ for some constants $a$ and $b$.
So, in general, $\int fg d\mu=\|f\|_p \|g\|_q- x$ and that $x=0$ iff $a f^p=b g^q$ for some constants $a$ and $b$.
My question is, is there a way to find $x$? (apart from $x=\|f\|_p \|g\|_q-\int fg d\mu$)