The following are proofs of several characteristics related to the chi-squared distribution.
Derivations of the pdf
[edit]
Derivation of the pdf for one degree of freedom
[edit]
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,
![{\displaystyle {\begin{aligned}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{aligned}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/97af62b514763ef66509524d8a0965cb766d8355)
Where
and
are the cdf and pdf of the corresponding random variables.
Then
The change of variable formula (implicitly derived above), for a monotonic transformation
, is:
![{\displaystyle f_{Y}(y)=\sum _{i}f_{X}(g_{i}^{-1}(y))\left|{\frac {dg_{i}^{-1}(y)}{dy}}\right|.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/2759b7e26c5b7f286c6ecadec6dbfa550a5400f4)
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.
![{\displaystyle f_{Y}(y)=2f_{X}(g^{-1}(y))\left|{\frac {dg^{-1}(y)}{dy}}\right|.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/57f4674302af1273e9ca28d3115ec5e9d91fcc16)
In this case, the transformation is:
, and its derivative is
So here:
![{\displaystyle f_{Y}(y)=2{\frac {1}{\sqrt {2\pi }}}e^{-y/2}{\frac {1}{2{\sqrt {y}}}}={\frac {1}{\sqrt {2\pi y}}}e^{-y/2}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/505d29170afe32fcb1823bfffdde7bf35a59e52a)
And one gets the chi-squared distribution, noting the property of the gamma function:
.
Derivation of the pdf for two degrees of freedom
[edit]
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:
![{\displaystyle f_{X}(x)={\frac {1}{2^{\frac {1}{2}}\Gamma ({\frac {1}{2}})}}x^{-{\frac {1}{2}}}e^{-{\frac {x}{2}}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/3a6ab93cba99639ba3e0c27174733bf5c432ece4)
and of course
. Then, we can derive the joint distribution of
:
![{\displaystyle f(x,y)=f_{X}(x)\,f_{Y}(y)={\frac {1}{2\pi }}(xy)^{-{\frac {1}{2}}}e^{-{\frac {x+y}{2}}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c21449412ca7e47cdab518e71ea6416d16e038df)
where
. Further[clarification needed], let
and
, we can get that:
![{\displaystyle x={\frac {B+{\sqrt {B^{2}-4A}}}{2}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/6ed47669c0bcf5b2c4162bd1be0f803174e52113)
and
![{\displaystyle y={\frac {B-{\sqrt {B^{2}-4A}}}{2}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e077ad29cc466885e9ec046186e28631c37305ee)
or, inversely
![{\displaystyle x={\frac {B-{\sqrt {B^{2}-4A}}}{2}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/601ce2c0b5fdaf7633f126b48010459a9e050e2a)
and
![{\displaystyle y={\frac {B+{\sqrt {B^{2}-4A}}}{2}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/7f58e94bfa2e757353b4b52710abe727d2d95c1d)
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[clarification needed]:
![{\displaystyle \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}}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/0a0c71f64f51f990ddb9884b12b5430edadb9a3f)
Now we can change
to
[clarification needed]:
![{\displaystyle f(A,B)=2\times {\frac {1}{2\pi }}A^{-{\frac {1}{2}}}e^{-{\frac {B}{2}}}(B^{2}-4A)^{-{\frac {1}{2}}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/b89437811bc685ef99910ec77aa658f95885fc5e)
where the leading constant 2 is to take both the two variable change policies into account. Finally, we integrate out
[clarification needed] to get the distribution of
, i.e.
:
![{\displaystyle 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}](https://wikimedia.org/api/rest_v1/media/math/render/svg/03a685aae017f47c53836dfa21b67b856d57c036)
Substituting
gives:
![{\displaystyle f(B)=2\times {\frac {e^{-{\frac {B}{2}}}}{2\pi }}\int _{0}^{\frac {\pi }{2}}\,dt}](https://wikimedia.org/api/rest_v1/media/math/render/svg/705cb8065882a86eef9374829c4235eeb469e526)
So, the result is:
![{\displaystyle f(B)={\frac {e^{-{\frac {B}{2}}}}{2}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/2c783d5f9ed26f54d26e5cb3b8157900a82430e0)
Derivation of the pdf for k degrees of freedom
[edit]
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:
![{\displaystyle 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}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/4d6fa3714bcf0594b9c8f1389371d033388931b4)
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
![{\displaystyle Q=\sum _{i=1}^{k}x_{i}^{2}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a539cf87f7bd2423d0b80274f137df50e1fe33cb)
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.
![{\displaystyle P(Q)\,dQ={\frac {e^{-Q/2}}{(2\pi )^{k/2}}}\int _{\mathcal {V}}dx_{1}\,dx_{2}\cdots dx_{k}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/01effe428c72fb9fd61c9f67e2d38f82fcf2198e)
The integral is now simply the surface area A of the (k − 1)-sphere times the infinitesimal thickness of the sphere which is
![{\displaystyle dR={\frac {dQ}{2Q^{1/2}}}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/bfcdef832300e7e8dc16fea7cd3a73fd45c153f7)
The area of a (k − 1)-sphere is:
![{\displaystyle A={\frac {2R^{k-1}\pi ^{k/2}}{\Gamma (k/2)}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9800f1db5df777211eb39badc8c90081a4e75b37)
Substituting, realizing that
, and cancelling terms yields:
![{\displaystyle 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}](https://wikimedia.org/api/rest_v1/media/math/render/svg/5bb3cf52bc321e2ff32094f28e175ed152407834)