How to prove this mean value property$\int_a^b f(t)g(t)dt=f(x)\int_a^b g(t)dt$? Suppose $f$ and $g$ are continuous functions on $[a,b]$ and that $g(x)\ge 0$ for all $x\in[a,b]$. Prove that there exists $x$ in $[a,b]$ such that 
$$\int_a^b f(t)g(t)dt=f(x)\int_a^b g(t)dt$$
I think I need to do something with this theorem:
Intermediate Value Theorem for Integrals
If $f$ is a continuous function on $[a,b]$ then for at least one $x$ in $[a,b]$ we have 
$$f(x)=\frac{1}{b-a} \int_a^bf$$
 A: Let $m = \min \{f(x): x \in [a,b]\}$ and $M = \max \{f(x): x \in [a,b]\}$.
First let us assume that $\displaystyle \int_a^b g(x)dx > 0$. Then we have that $$m \leq \dfrac{\displaystyle \int_a^b f(x) g(x) dx}{\displaystyle \int_a^b g(x)dx} \leq M$$
Now use intermediate value theorem to get what you want.
If $\displaystyle \int_a^b g(x) dx = 0$ and since $g(x) \geq 0$ and is continuous, we have that $g(x) = 0$ on $[a,b]$. Hence, $$\displaystyle \int_a^b f(x) g(x) dx = \displaystyle \int_a^b g(x)dx =0$$ Hence, $$\displaystyle \int_a^b f(x) g(x) dx = f(t) \displaystyle \int_a^b g(x)dx $$
for any $t \in [a,b]$.
A: Define
$$
\bar{f}=\frac{\int_a^bf(t)\,g(t)\,\mathrm{d}t}{\int_a^bg(t)\,\mathrm{d}t}\tag{1}
$$
Then
$$
\int_a^b\left(f(t)-\bar{f}\right)\,g(t)\,\mathrm{d}t=0\tag{2}
$$
Suppose that $f(t_+)-\bar{f}\gt0$ and $f(t)-\bar{f}\ge0$ for all $t\in[a,b]$, then $f-\bar{f}$ is positive in some neighborhood of $t^+$ and therefore $\int_a^b\left(f(t)-\bar{f}\right)\,g(t)\,\mathrm{d}t\gt0$. Thus, there must be some $t_-$ where $f(t_-)-\bar{f}\lt0$.
Suppose that $f(t_-)-\bar{f}\lt0$ and $f(t)-\bar{f}\le0$ for all $t\in[a,b]$, then $f-\bar{f}$ is negative in some neighborhood of $t_-$ and therefore $\int_a^b\left(f(t)-\bar{f}\right)\,g(t)\,\mathrm{d}t\lt0$. Thus, there must be some $t_+$ where $f(t_+)-\bar{f}\gt0$.
Thus, if $f(t)-\bar{f}$ is not identically $0$ on $[a,b]$, we must have $t_+$ and $t_-$ where $f(t_+)-\bar{f}\gt0$ and $f(t_-)-\bar{f}\lt0$.
By the intermediate value theorem, there must be an $x$ between $t_+$ and $t_-$ such that $f(x)-\bar{f}=0$, which is the same as
$$
\int_a^bf(t)\,g(t)\,\mathrm{d}t=\bar{f}\int_a^bg(t)\,\mathrm{d}t=f(x)\int_a^bg(t)\,\mathrm{d}t\tag{3}
$$
A: Let $h(x)$ be an antiderivative of $g(x)$, so that $h'(x)=g(x)$. Then using the substitution $$u=h(t)\Rightarrow du=g(t)\,dt$$ we get $$\int_{h^{-1}(a)}^{h^{-1}(b)}f(t)\,du=f(x)\int_{h^{-1}(a)}^{h^{-1}(b)}du=f(x)(h^{-1}(b)-h^{-1}(a))$$ which we can validate using the IVT for integrals.
