How to find a subinterval for two integrals to take the same given value? $f$ and $g$ are two functions satisfying 
$$\int_0^1 f(x) dx = \int_0^1 g(x) dx = 1.$$
Can we always find a subinterval $[a, b] \subset [0,1]$ such that
$$\int_a^b f(x) dx = \int_a^b g(x) dx = \frac{1}{2}\quad?$$
For a proof, we can first assume that $f$ and $g$ are continuous on $[0,1]$,
but $f$ and $g$ are not assumed to be non-negative.
 A: No. 
For example 
$$\begin{cases} f(x)=0, ~~x \in [0,0.5) \\ f(x) = 2,~~x\in (0.5,1] \end{cases}$$
$$\begin{cases} g(x)=2, ~~x \in [0,0.5) \\ g(x) = 0,~~x\in (0.5,1] \end{cases}$$
A: I guess I need to proof it is true instead. 
let's define function $b=F(a)$ s.t. $\int_a^bf(x)dx=0.5$ and define function $b=G(a)$ s.t. $\int_a^bg(x)dx=0.5$ with $a \in [0,1]$, $b \in [0,1]$
And we investigate if there is solution for $F(a)=G(a)$
If there is no solution. Then either $F(a) \gt G(a)$ or $G(a) \gt F(a)$ for $a \in [0,a_{max}]$ here, $a_{max} \le 1$
This is impossible. Let's take $F(a) \gt G(a)$ for proofing. 
For $g(x)$, given $b_{g0}=G(0)$, we know $G(b_{g0})=1$ because $\int_0^1g(x)dx=1$
For $f(x)$, $b_{f0}=F(0)$ and $b_{g0} \lt b_{f0}$. So $\int_0^{b_{g0}}f(x)dx \lt  \frac12$
Similarly, $F(b_{g0}) \gt 1$
So $\int_{b_{g0}}^1f(x)dx \lt  \frac12$ 
Thus $\int_0^1f(x)dx <1$. This violate condition. 
A: OK, let me make another try. 
Let's define $$F(a,b)=\int_a^bf(x)dx$$ $$G(a,b)=\int_a^bg(x)dx$$
The functions are defined in a triangular region with vertex (0,0), (0,1) and (1,1). At (0,1), both functions equal 1. Along the line from (0,0) to (1,1), both functions equal 0. 
So we can draw two contour curves $C_1$ and $C_2$
$$C_1= \lbrace (a,b) ~| ~F(a,b) = \frac12 \rbrace$$
$$C_2= \lbrace (a,b) ~| ~G(a,b) = \frac12 \rbrace$$
Based on intermediate value theorem for 2 dimensions, $C_1$ and $C_2$ exist and continuous. 
On edge $(0,0) \rightarrow (0,1)$, the intersection of $C_1$ and the side is $\lambda_{c1}$ and the intersection of $C_2$ and the side is $\lambda_{c2}$.
if $\lambda_{c1}=\lambda_{c2}$, we get our solution. 
if $\lambda_{c1} \gt \lambda_{c2}$, we do following analysis. 
On edge $(1,1) \rightarrow (0,1)$, the intersection of $C_1$ and the side is $\beta_{c1}$ and the intersection of $C_2$ and the side is $\beta_{c2}$.
Because, $\lambda_{c1} \gt \lambda_{c2}$, $\int_0^1f(x)=1$ and $\int_0^1g(x)=1$,we get $\beta_{c1} \gt \beta_{c2}$. Thus the two curves should intersect due to its continuity. The intersection point is the solution. 
We can do similar analysis for case where $\lambda_{c1} \lt \lambda_{c2}$.
