Proofs related to chi-squared distribution

The following are proofs of several characteristics related to the chi-squared distribution.

Contents

Derivations of the pdf

Derivation of the pdf for one degree of freedom

Let random variable Y be defined as Y = X2 where X has normal distribution with mean 0 and variance 1 (that is X ~ N(0,1)).

Then if y<0, ~ P(Y<y)=0 and if y\geq0, ~ P(Y<y) = P(X^2<y)=P(|X|<\sqrt{y})=F_X(\sqrt{y})-F_X(-\sqrt{y})=F_X(\sqrt{y})-(1-F_X(\sqrt{y}))=2 F_X(\sqrt{y})-1

 f_Y(y)    = \frac{2 \partial F_X(\sqrt{y})}{\partial y} - 0 = 2 \left( \int_{-\infty}^\sqrt{y} \frac{1}{\sqrt{2\pi}} e^{\frac{-t^2}{2}} dt \right)'_y = 2 \frac{1}{\sqrt{2 \pi}} e^{-\frac{y}{2}} (\sqrt{y})'_y = 2 \frac{1}{\sqrt{2}\sqrt{\pi}} e^{-\frac{y}{2}} \left( \frac{1}{2} y^{-\frac{1}{2}} \right) = 
\frac{1}{2^{\frac{1}{2}} \Gamma(\frac{1}{2})}y^{\frac{1}{2}-1}e^{-\frac{y}{2}}

Where F and f are the cdf and pdf of the corresponding random variables.

Then Y = X^2 \sim \chi^2_1.

Derivation of the pdf for two degrees of freedom

To derive the chi-squared distribution with 2 degrees of freedom, there could be several methods. Here presented is one of them which is based on the distribution with 1 degree of freedom.

let x and y are two independent variables and satisfy that x\sim\chi^2_1 and y\sim\chi^2_1, thus, the probability density functions of x and y are respectively:


f(x)=\frac{1}{2^{\frac{1}{2}}\Gamma(\frac{1}{2})}x^{-\frac{1}{2}}e^{-\frac{x}{2}}
and 
f(y)=\frac{1}{2^{\frac{1}{2}}\Gamma(\frac{1}{2})}y^{-\frac{1}{2}}e^{-\frac{y}{2}}

Simply, we can derive the joint distribution of x and y:


f(x,y)=\frac{1}{2\pi}(xy)^{-\frac{1}{2}}e^{-\frac{x%2By}{2}}

where \Gamma(\frac{1}{2})^2 is replaced by \pi. Further, let A=xy and B=x%2By, we can get that:


x = \frac{B%2B\sqrt{B^2-4A}}{2}
and 
y = \frac{B-\sqrt{B^2-4A}}{2}

or, inversely


x = \frac{B-\sqrt{B^2-4A}}{2}
and 
y = \frac{B%2B\sqrt{B^2-4A}}{2}

Since the two variable change policies are symmetric, we take the upper one and multiply the result by 2. The Jacobian determinant can be calculated as:


Jacobian\left( \frac{x, y}{A, B} \right)
         =\begin{vmatrix}
                 -(B^2-4A)^{-\frac{1}{2}}                     & \frac{1%2BB(B^2-4A)^{-\frac{1}{2}}}{2}             \\
                 (B^2-4A)^{-\frac{1}{2}}                     & \frac{1-B(B^2-4A)^{-\frac{1}{2}}}{2}             \\
          \end{vmatrix}
       = (B^2-4A)^{-\frac{1}{2}}

Now we can change f(x,y) to f(A,B):


f(A,B)=2\times\frac{1}{2\pi}A^{-\frac{1}{2}}e^{-\frac{B}{2}}(B^2-4A)^{-\frac{1}{2}}

where the leading constant 2 is to take both the two variable change policies into account. Finally, we integrate out A to get the distribution of B, i.e. x%2By:


f(B)=2\times\frac{e^{-\frac{B}{2}}}{2\pi}\int_0^{\frac{B^2}{4}}A^{-\frac{1}{2}}(B^2-4A)^{-\frac{1}{2}}dA

Let A=\frac{B^2}{4}\sin^2(t), the equation can be changed to:


f(B)=2\times\frac{e^{-\frac{B}{2}}}{2\pi}\int_0^{\frac{\pi}{2}}dA

So the result is:


f(B)=\frac{e^{-\frac{B}{2}}}{2}

Derivation of the pdf for k degrees of freedom

Consider the k samples x_i to represent a single point in a k-dimensional space. The chi square distribution for k degrees of freedom will then be given by:


P(Q)dQ = \int_\mathcal{S} \prod_{i=1}^k (N(x_i)\,dx_i) = \int_\mathcal{S} \frac{e^{-(x_1^2 %2B x_2^2 %2B ... %2Bx_k^2)/2}}{(2\pi)^{k/2}}\,dx_1dx_2...dx_k

Where N(x) is the standard normal distribution and \mathcal{S} is that k-1 dimensional surface in k-space for which

Q=\sum_{i=1}^k x_i^2

It can be seen that this surface is the surface of a k-dimensional ball or, alternatively, an n-sphere where n=k-1 with radius R=\sqrt{Q}, and that the term in the exponent is simply expressed in terms of Q. Since it is a constant, it may be removed from inside the integral.


P(Q)dQ = \frac{e^{-Q/2}}{(2\pi)^{k/2}} \int_\mathcal{S} dx_1dx_2...dx_k

The integral is now simply the surface area A of the k-1 sphere times the infinitesimal thickness of the sphere which is

dR=\frac{dQ}{2Q^{1/2}}.

The area of a k-1 sphere is:


A=\frac{kR^{k-1}\pi^{k/2}}{\Gamma(k/2%2B1)}

Substituting, realizing that \Gamma(z%2B1)=z\Gamma(z), and cancelling terms yields:


P(Q)dQ = \frac{e^{-Q/2}}{(2\pi)^{k/2}}A\,dR= \frac{1}{2^{k/2}\Gamma(k/2)}Q^{k/2-1}e^{-Q/2}\,dQ