If $\int_{\mathbb R} hf=\int_{\mathbb R} gf$ for every probability density $f$, does it follow that $h=f$ a.e.? 
If $\int_{\mathbb R} hf=\int_{\mathbb R} gf$ for any arbitrary probability density $f$, does it follow that $h=f$ a.e.?

It seems to be right for that taking f as an indicator function over $[-n,n]$ divided by $2n$ will show that $h=g$ almost everywhere on $[-n,n]$ for each $n$. I just wanted to double check that this is a valid argument.
 A: Here I'll use the theorem that says that if $f>0$ on a set $A$ of positive measure, then $\int_A f>0$.
Clearly by considering $h-g$ we can reduce the original claim to

If $g$ is a Lebesgue measurable real function such that $\int gf=0$ for any PDF $f$ (i.e. a nonnegative function with $\int f=1$), then $g=0$ almost everywhere.

Let $A^+$ be the set of points for which $g(x)>0$, and $A^-$ for the set of points with $g(x)<0$. If $m(A^+)+m(A^-)=0$, then $g=0$ a.e. and we are done, and otherwise either $m(A^+)$ or $m(A^-)$ is positive, and by taking $-g$ in place of $g$ we can assume that $m(A^+)>0$.
But then the theorem I mentioned at the beginning implies that $\int_{A^+}g>0$, so $\int_{A^+}g\cdot\frac1{m(A^+)}>0$, and by taking $f(x)=\frac1{m(A^+)}$ on $A^+$ and $f(x)=0$ otherwise, you have a contradiction to the hypothesis.
We can also extend the theorem to complex valued $g,h$ by applying the above separately to the real and imaginary parts of the function.
A: Using indicator functions of intervals is a good idea. 
Making them wide and flat is a bad idea. Do the opposite: use tall skinny functions. 
By the Lebesgue differentiation theorem, for a.e. $x\in\mathbb R$ we have 
$$
f(x) = \lim_{r\to 0} \int_{\mathbb R} f(x) \phi_r(x)\,dx
$$
where $\phi_r(x) = \frac{1}{2r}\chi_{[x-r,x+r]}$ is a probability density function (uniform distribution on $[x-r,x+r]$). Thus, integrals of the form $ \int_{\mathbb R} f(x) \phi_r(x)\,dx$ determine $f$ almost everywhere.
