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.
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,
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.
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 is called “central” Chi-square distribution. If, the underlying ‘k’ random variables follow normal distribution with non-zero mean, then the transformation 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
The mean and variance of the central Chi-squared distributed andom variable is given by
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.
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
 Introduction to Random Variables, PDF and CDF
 Non-central Chi-squared distribution and its simulation in Matlab
 Uniform Random Variables and Uniform Distribution
 Derivation of Error Rate Performance of an optimum BPSK receiver in AWGN channel
 Eb/N0 Vs BER for BPSK over Rician Fading Channel
 BER Vs Eb/N0 for QPSK modulation over AWGN
 BER Vs Eb/N0 for 8-PSK modulation over AWGN
 Simulation of M-PSK modulation techniques in AWGN channel
 Performance comparison of Digital Modulation techniques
 Chi-Square Test Penn State University
 Java Applet – Chi Square goodness of Fit test – created by David Eck and modified by Jim Ryan – Mathbeans project
 Chi-Square Test for variance ,e-handbook of statistical methods,National Institute of Standards and Technology
  Dr. Claude Moore,Estimation of Variance,Cape Fear Community College