Proofs related to chi-squared distribution
{{main article|Chi-squared distribution}}
The following are proofs of several characteristics related to the chi-squared distribution.
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,
\begin{alignat}{2}
\text{for} ~ y < 0, & ~~ F_Y(y) = P(Y \text{for} ~ y \geq 0, & ~~ F_Y(y) = P(Y ~~ & = F_X(\sqrt{y})-F_X(-\sqrt{y})= F_X(\sqrt{y})-(1-F_X(\sqrt{y}))= 2 F_X(\sqrt{y})-1 \end{alignat} : \begin{align} f_Y(y) &= \tfrac{d}{dy} F_Y(y) = 2 \tfrac{d}{dy} F_X(\sqrt{y}) - 0 = 2 \frac{d}{dy} \left( \int_{-\infty}^\sqrt{y} \frac{1}{\sqrt{2\pi}} e^{\frac{-t^2}{2}} dt \right) \\ & = 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}}e^{-\frac{y}{2}} \end{align} Where and are the cdf and pdf of the corresponding random variables. Then
==Alternative proof directly using the change of variable formula==
The change of variable formula (implicitly derived above), for a monotonic transformation , is:
:
In this case the change is not monotonic, because every value of has two corresponding values of (one positive and negative). However, because of symmetry, both halves will transform identically, i.e.
:
In this case, the transformation is: , and its derivative is
So here:
:
And one gets the chi-squared distribution, noting the property of the gamma function: .
=Derivation of the pdf for two degrees of freedom=
There are several methods to derive chi-squared distribution with 2 degrees of freedom. Here is one based on the distribution with 1 degree of freedom.
Suppose that and are two independent variables satisfying and , so that the probability density functions of and are respectively:
:
f_X(x)=\frac{1}{2^{\frac{1}{2}}\Gamma(\frac{1}{2})}x^{-\frac{1}{2}}e^{-\frac{x}{2}}
and of course . Then, we can derive the joint distribution of :
:
f(x,y)=f_X(x)\,f_Y(y) = \frac{1}{2\pi}(xy)^{-\frac{1}{2}}e^{-\frac{x+y}{2}}
where . Further{{Clarify|reason=Rationale would be helpful.|date=January 2024}}, let and , we can get that:
:
x = \frac{B+\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+\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{{Clarify|reason=Reasoning unclear, provide reference.|date=January 2024}}:
:
\operatorname{Jacobian}\left( \frac{x, y}{A, B} \right)
=\begin{vmatrix}
-(B^2-4A)^{-\frac{1}{2}} & \frac{1+B(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 to {{Clarify|reason=The new function in (A,B) needs a new name because it is not the same function only differing in parameters.|date=January 2024}}:
:
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 {{Clarify|reason=Integration boundaries unclear.|date=January 2024}} to get the distribution of , i.e. :
:
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
Substituting gives:
:
f(B)=2\times\frac{e^{-\frac{B}{2}}}{2\pi}\int_0^{\frac{\pi}{2}} \, dt
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 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{V} \prod_{i=1}^k (N(x_i)\,dx_i) = \int_\mathcal{V} \frac{e^{-(x_1^2 + x_2^2 + \cdots +x_k^2)/2}}{(2\pi)^{k/2}}\,dx_1\,dx_2 \cdots dx_k
where is the standard normal distribution and is that elemental shell volume at Q(x), which is proportional to the (k − 1)-dimensional surface in k-space for which
:
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 , 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{V} dx_1\,dx_2\cdots 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
:
The area of a (k − 1)-sphere is:
:
A=\frac{2R^{k-1}\pi^{k/2}}{\Gamma(k/2)}
Substituting, realizing that , 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