(4 votes, average: 4.75 out of 5)

A random variable is always associated with a probability distribution. When the random variable undergoes mathematical transformation the underlying probability distribution no longer remains the same. Consider a random variable Z whose probability distribution function (PDF) is a standard normal distribution (mean=0 and variance=1). Now, if the random variable is squared (a mathematical transformation), then the PDF of Z2 is no longer a standard normal distribution. The new transformed distribution is called Chi-Squared Distribution with 1 degree of freedom. The PDF of Z and Z2 are plotted in Figure 1.

Figure 1: Transformation of Normal Distribution to Chi Squared Distribution

The mean of the random variable Z is E(Z) = 0 and for the transformed variable Z2, the mean is given by E(Z2)=1. Similarly, the variance of the random variable Z is var(Z)=1, whereas the variance of the transformed random variable Z2 is var(Z2)=2. In addition to the mean and variance, the shape of the distribution is also changed. The distribution of the transformed variable Z2 is no longer symmetric. In fact, the distribution is skewed to one side. Also the random variable Z2 can take only positive values whereas the random variable Z can take negative values too (note the x-axis in the plots above).

Since the new transformation is based on only one parameter (Z), the degree of freedom for this transformation is 1. Therefore, the transformed random variable Z2 follows – “Chi-squared distribution with 1 degree of freedom”.
Suppose, if Z1,Z2, …,Zk are independent random variables that follows standard normal distribution(mean=0,variance= 1), then the transformation,

$\chi_k^2 = Z_1^2 + Z_2^2+ \cdots+Z_k^2$

is a Chi-squared distribution with k degrees of freedom. The following figure illustrates how the definition of the Chi-squared distribution as a transformation of normal distribution for 1 degree of freedom and 2 degrees of freedom. In the same manner, the transformation can be extended to ‘k’ degrees of freedom.

Figure 2: Illustration of Chi Squared Distribution with 2 degrees of freedom

The above equation is derived from k random variables that follow standard normal distribution. For a standard normal distribution, the mean=0. Therefore, the transformation $\chi_k^2$ is called “central” Chi-square distribution. If, the underlying ‘k’ random variables follow normal distribution with non-zero mean, then the transformation $\chi_k^2$ is called “non-central” Chi-square distribution. In channel modeling, the central Chi-square distribution is related to Rayleigh Fading scenario and the non-central Chi-square distribution is related to Rician Fading scenario.

Mathematically, the PDF of the central Chi-squared distribution with ‘k’ degrees of freedom is given by

$f_{\chi_k^2 }(x)= \frac{1}{2^{\frac{k}{2}}\Gamma \left(\frac{k}{2}\right )}x^{\frac{k}{2}-1}e^{-\frac{x}{2}}$

The mean and variance of the central Chi-squared distributed andom variable is given by

## Applications:

Chi-squared distribution is used in hypothesis testing (to compare the observed data with expected data that follows a specific hypothesis) and in estimating variances of a parameter. It is related to Rayleigh distribution.

## Matlab Simulation:

The following Matlab code is used to simulated central Chi-squared distributed variables with degrees of freedom = 1,2,3,4 and 5. Finally the PDFs of the simulated variables are plotted.

Check this book for full Matlab code.
Simulation of Digital Communication Systems Using Matlab – by Mathuranathan Viswanathan

Simulated output – central Chi squared Distribution with k degrees of freedom