- DSP log - http://www.dsplog.com -

Chi Square Random Variable

Posted By Krishna Sankar On July 28, 2008 @ 6:14 am In DSP | 12 Comments

While trying to derive the theoretical bit error rate (BER) for BPSK modulation in a Rayleigh fading channel, I realized that I need to discuss chi square random variable prior.

## What is chi-square random variable?

Let there be $m$ independent and identically distributed Gaussian random variables $X_i$ with mean $0$ and variance $\sigma^2$ and we form a new random variable,

$Z = \sum_{i=1}^mX_i^2$.

Then $Z$ is a chi square random variable with $m$ degrees of freedom.

There are two types of chi square distribution. The first is obtained when $X_i$ has a zero mean and is called central chi square distribution. The second is obtained when $X_i$ has a non-zero mean and is called non-central chi square distribution. Four our discussion, we will focus only on central chi square distribution.

## PDF of chi-square random variable with one degree of freedom

Using the text in Chapter 2 of [DIGITAL-COMMUNICATION: PROAKIS] [1] as reference.

The most simple example of a chi square random variable is

$Z =X^2$,

where
$X$ is a Gaussian random variable with zero mean and variance $\sigma^2$.

The PDF of $X$ is
$p(x)=\frac{1}{\sqrt{2\pi\sigma^2}}e^{\frac{-x^2}{2\sigma^2}}$.

By definition, the cumulative distribution function [2](CDF) of $Z$ is
$\begin{eqnarray}F_Z(z) &= &P(Z\le z) = P(X^2 \le z)\\& = &P\left(|X|\le \sqrt{z}\right)\end{eqnarray}$.

This simplifies to

$\begin{eqnarray}F_Z(z) = F_X\left(\sqrt{z}\right) - F_X\left(-\sqrt{z}\right)\end{eqnarray}$.

Differentiating the above equation with respect to $z$ to find the probability density function,

$\begin{eqnarray}p_Z(z)& =&\frac{p_x(\sqrt{z})}{2\sqrt{z}} + \frac{p_z(-\sqrt{z})}{2\sqrt{z}}\\& = &\frac{1}{2\sqrt{z}}\frac{1}{\sqrt{2\pi \sigma^2}}\left(e^{\frac{-z}{2\sigma^2}}+e^{\frac{-z}{2\sigma^2}}\right)\end{eqnarray}$.

Summarizing, the pdf of chi square random variable with one degree of freedom is,

$\huge p_Z(z)=\frac{1}{\sqrt{2\pi z\sigma^2}}e^{\frac{-z}{2\sigma^2}}$.

## PDF of chi-square random variable with two degrees of freedom

Chi square random variable with 2 degrees of freedom is,

$Z =X^2+Y^2$,

where,
$X$ and $Y$ are independent Gaussian random variables with zero mean and variance $\sigma^2$.

In the post on Rayleigh random variable, we have shown that PDF of the random variable$A$,

where $A=\sqrt{X^2 + Y^2}$ is

$p_A(a) = \frac{a}{{\sigma^2}}e^{\frac{-a^2}{2\sigma^2}},\ a\ge 0$.

For our current analysis, we know that

$Z=A^2$.

Differentiating both sides,

$dz=2ada$.

Applying this to the above equation, pdf of chi square random variable with two degrees of freedom is,
$\huge p_Z(z) = \frac{1}{{2\sigma^2}}e^{\frac{-z}{2\sigma^2}},\ z\ge 0$.

## PDF of chi-square random variable with m degrees of freedom

The probability density function is,

$\huge p_Z(z) = \frac{1}{{2^{m/2}\sigma^m\Gamma(\frac{m}{2})}}z^{m/2-1}e^{\frac{-z}{2\sigma^2}},\ z\ge 0$, where

the Gamma function $\Gamma(p)$ is defined as,

$\Gamma(p) = \int_0^{\infty}t^{p-1}e^{-t}dt,\ p \ge 0$,

$\Gamma(p) = (p-1)!$ p an integer > 0

$\Gamma(1/2) = \sqrt{\pi}$

$\Gamma(3/2) = \frac{1}{2}\sqrt{\pi}$.

I do not know the proof for deriving the above equation. If any one of you know of good references, kindly let me know. Thanks.

## Simulation Model

Just for your reference, Matlab/Octave simulation model performing the following is provided

(a) Generate chi square random variables having m=1, 2, 3, 4, 5 degrees of freedom

(b) Probability density function is computed and plotted

Click here to download: Matlab/Octave script for simulating PDF of chi square random variable [3]

Figure: PDF of chi square random variable ($\sigma^2$=1)

## Reference

URL to article: http://www.dsplog.com/2008/07/28/chi-square-random-variable/

URLs in this post:

[1] [DIGITAL-COMMUNICATION: PROAKIS]: http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FDigital-Communications-John-Proakis%2Fdp%2F0072321113&tag=dl04-20&linkCode=ur2&camp=1789&creative=9325

[2] cumulative distribution function : http://en.wikipedia.org/wiki/Cumulative_distribution_function

[3] Matlab/Octave script for simulating PDF of chi square random variable: http://www.dsplog.com/db-install/wp-content/uploads/2008/07/pdf_chi_square_random_variable.m

[4] click here to SUBSCRIBE : http://www.feedburner.com/fb/a/emailverifySubmit?feedId=1348583&loc=en_US