Let $X\sim N(\mu,\sigma^2)$ a normal distributed random variable. Let furthermore $\mu=0, \sigma^2=1$ and $\phi(x)=x^2, \phi:\mathbb{R}\to \mathbb{R}_{+}$. Compute the density function of the random variable $\phi \circ X$!

So I know that one can compute with the transformation theorem for density functions. For a random variable $Y$ one has: $$f_Y(y)= \left\{\begin{array}{ll} \frac{f_X(\phi^{-1}(y))}{\phi'(\phi^{-1}(y))}, & y\in Image(\phi) \\ 0, & y\not\in Image(\phi)\end{array}\right. (1) . $$

For the density function of the normal distribution one has: $$f_X(x)=\frac{1}{\sqrt{2\pi}\sigma}\cdot \mathrm{e}^{\left(-\frac{x-\mu}{2\sigma}\right)^2} (2)$$

To use (1) I have to compute $\phi^{-1}(y)$: $$\phi^{-1}(y)= \left\{\begin{array}{ll} \sqrt{y}, & y \ge \\ -\sqrt{y}, & y < 0\end{array}\right. (3).$$

For (2) I get with the given parameter: $$f_X(x)=\frac{1}{\sqrt{2\pi}}\cdot \mathrm{e}^{-\frac{1}{2}x^2}$$

I put it all together and I get the density function: $$f_Y(y)= \left\{\begin{array}{ll} \frac{1}{\sqrt{8\pi y}}\cdot \mathrm{e}^{-\frac{1}{2}y}, & y\ge 0 \\ -\frac{1}{\sqrt{8\pi y}}\cdot \mathrm{e}^{-\frac{1}{2}y}, & y<0\end{array}\right. (4).$$

It seemed quite easy, so are there any mistakes?

  • 1
    $\begingroup$ The transformation theorem that you wrote only applies under an assumption of monotonicity. Without that assumption you are better off finding the CDF and then differentiating it to find the PDF. $\endgroup$ – Ian Dec 2 '16 at 15:29

Consider that $\phi: \Bbb R \to \Bbb R_+$, so $\phi^{-1}: \Bbb R_+ \to \Bbb R$ BUT ofc it's not the true inverse due to the fact that $\phi$ is not injective…

Try by direct calculating, so let $Y = \phi \circ X = X^2$ then $f_Y(x) = F'_Y(x)$ with $$\begin{align*} F_Y(x) &= P(X^2 \le x) \\ &= P(-\sqrt{x} \le X \le \sqrt{x}) \\ &= F_X(\sqrt{x}) - F_X(-\sqrt{x})\end{align*}$$

So: $$\begin{align*} f_Y(x) &= F'_Y(x) \\ &= \frac{1}{2\sqrt{x}}\left(f_X(\sqrt{x}) + f_X(-\sqrt{x})\right)\end{align*}$$

Plug in by yourself…


Ok so the first point the change of variables is given by $$ \begin{align} f_{Y}(y) = f_{X}(\phi^{-1}(y) ) \left|\frac{d}{dy}\phi^{-1} \right|, \end{align} $$ Now as you noticed we have positive and negative roots where as the change of variable formula as stated just now is for a single monotonic transformation, however the symmetry around $x=0$ means that we can consider the positive and negative sections seperately, so taking the positive square root first we have $$ \left| \frac{d}{dy}\phi^{-1} (y) \right| = \frac{1}{2}y^{-1/2}, $$ the term for the negative square root is just the same and so we have $$ \begin{align} f_Y(y) &= 2 \cdot f_X(\sqrt{y}) \left| \frac{d}{dy} \sqrt{y} \right|\\ &=2\frac{1}{2\sqrt{2\pi}}y^{-\frac{1}{2}} e^{-\frac{y}{2}} \\ &= \frac{1}{2^{1/2}\sqrt{\pi} }y^{-1/2}e^{-y/2} \\ &= \frac{1}{2^{1/2}\Gamma(1/2)}y^{1/2-1}e^{-y/2} \end{align} $$ where I have included that last line just to show that this equals the probability density function of a Chi-squared random variable with one degree of freedom which is what we would expect.

  • $\begingroup$ Thanks for your answer! Can you explain how you get $\vert \frac{d}{dy} \phi^{-1}(y)\vert$? And what's the argument for $2\cdot f_X(\sqrt{y})$? Why you multiply with 2? $\endgroup$ – jacmeird Dec 2 '16 at 14:53
  • $\begingroup$ Well if a function $g$ is invertible and increasing then speaking about the <i> Cumulative distribution functions </i> then we have $\endgroup$ – Nadiels Dec 2 '16 at 15:08
  • $\begingroup$ Sorry new here... anyway I'm not sure if you are asking why this is so in this particular case? Or where the argument comes from in general? I think maybe you need to go back and check where you got your formula from, including the division by $\phi^{\prime}(\phi^{-1} (y) )$ term $\endgroup$ – Nadiels Dec 2 '16 at 15:17
  • $\begingroup$ Oh, I'm sorry, my question was imprecise, I'm a blockhead! Forget the first question. Ah, I see. So if one has more than one distribution function for a random variable the density functions behave additive with the argument that $F_X'(x)=f_X(x)$? $\endgroup$ – jacmeird Dec 2 '16 at 15:25
  • 1
    $\begingroup$ You can't have more than one distribution function, a random variable has a (Cumulative) distribution function and this is unique. If you mean why does it become additive if we have multiple roots of the transformation function then basically you have $P(Y \in A) = \int_{A} f_Y(y) dy = \int_{\phi^{-1}(A)} f_X(x)$, but in this case you can also split the preimage into $\int_{C_1} f_X(s)dx + \int _{C_2} f_X(x) dx$ where we have disjoint sets $C_1 = {x : x < 0 , \phi(x) \in A }$ and $C_2$ is the equivalent positive part, integrate by substitution to both parts to get the additive form $\endgroup$ – Nadiels Dec 2 '16 at 15:38

Call $y = x^2$, then the PDF for $y$ can be constructed by realizing that

$$ f_X(x)dx = f_Y(y)dy $$

or equivalently

$$ f_Y(y) = f_X(x)\left|\frac{dx}{dy}\right| $$

the absolute value is there to ensure that $f_Y(y) \ge 0$. Since $dx/dy = y^{-1/2}/2$ you have

$$ f_Y(y) = \frac{1}{\sqrt{2\pi y}}e^{-y/2} \tag{1} $$

Below there's a small simulation of the random variable $Y$. First a generate $10^5$ points following a standard normal distribution and squared them. The blue histogram is the result. The red line is Eq. (1)

enter image description here

Note Since $y=x^2 \ge 0$, there's no need to include the case $y<0$ in your derivation

  • $\begingroup$ @ArghyaChakraborty Indeed, I meant probability distribution function. Thanks $\endgroup$ – caverac Dec 2 '16 at 14:10
  • $\begingroup$ I am sorry, but i can't see atm why dx/dy=1/sqrt(y). Since x^2=y => dx/dy=d sqrt(y)/dy= 1/2*1/sqrt(y). What did i get wrong? $\endgroup$ – FeLix Apr 24 '17 at 9:02
  • $\begingroup$ @FeLix You're right, it was just a typo. Thanks for letting me know $\endgroup$ – caverac Apr 24 '17 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.