Integral of Schwartz function over probability measure Let $X$ be a set, $\mathcal F$ a $\sigma$-field of subsets of $X$, and $\mu$ a probability measure on $X$. Given random variables $f,g\colon X\rightarrow\mathbb{R}$ such that $$\int_\mathbb{R}hd{\mu_f}=\int_{\mathbb{R}}hd\mu_g$$ for any Schwartz function $h$. Is it necessarily true that $\mu_f=\mu_g$?
 A: It's actually even true if we restrict ourselves to test functions, namely:

Let $\mu$ and $\nu$ be two Borel probability measures on the real line such that for each smooth function with compact support $\phi$,
  $$\tag{*}\int_\mathbb R \phi(t)\mathrm d\mu(t)=\int_\mathbb R \phi(t)\mathrm d\nu(t),$$
  then $\mu=\nu$. 

It's enough to extend $(*)$ to continuous bounded functions. 


*

*First step: we prove that $(*)$ holds if $\phi$ is smooth and bounded. Fix $\varepsilon\gt 0$; there is $R$ such that $\mu([-R,R])\gt 1-\varepsilon$ and $\nu([-R,R])\gt 1-\varepsilon$. Then take $\chi$ a test function such that $0\leqslant \chi\leqslant 1$ and $\chi(t)=1$ if $|t|\leqslant R$. Since $\phi\chi$ is a test function, this approximation argument gives the result. 

*Second step: we extend this to continuous bounded functions. Take $\varphi_n$ a sequence of mollifier and use the conclusion of the first step with $\phi\star \varphi_n$ (it is bounded since to is $\phi$). 

*Third step: we got $(*)$ for each $\phi$ continuous and bounded. Let $F$ be a closed set, and $O_n$ the set of points whose distance from $F$ is $\lt n^{—1}$.  Define $f_n:=\frac{d(x,O_n^c)}{d(x,F)+d(x,O_n^c)}$, where $d(x,S):=\inf\{|x-y|,y\in S\}$. Then $f_n(x)\to \chi_F(x)$ for each $x$ and $0\leqslant f_n\leqslant 1$, hence by dominated convergence, $\mu(F)=\nu(F)$ for each closed set $F$. 
A: Here is an approach using Fourier analysis. Take $\varphi\in\mathcal S(\mathbb R)$. Then $\widehat{\varphi}\in\mathcal S(\mathbb R)$, and by Fubini's theorem,
$$\int_\mathbb R\widehat{\phi}(x)\mathrm d\mu_X=\int_{\mathbb R}\phi(t)\cdot\widehat{\mu_X}(t)\mathrm dt,$$
where $\widehat{\mu_X}$ is the characteristic function of $\mu_X$. 
If $h$ is a continuous function such that $\int_\mathbb R\phi(x)h(x)\mathrm dx=0$ for each $\phi\in\mathcal S(\mathbb R)$, then $h=0$ (otherwise, take $x_0$ such that $h(x)\neq 0$ on a neighborhood of $x_0$ and $\phi$ a  positive Schwartz function supported on this interval). 
Hence $\mu_X$ and $\mu_Y$ have the same characteristic function.
