What does it mean to transform a random variable into a different distribution? [duplicate]

I am trying to understand transforming random variables into a different distribution. I don't get how this works. Let's say X is normally distributed. We have some function Y = g(X) that transforms X into a variable that is distributed differently.

How would this happen? Unless we square X or something like that, each X would lead to a unique Y, with densities equal to whatever the density of X was. I am not understanding how we could transform X into another distributed random variable, and one that is known.

I'm doing homework and it wants me to transform X to a uniform distribution. Conceptually, I don't understand how this works. Let's say X comes from norm(0, 1). No matter what function g(X) is, I'd imagine Y = g(0) will occur more times than Y = g(5). I'm not understanding what exactly needs to be transformed. Are we trying to transform the density itself - like flatten the density function out?

Thanks!

• If $g(y)=3$ for all $y$'s, would you support that $Y=3$ is Normal? – Xi'an Oct 22 at 12:26
• I don't see how that tells me anything about Y – confused Oct 22 at 12:31
• @user2974951 I see. We can use the CDF of the random variable, which converts it to a new random variable that exists between 0 and 1. And then somehow we can normalize it? – confused Oct 22 at 12:32
• Wow that's crazy, I just simulated it in R and using CDF converts it to uniform - seems like it holds true for any distribution. – confused Oct 22 at 12:39