# Derive chi-squared distribution from standard normal distribution

I am supposed to derive chi-squared probability density function from standard normal distribution. However I am stuck with the first step - to calculate probability density function of $$X^2$$ where $$X - Normal(0,1).$$

I am using transformation of probability density function theorem: Let us have $$X$$ an n-dimensional random vector with probability density function $$f_X$$. Let us have $$S_X$$ open set such that $$P(X \in S_X)=1$$ and let $$g: S_X \space->R^n$$ be a diffeomorphism. Then for $$Y=g(X)$$ the probability density function is equal to $$f_Y(y)=f_X(g^{-1}(y)|J_{g^{-1}}(y)| \space for \space y \in g(S_X)$$

I have defined $$g: u \space -> x^2$$, calculated that $$|J_{g^{-1}}(y))|=\frac{1}{2\sqrt{u}}$$ and $$g^{-1}:x\space ->\sqrt{u}$$ and came to conclusion that $$f_U(u)=\frac{1}{\sqrt{2 \pi}} e^{-\frac{u}{2}}\frac{1}{2\sqrt{u}}$$ for corresponding $$u>0$$. However this is not correct according to chi-squared distribution with 1 degree of freedom. There is one extra $$\frac{1}{2}$$. Am I missing something important?  After this step I want to use convolution however I cannot go on without correct probability density function.

• The solution is here: en.wikipedia.org/wiki/…
– Mark
Commented Jun 21, 2021 at 23:18
• I've already read this, however I cannot see the mistake in what is shown above. I am kinda sure that there should be no mistake but the result is incorrect. Commented Jun 21, 2021 at 23:26
• Is it perhaps because every value of Y has two value of X that map to it? In the proof I linked it is the line under "Derivation of the pdf for one degree of freedom" that starts with for $y \geq 0$. That is $f_Y(y) = 2\frac{d}{dy}F_X(\sqrt y)$. So your first equation is missing the 2. I think your formula assumes 1 to 1 transformations. You can find your formula at en.wikipedia.org/wiki/Probability_density_function (down where it says "scalar to scalar") and it says the function must be monotonic.
– Mark
Commented Jun 21, 2021 at 23:46
• Then it says what to do when the function is not monotonic (which in this case is multiply by 2) [section 8.1].
– Mark
Commented Jun 21, 2021 at 23:53
• Let $Z$ be standard normal. then $Y = |Z|$ is half normal, not a 1-1 transformation (multiply density by $2).$ Finally, $X = Y^2$ is chi-squared with DF=1; use Jacobian and $\Gamma(1/2) = \sqrt{\pi}.$ Commented Jun 22, 2021 at 0:07

The formula you are using, referred to as "Function of random variables and change of variables in the probability density function" for scalar to scalar on Wikipedia, assumes monotonicity. So for X> 0 your function is monotonic and you can apply your theorem. Same goes for X <0. Then $$F_y(y) = F_x(\sqrt{y}) -F_x(-\sqrt{y}) = F_x(\sqrt{y}) - (1- F_x(\sqrt{y})) = 2F_x(\sqrt{y})-1$$. When you differentiate both sides the -1 becomes irrelevant. And there is your factor of 2.