Let $X,Y,Z$ be random variables such that the random vectors $(X,Z)$ and $(Y,Z)$ have the same law. Is it true that $X$ and $Y$ have the same law ?
I can't find a counterexample to it but I can't see why would it hold neither. The assumption says that $$\mathbb P(X\leq x, Z\leq z)=\mathbb P(Y\leq x, Z\leq z) $$
If $X$ and $Y$ were independent from $Z$ then we have $\mathbb P(X\leq x)=\mathbb P(Y\leq x) $. However, if they are not independent I can't see what formal argument says that $X$ and $Y$ have the same law. Is there a counterexample I am not thinking of ?