Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider a random variable $X$ and consider that this variable can be either real or integral (so I would like to cover both cases: continuos and discrete random variables). Consider to transform this variable using a certain function $g(\cdot)$:

$$Y = g(X)$$

Consider to know both $f_X(x)$ and $f_Y(y)$: the probability mass functions of the original r.v. and the final (transformed) r.v.

In better words, I am asking you to consider a random variable and to apply a transformation. Generally we know the transformation, but in our case we know that we want to transform the original r.v. in order to get a final r.v. that we already know!

Is it possible to calculate $g(\cdot)$ from these conditions?


Of course I know that there are closed expressions to express the final pdf in terms of $g$ and $f_X(x)$. For a continuos r.v.:

  • When $g$ in monotonic increasing: $f_Y(y) = f_X(g^{-1}(y)) \cdot \frac{\partial}{\partial y}g^{-1}(y)$.

  • When $g$ in monotonic decreasing: $f_Y(y) = -f_X(g^{-1}(y)) \cdot \frac{\partial}{\partial y}g^{-1}(y)$.

For a discrete r.v.: $f_Y(y) = f_X(g^{-1}(y))$.

But I cannot get $g$ from these relations being this term inside a function composition.

share|cite|improve this question
up vote 2 down vote accepted

For continuous random variables, the easiest way to approach your problem is in two steps. First transform $X$ into a random variable $Z \sim U(0,1)$, and then transform $Z$ into $Y$. The transformations needed are $$Z = F_X(X), ~~ Y = F_{Y}^{-1}(Z)$$ where $F_X(\cdot)$ is the cumulative probability distribution function of $X$ and $F_Y(\cdot)$ is the cumulative probability distribution function of $Y$. If the inverse function $F_{Y}^{-1}$ is not uniquely defined, one needs to pay special attention.

If $X$ and $Y$ are discrete random variables, then it might be that there are no transformations that will map $X$ into $Y$. For example, $X$ is a Bernoulli random variable while $Y$ is a binomial random variable with parameters $(n,p)$ where $n > 1$.

share|cite|improve this answer
Just a question, how can I make the transformation when X and Y are discrete? $F_Y^{-1}(y)$ cannot be done... – Andry Mar 19 '13 at 8:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.