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 (\(\mu=0\) and \(\sigma^2=1\)). Now, if the random variable is squared (a mathematical transformation), then the PDF of \(Z^2\) 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 \(Z^2\) are plotted in Figure 1.

The mean of the random variable \(Z\) is \(E(Z) = 0\) and for the transformed variable Z^{2}, the mean is given by \(E(Z^2)=1\). Similarly, the variance of the random variable \(Z\) is \(\sigma^2_Z=1\), whereas the variance of the transformed random variable \(Z^2\) is \(\sigma^2_{Z^2}=2\). In addition to the mean and variance, the shape of the distribution is also changed. The distribution of the transformed variable \(Z^2\) is no longer symmetric. In fact, the distribution is skewed to one side. Also the random variable \(Z^2\) 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 \(Z^2\) follows – “Chi-squared distribution with \(1\) degree of freedom”.

Suppose, if \(Z_1,Z_2,\cdots,Z_k\) are independent random variables that follows standard normal distribution(\(\mu=0\) and \(\sigma^2=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.

The above equation is derived from \(k\) random variables that follow standard normal distribution. For a standard normal distribution, the mean \(\mu=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 [2] . 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 random variable is given by

$$ \mu = E\left[\chi_k^2\right] = k $$

$$ \sigma^2 = var\left[\chi_k^2\right] = 2k $$

## Relation to Rayleigh distribution

The connection between Chi-squared distribution and the Rayleigh distribution can be established as follows

- If a random variable \(R\) has standard Rayleigh distribution, then the transformation \(R^2\) follows chi-square distribution with \(2\) degrees of freedom.
- If a random variable \(C\) has the chi-square distribution with \(2\) degrees of freedom, then the transformation \(\sqrt{C}\) has standard Rayleigh distribution.

## 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.

## 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

## See Also:

[1] Introduction to Random Variables, PDF and CDF

[2] Non-central Chi-squared distribution and its simulation in Matlab

[3] Uniform Random Variables and Uniform Distribution

[4] Derivation of Error Rate Performance of an optimum BPSK receiver in AWGN channel

[5] Eb/N0 Vs BER for BPSK over Rician Fading Channel

[6] BER Vs Eb/N0 for QPSK modulation over AWGN

[7] BER Vs Eb/N0 for 8-PSK modulation over AWGN

[8] Simulation of M-PSK modulation techniques in AWGN channel

[9] Performance comparison of Digital Modulation techniques

[10] **How to use Histogram function in Matlab to plot the estimated PDF curve**

## External Links:

[1] Chi-Square Test Penn State University

[2] Java Applet – Chi Square goodness of Fit test – created by David Eck and modified by Jim Ryan – Mathbeans project

[3] Chi-Square Test for variance ,e-handbook of statistical methods,National Institute of Standards and Technology

[4] Dr. Claude Moore,Estimation of Variance,Cape Fear Community College

Pingback: Simulation of Rayleigh Fading ( Clarke’s Model – sum of sinusoids method) | GaussianWaves()

Pingback: Uniform Random Variables and Uniform Distribution | GaussianWaves()

Pingback: Non-central Chi-squared Distribution | GaussianWaves()

Pingback: Eb/N0 Vs BER for BPSK over Rician Fading Channel | GaussianWaves()

Pingback: Fading channels – Rayleigh Fading | GaussianWaves()