# Two-to-One Functions Printer-friendly version

You might have noticed that all of the examples we have looked at so far involved monotonic functions that, because of their one-to-one nature, could therefore be inverted. The question naturally arises then as to how we modify the change-of-variable technique in the situation in which the transformation is not monotonic, and therefore not one-to-one. That's what we'll explore on this page! We'll start with an example in which the transformation is two-to-one. 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 change-of-variable technique must be modified to handle the two-to-one portion of the transformation. After summarizing the necessary modification to the change-of-variable technique, we'll take a look at another example using the change-of-variable technique.

### Example

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 one-to-one 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 two-to-one between when 0 < y < 1, and one-to-one 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 = X2. The third equality holds, because when X2y, 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 two-to-one transformation, we need to sum two terms, each of which arises from a one-to-one 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 = X2. The third equality holds, because when X2 ≤ 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 two-to-one function, we should now be able to summarize the necessary modifications to the change-of-variable technique.

#### Generalization.  Let f(x) be a continuous random variable with probability density function f(x) for c1 < x < c2.  Let Y = u(X) be a continuous two-to-one function of X, which can be “broken up” into two one-to-one invertible functions with:

$X_1=v_1(Y)$  and  $X_2=v_2(Y)$

(1) Then, the probability density function for the two-to-one portion of 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 one-to-one portions together.

(2) And, the probability density function for the one-to-one portion of is, as always:

$f_Y(y)=f_X(v_2(y))\cdot |v'_2(y)|$

for the “appropriate support” for y.

### Example

Suppose X is a continuous random variable with that follows the standard normal distribution with, of course,  −∞ < x < ∞. Use the change-of-variable technique to show that the p.d.f. of $Y=X^2$ is the chi-square distribution with 1 degree of freedom.

Solution. The transformation  $Y=X^2$ is two-to-one over the entire support −∞ < x < ∞: That is, when −∞ < x < 0, we have:

$X_1=-\sqrt{Y}=v_1(Y)$

and when 0 < x < ∞, we have:

$X_2=+\sqrt{Y}=v_2(Y)$

Then, the change of variable technique tells us that, over the two-to-one portion of the transformation, that is, when 0 < y < ∞:

$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 < ∞, 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 chi-square random variable with 1 degree of freedom!