Solution
= Solution
Let $\mu_X$ and $\mu_Y$ be the <probability laws> of $X$ and $Y$. The hypothesis says
$$
\int_{\mathbb R}f\,d\mu_X
=\mathbb E[f(X)]
=\mathbb E[f(Y)]
=\int_{\mathbb R}f\,d\mu_Y
$$
for every compactly supported <continuous function> $f$. The theorem that <compactly supported continuous functions determine a finite Borel measure> gives $\mu_X=\mu_Y$. Hence $X$ and $Y$ have the same law.