In my understanding, random variable is a measurable function from a probability space to a measurable space. Suppose $X$ is a random variable from $(A, \sigma\_{A},P\_A)$ to $(B,\sigma\_{B})$. And $Y$ is a random variable from $(B, \sigma\_{B}, P\_B)$ to $(C, \sigma\_{C})$.


Then $Y(X)$ is a random variable from $A$ to $C$. The problem is here, in the space $B$, we can induce probability from $A$ by random variable $X$, s.t., $P\_{B}'(I) = P\_A(X^{-1}(I))$.
Also, random variable $Y$ use the probability measure $P\_B$, then if we want to calculate the probability distribution of $Y(X)$, what probability should be used, $P\_B'$ or $P\_B$, or both? 



The Probability distribution of Random variable of Random variable
$Y(X)$ doesn't mean anything. You can't define the composition of random variables. What you can do is compose a random variable $X$ by a measurable function $f$ (provided the $\sigma$ algebras are the same) : $f(X)$.


So in your example, there are two different objects, measurable functions and random variables :


-the measurable functions $f$ from $(A,\sigma\_A)$ to $(B,\sigma\_B)$ and $g$ from $(B,\sigma\_B)$ to $(C,\sigma\_C)$. Since B uses the same $\sigma$-algebra, the function $g \circ f$ is measurable from $(A,\sigma\_A)$ to $(C,\sigma\_C)$.


-the random variable when you add a probability distribution to the measurable spaces. So if you add $P\_A$ to $(A,\sigma\_A)$, the measurable function $f$ from $(A,\sigma\_A)$ to $(B,\sigma\_B)$ induces a random variable we can write $X$. Now since we also have a measurable function $g \circ f$ from $(A,\sigma\_A)$ to $(C,\sigma\_C)$, it also induces another random variable that we can write $X'$ or more usually $g(X)$. And if you add $P\_B$ to $(B,\sigma\_B)$, function $g$ induces a random variable we'll write $Y$.


But the composition $Y(X)$ doesn't makes any sense.


