# Fubini theorem question

Let $f$ and $g$ be Lebesgue measurable nonnegative functions on $\mathbb{R}$. Let $A_y=\{x:f(x) \geq y\}$ Let $F(y)=\int_{A_y} g(x)dx$. Prove $\int_{-\infty}^\infty f(x)g(x)dx=\int_0^\infty F(y)dy$. I know this has to do with Fubini's theorem but I cannot prove it.

-
Hint: if $H(x,y) = 1$ when $f(x) \ge y$ and $0$ otherwise, $$\int_0^\infty F(y)\ dy = \int_0^\infty \int_0^\infty H(x,y) g(x) \ dx\ dy$$ What is $\int_0^\infty H(x,y)\ dy$? –  Robert Israel May 25 '12 at 20:22
You might try to read again Robert's hint, s-l-o-w-l-y. –  Did May 25 '12 at 20:31
Say $f(x)=7$. What are $H(x,0)$, $H(x,2)$, $H(x,6)$ and $H(x,9)$? What is the function $y\mapsto H(x,y)$? Now what is $\int_0^\infty H(x,y)dy$? –  Did May 25 '12 at 20:40
Is it f(x)? I think I see it –  john May 25 '12 at 20:43
If you see it (which I hope), you might want to write yourself a solution and to post it here. After a while, you may even accept it... :-) –  Did May 25 '12 at 20:45

recall Fubini’s theorem and apply to couple of function $(f(x|t) ,p(t))$