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

In this question I asked about a way in order to find a specific transformation function $g(\cdot)$ in order to transform a random variable into another one.

Thanks to the answer to that question I could investigate a little more and understood that $g(\cdot)$ can be found using the CDFs of both distributions. So let's say that I have a random variable $X$ and I want to transform it into $Y$ knowing both $F_Y(y)$ and $F_X(x)$. The transformation $g(\cdot)$ that allows $Y = g(X)$ is the following:

$$ g(\cdot) = F_Y^{-1}(F_X(\cdot)) $$

How to handle discrete variables?

But I have a problem. The transformation $F_Y^{-1}(F_X(\cdot))$ cannot be done when I have discrete variables, or better when $Y$ is a discrete random variable.

It is obvious why. Being a discrete random variable $F_Y(y)$ will be a stair function, which is no a bijection! Inversion is not possible!

It seems that it is not possible to transform a generic random variable into a discrete one...


My questions are:

  1. How to handle this, in the case I want $Y$ to be a discrete random variable?

  2. Is this method only for those cases where the destination random variable $Y$ is a continuos r.v.? Meaning that the method cannot transform a r.v. into a discrete one.

  3. Other than this approach, is there a method to get $g(\cdot)$ in order to achieve $Y=g(X)$ knowing everything about $X$ and $Y$ (moments, PMFs, CDFs and so on...)?


share|cite|improve this question

ex: Convert $Y = ln(X)$.

First of all, we know that $X=e^Y$, so the domain of $Y$ is all real numbers. We also know the pdf of X is $F_X(x) = 1-e^x$. Then

$F_Y(y)=P(Y<y)=P(ln(x)\le Y)=P(x\le e^y)=F_X(e^y)$

So $F_Y(y)=F_X(e^y)$, then we differentiate to get $f_Y(y)=f_X(e^y)e^y$.

share|cite|improve this answer
Thankyou user65384 for your answer, but I am afraid to say that you did not get the point. I do not want to know how to get $F_Y(y)$, in my case I suppose I already have it. In your example you use $g(\cdot) = ln(\cdot)$ but in my question I pointed clear that $g$ must be $g(\cdot) =F_Y^{-1}(F_X(\cdot))$. In particular I need to consider the case where $F_Y(y)$ is a stair function that, so, cannot be inverted! – Andry Mar 20 '13 at 8:27

The transformation "almost" works if $X$ is continuous which implies that $F_X(x)$ has no jumps. Consider consecutive values $y'<y$ in support of $Y$. Extend $F^{-1}_Y(u)$ by letting it map the values from the interval $(P(Y\le y'),P(Y\le y)]=(F_Y(y'),F_Y(y)]$ to $y$. Note that the interval is half-open. If $y$ is the minimum value in the support of $Y$, then use $y'=-\infty$. The combined extended transformation then maps values of $X$ such that $F^{-1}_X(F_Y(y'))< X\le F^{-1}_X(F_Y(y))]$ to $y$.

share|cite|improve this answer

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.