# On transformations of random variables, discrete vs continuous [duplicate]

Suppose we have a discrete r.v. $X$, take $Y = g(X)$ where $g$ is one-to-one and onto-

If we want to obtain the new pdf for the discrete r.v. we simply notice that $$f_Y(y) = P(Y=y) = f_X(g^{-1}(y))$$

Now if random variable $X$ is continous and $g$ is always one-to-one and onto why can't we apply this to the continous case also?

that is, why can't we say $$f_Y(y) = f_X(g^{-1}(y))$$ for a continous random variable?