# On the existence of a random variable with contraints

Let there be two random variables $$X$$ and $$Y$$ with a certain joint copula. Is it always true that there is another random variable $$Z$$ independent from $$Y$$ such as the vectors (X,Y) and (X,Z) have the same law?

It depends on what you mean by "exist". Taken completely literally, no. For instance, if the sample space is $$\Omega = \{0,1,2,3\}$$ with each point having probability $$1/4$$, and $$X$$ and $$Y$$ are the random variables

$$X(0) = X(1) = 0, X(2) = X(3) = 1, \\ Y(0) = Y(2) = 0, Y(1) = Y(3) = 1,$$ then any random variable $$Z$$ such that $$(X,Y)$$ and $$(X,Z)$$ have the same law must satisfy $$Z=Y$$.

However, what I suspect you mean to ask is "given some joint law $$\mu$$, can we always find random variables $$X$$, $$Y$$ and $$Z$$ defined on some shared probability space such that $$(X,Y)$$ and $$(X,Z)$$ both have joint law $$\mu$$, and $$Y$$ and $$Z$$ are independent?"

If you do not know measure theory, the TL;DR version is yes, this is always possible. If you interested in the measure-theoretic proof, then proceed.

To prove this, let $$\lambda$$ be the marginal distribution of $$X$$ and $$\nu_x$$ be the distribution of $$Y$$ conditional on $$X=x$$. (What I am really doing here is disintegrating the measure $$\mu$$; see the Wikipedia article on disintegrations for details.) So specifically, we have

$$\mu(A\times B) = \int_A \nu_x(B)\lambda(dx)$$

for all Borel sets $$A,B$$. Now, all we have to do is consider the Borel probability measure $$\mathbb P$$ on $$\mathbb R^3$$ which satisfies

$$\mathbb P(A\times B\times C) = \int_A \nu_x(B)\nu_x(C) \lambda(dx).$$

The joint law of both the first and second components, and the first and third components, is $$\mu$$, and the second and third components are independent. Explicitly, let $$\Omega = \mathbb R^3$$ with its Borel $$\sigma$$-field and probability measure $$\mathbb P$$ defined above, and define

$$X(x,y,z) = x, \qquad Y(x,y,z) = y, \qquad Z(x,y,z) = z.$$

Then by construction, $$(X,Y)$$ and $$(X,Z)$$ both have law $$\mu$$, and $$Y$$ and $$Z$$ are independent.