Measurable functions with the same integral over a set Suppose $f:\mathbb R \to \mathbb R,g:\mathbb R \to \mathbb R $ are Lebesgue measurable with $\int_{\mathbb R}f(x)=\int_{\mathbb R}g(x)=1$.
How to show that for every $r\in(0,1)$, there is a measurable $E \subset \mathbb R$ such that $\int_{ E}f(x)=\int_{ E}g(x)=r$?
 A: For $r = 1/2$, there is an interval $E$ for which this holds.  Several proofs of this fact are given in:

Totik, Vilmos.  A tale of two integrals.  American Mathematical Monthly 106: 227-240, 1999.  MathSciNet | Full text (JSTOR)

(These proofs are given replacing the domain $\mathbb{R}$ with $[0,1]$, so apply the obvious transformation.  Totik also gives a proof that the desired equality holds with $E$ an interval if and only if $r = 1/k$ for some integer $k$.)
So let $E_1$ be an (open) interval such that $\int_{E_1} f = \int_{E_1} g = 1/2$.  Then by applying the same result to $f_1 = 2f1_{E_1^c}$, $g_1 = 2 g 1_{E_1^c}$, we can produce $E_2$, disjoint from $E_1$, with $\int_{E_2} f = \int_{E_2} g = 1/4$.  ($E_2$ may not be an interval, because we have to remove $E_1$ from it, but we can take it to be a finite union of open intervals.)  Proceeding, we can produce disjoint sets $E_n$ with $\int_{E_n} f = \int_{E_n} g = 2^{-n}$.  Now consider the binary expansion of $r$ and take the union of the corresponding $E_n$.  The resulting set $E$ is not only measurable but in fact open.
Hopefully I didn't overlook any subtle details...
A: In the special case $f\ge 0$, $g\ge 0$, this follows from a theorem of Lyapunov stating that the range of a vector measure is convex.  In the present context this means that the set $R:=\{(\int_E f(x)\,dx,\int_E g(x)\,dx): E\in{\mathcal L}\}$ is a convex subset of $[0,1]^2$. (Here ${\mathcal L}$ denotes the $\sigma$-algebra of Lebesgue measurable subsets of the real line.) Since $R$ clearly contains $(0,0)$ and $(1,1)$, it contains the segment connecting them. Therefore  for each $r\in(0,1)$ the point $(r,r)$ is an element of $R$, and so there exists $E\in{\mathcal L}$ with $\int_E f=\int_E g = r$.
