Function of a random variable is a random variable Consider the following two statements
Statement 1

If $X$ is a continuous random variable and $Y=g(X)$ is a function of
$X$, then $Y$ itself is a random variable.

Statement 2

A random variable is a function from a sample space S into the real
numbers.

From statement 2 it is clear that a random variable should be a real valued function.
Then how can any function of a random variable can be another random variable as per statement 1? Where my interpretation is going wrong?

$X : \Omega \to \mathbb{R}$, i.e. to each $\omega$ you pair some real number $X(\omega)$.
Then, $Y$ given by $g(X)$ should be interpreted as pairing $g(X(\omega))$ to each $\omega$.
In other words $Y : \Omega \to \mathbb{R}$ and is just $g \circ X$.
