You might have noticed that all of the examples we have looked at so far involved monotonic functions that, because of their onetoone nature, could therefore be inverted. The question naturally arises then as to how we modify the changeofvariable technique in the situation in which the transformation is not monotonic, and therefore not onetoone. That's what we'll explore on this page! We'll start with an example in which the transformation is twotoone. We'll use the distribution function technique to find the p.d.f of the transformed random variable. In so doing, we'll take note of how the changeofvariable technique must be modified to handle the twotoone portion of the transformation. After summarizing the necessary modification to the changeofvariable technique, we'll take a look at another example using the changeofvariable technique.
Example 223 Section
Suppose \(X\) is a continuous random variable with probability density function:
\(f(x)=\dfrac{x^2}{3}\)
for \(1<x<2\). What is the p.d.f. of \(Y=X^2\)?
Solution
First, note that the transformation:
\(Y=X^2\)
is not onetoone over the interval \(1<x<2\):
For example, in the interval \(1<x<1\), if we take the inverse of \(Y=X^2\), we get:
\(X_1=\sqrt{Y}=v_1(Y)\)
for \(1<x<0\), and:
\(X_2=+\sqrt{Y}=v_2(Y)\)
for \(0<x<1\).
As the graph suggests, the transformation is twotoone between when \(0<y<1\), and onetoone when \(1<y<4\). So, let's use the distribution function technique, separately, over each of these ranges. First, consider when \(0<y<1\). In that case:
\(F_Y(y)=P(Y\leq y)=P(X^2 \leq y)=P(\sqrt{y}\leq X \leq \sqrt{y})=F_X(\sqrt{y})F_X(\sqrt{y})\)
The first equality holds by the definition of the cumulative distribution function. The second equality holds because the transformation of interest is \(Y=X^2\). The third equality holds, because when \(X^2\le y\), the random variable \(X\) is between the positive and negative square roots of \(y\). And, the last equality holds again by the definition of the cumulative distribution function. Now, taking the derivative of the cumulative distribution function \(F(y)\), we get (from the Fundamental Theorem of Calculus and the Chain Rule) the probability density function \(f(y)\):
\(f_Y(y)=F'_Y(y)=f_X(\sqrt{y})\cdot \dfrac{1}{2} y^{1/2} + f_X(\sqrt{y})\cdot \dfrac{1}{2} y^{1/2}\)
Using what we know about the probability density function of \(X\):
\(f(x)=\dfrac{x^2}{3}\)
we get:
\(f_Y(y)=\dfrac{(\sqrt{y})^2}{3} \cdot \dfrac{1}{2} y^{1/2}+\dfrac{(\sqrt{y})^2}{3} \cdot \dfrac{1}{2} y^{1/2}\)
And, simplifying, we get:
\(f_Y(y)=\dfrac{1}{6}y^{1/2}+\dfrac{1}{6}y^{1/2}=\dfrac{\sqrt{y}}{3}\)
for \(0<y<1\). Note that it readily becomes apparent that in the case of a twotoone transformation, we need to sum two terms, each of which arises from a onetoone transformation.
So, we've found the p.d.f. of \(Y\) when \(0<y<1\). Now, we have to find the p.d.f. of \(Y\) when \(1<y<4\). In that case:
\(F_Y(y)=P(Y\leq y)=P(X^2 \leq y)=P(X\leq \sqrt{y})=F_X(\sqrt{y})\)
The first equality holds by the definition of the cumulative distribution function. The second equality holds because \(Y=X^2\). The third equality holds, because when \(X^2\le y\), the random variable \(X \le \sqrt{y}\). And, the last equality holds again by the definition of the cumulative distribution function. Now, taking the derivative of the cumulative distribution function \(F(y)\), we get (from the Fundamental Theorem of Calculus and the Chain Rule) the probability density function \(f(y)\):
\(f_Y(y)=F'_Y(y)=f_X(\sqrt{y})\cdot \dfrac{1}{2} y^{1/2}\)
Again, using what we know about the probability density function of \(X\), and simplifying, we get:
\(f_Y(y)=\dfrac{(\sqrt{y})^2}{3} \cdot \dfrac{1}{2} y^{1/2}=\dfrac{\sqrt{y}}{6}\)
for \(1<y<4\).
Now that we've seen how the distribution function technique works when we have a twotoone function, we should now be able to summarize the necessary modifications to the changeofvariable technique.
Generalization Section
Let \(X\) be a continuous random variable with probability density function \(f(x)\) for \(c_1<x<c_2\).
Let \(Y=u(X)\) be a continuous twotoone function of \(X\), which can be “broken up” into two onetoone invertible functions with:
\(X_1=v_1(Y)\) and \(X_2=v_2(Y)\)

Then, the probability density function for the twotoone portion of \(Y\) is:
\(f_Y(y)=f_X(v_1(y))\cdot v'_1(y)+f_X(v_2(y))\cdot v'_2(y)\)
for the “appropriate support” for \(y\). That is, you have to add the onetoone portions together.

And, the probability density function for the onetoone portion of \(Y\) is, as always:
\(f_Y(y)=f_X(v_2(y))\cdot v'_2(y)\)
for the “appropriate support” for \(y\).
Example 224 Section
Suppose \(X\) is a continuous random variable with that follows the standard normal distribution with, of course, \(\infty<x<\infty\). Use the changeofvariable technique to show that the p.d.f. of \(Y=X^2\) is the chisquare distribution with 1 degree of freedom.
Solution
The transformation \(Y=X^2\) is twotoone over the entire support \(\infty<x<\infty\):
That is, when \(\infty<x<0\), we have:
\(X_1=\sqrt{Y}=v_1(Y)\)
and when \(0<x<\infty\), we have:
\(X_2=+\sqrt{Y}=v_2(Y)\)
Then, the change of variable technique tells us that, over the twotoone portion of the transformation, that is, when \(0<y<\infty\):
\(f_Y(y)=f_X(\sqrt{y})\cdot \left \dfrac{1}{2} y^{1/2}\right+f_X(\sqrt{y})\cdot \left\dfrac{1}{2} y^{1/2}\right\)
Recalling the p.d.f. of the standard normal distribution:
\(f_X(x)=\dfrac{1}{\sqrt{2\pi}} \text{exp}\left[\dfrac{x^2}{2}\right]\)
the p.d.f. of \(Y\) is then:
\(f_Y(y)=\dfrac{1}{\sqrt{2\pi}} \text{exp}\left[\dfrac{(\sqrt{y})^2}{2}\right]\cdot \left\dfrac{1}{2} y^{1/2}\right+\dfrac{1}{\sqrt{2\pi}} \text{exp}\left[\dfrac{(\sqrt{y})^2}{2}\right]\cdot \left\dfrac{1}{2} y^{1/2}\right\)
Adding the terms together, and simplifying a bit, we get:
\(f_Y(y)=2 \dfrac{1}{\sqrt{2\pi}} \text{exp}\left[\dfrac{y}{2}\right]\cdot \dfrac{1}{2} y^{1/2}\)
Crossing out the 2s, recalling that \(\Gamma(1/2)=\sqrt{\pi}\), and rewriting things just a bit, we should be able to recognize that, with \(0<y<\infty\), the probability density function of \(Y\):
\(f_Y(y)=\dfrac{1}{\Gamma(1/2) 2^{1/2}} e^{y/2} y^{1/2}\)
is indeed the p.d.f. of a chisquare random variable with 1 degree of freedom!