# Requirements for transformation functions in probability theory

I have two questions about transformation functions in probability theory.

Let's look at the theorem below.

Theorem. Let $X$ be an absolutely continuous random variable with support $R_X$ and probability density function $f_X(x)$. Let $g:\mathbb{R} \to \mathbb{R}$ be one-to-one and differentiable on the support of $X$. If

$$\frac{dg^{-1}(y)}{dy} \ne 0, \qquad \forall y \in g(R_X)$$

then the probability density of $Y$ is

$$f_Y(y) = f_X(g^{-1}(y)) \left|{\frac{dg^{-1}(y)}{dy}}\right|, \qquad \forall y \in g(R_X).$$

Questions.

1) Can I choose any subset of $\mathbb{R}$ which contatins support $R_X$ as the domain of $g$?

As I understood $\mathbb{R}$ is a "natural domain" (i.e. the largest possible domain) for $g$ but we can always limit it for a specific function $g$ on practice.

For example it will be convenient to choose $A = (0,\infty)$ as the domain for a function $g:A \to \mathbb{R},~ g(x) = \ln(x)$ if $X$ can have only positive values. Or I have to choose $\mathbb{R}$ as the domain and somehow define function $g$ on $(-\infty,0]$ ?

2) Why the theorem requires function $g$ to be one-to-one instead of to be invertible?

I think that the domain of a function $g^{-1}$ is exactly the set $R_Y = g(R_X)$. Hence if $g$ is one-to-one then $g$ will be invertible function. Even if $g$ is not an onto function.

Please correct me if I'm wrong. Thanks.