Sample space of a transformation of a random variable 
If $X$ is a random variable with cdf $F_{X}(x)$, then any function of $X$, say $g(X)$, is also a random variable. Often $g(X)$ is of interest itself and we write $Y=g(X)$ to denote the new random variable $g(X)$. Since $Y$ is a function of $X$, we can describe the probabilistic behavior of $Y$ in terms of that of $X$. That is, for any set $A$,
$$
P(Y \in A)=P(g(X) \in A),
$$
showing that the distribution of $Y$ depends on the functions $F_{X}$ and $g$. Depending on the choice of $g$, it is sometimes possible to obtain a tractable expression for this probability.
Formally, if we write $y=g(x)$, the function $g(x)$ defines a mapping from the original sample space of $X, \mathcal{X}$, to a new sample space, $\mathcal{Y}$, the sample space of the random variable $Y$. That is,
$$
g(x): \mathcal{X} \rightarrow \mathcal{Y}
$$

Why is the sample space of $Y$ different from the sample space of $X$? Wouldn't they both have the same sample space (domain) of $\mathcal{X}=\mathcal{Y}=\Omega$?
 A: To summarize my above comments:
Indeed there is only one sample space $\Omega$, and we have random variables:
\begin{align}
X:\Omega\rightarrow \mathbb{R}\\
Y:\Omega\rightarrow\mathbb{R}
\end{align}
The set $\Omega$ is the (common) domain of the functions $X, Y$, the set $\mathbb{R}$ is the (common) target set of the functions $X,Y$. The sets $\mathcal{X}\subseteq\mathbb{R}$ and $\mathcal{Y}\subseteq\mathbb{R}$ can be used to either refer to the images or the ranges of the random variables.  The set $\mathcal{X}$ is sometimes called the "sample space relative to the random variable $X$" while the set $\mathcal{Y}$ is sometimes called the "sample space relative to the random variable $Y$."
I agree the terminology can be confusing.  One confusing thing is that some textbooks treat "image" and "range" as synonymns while others treat "range" and "target set" as synonymns (whereas I think nobody treats "image" and "target set" as synonymns).
I like to define the images by the set of values that can actually be achieved:
\begin{align}
\mathcal{X} = \{X(\omega) : \omega \in \Omega\} \\
\mathcal{Y} = \{Y(\omega) : \omega \in \Omega\}
\end{align}
Since $\mathcal{X}\subseteq\mathbb{R}$ and $\mathcal{Y}\subseteq\mathbb{R}$ it makes sense to write
\begin{align}
X:\Omega\rightarrow \mathcal{X}\\
Y:\Omega\rightarrow \mathcal{Y}
\end{align}
so that $\mathcal{X}$ and $\mathcal{Y}$ can also be viewed as the (potentially different) target sets for $X$ and $Y$.

Formally, a measurable space is a pair $(\Gamma, \mathcal{G})$ such that $\Gamma$ is a nonempty set and $\mathcal{G}$ is a sigma algebra on $\Gamma$.  For doing probability we always assume there is a probability triplet $(\Omega, \mathcal{F}, P)$ where $(\Omega, \mathcal{F})$ is a measurable space and $P:\mathcal{F}\rightarrow [0,1]$ is a probability measure. Then:

*

*A random variable is a (measurable) function $X:\Omega\rightarrow\mathbb{R}$.


*A random element is a (measurable) function $Z:\Omega\rightarrow \Gamma$ where $(\Gamma, \mathcal{G})$ is some given measurable space.
I put the word "measurable" in parentheses to de-emphasize it. For random variables, we use "Borel measurability" and it means that
$$\{\omega \in \Omega : X(\omega) \in B\} \in \mathcal{F} \quad \forall B \in \mathcal{B}(\mathbb{R})$$
which holds if and only if
$$\{\omega \in \Omega : X(\omega) \leq x\} \in \mathcal{F} \quad \forall x \in \mathbb{R}$$
Here $\mathcal{B}(\mathbb{R})$ is the Borel sigma algebra on $\mathbb{R}$.
The set of Borel measurable functions is so extensive that it includes all functions of practical use, you will never be in danger of accidentally defining a non-Borel measurable function, so basic probability classes ignore the issue of measurability.  Basic classes also usually do not treat random elements in abstract measurable spaces. However, for completeness, I note that the formal definition of "measurable" for random elements $Z:\Omega\rightarrow \Gamma$ is similar:
$$ \{\omega \in \Omega : Z(\omega) \in B\} \in \mathcal{F} \quad \forall B \in \mathcal{G}$$
Now another confusing point of terminology is that, while most mathematics textbooks and papers agree with the above notation regarding "random variable" versus "random element," some computer science books like to treat "random variable" and "random element" as synonymns.
