# Q function and Error functions

Q functions are often encountered in the theoretical equations for Bit Error Rate (BER) involving AWGN channel. A brief discussion on Q function and its relation to erfc function is given here.

Gaussian process is the underlying model for an AWGN channel.The probability density function of a Gaussian Distribution is given by

$$p(x) = \frac{1}{ \sigma \sqrt{2 \pi}} e^{ – \frac{(x-\mu)^2}{2 \sigma^2}} \;\;\;\;\;\;\; (1)$$

Generally, in BER derivations, the probability that a Gaussian Random Variable \( X \sim N( \mu, \sigma^2) \) exceeds x_{0} is evaluated as the area of the shaded region as shown in Figure 1.

Mathematically, the area of the shaded region is evaluated as,

$$ Pr(X \geq x_0) = \int_{x_0}^{\infty} p(x) dx = \int_{x_0}^{\infty} \frac{1}{ \sigma \sqrt{2 \pi}} e^{ – \frac{(x-\mu)^2}{2 \sigma^2}} dx \;\;\;\;\;\;\; (2)$$

The above probability density function given inside the above integral cannot be integrated in closed form. So by change of variables method, we substitute

$$ y = \frac{x-\mu}{\sigma} \;\;\;\;\;\;\; (3)$$

Then equation (3) can be re-written as,

$$Pr\left( y > \frac{x_0-\mu}{\sigma} \right ) = \int_{ \left( \frac{x_{0} -\mu}{\sigma}\right)}^{\infty} \frac{1}{ \sqrt{2 \pi}} e^{- \frac{y^2}{2}} dy \;\;\;\;\;\;\; (3)$$

Here the function inside the integral is a normalized gaussian probability density function \( Y \sim N( 0, 1)\), normalized to mean=0 and standard deviation=1.

The integral on the right side can be termed as Q-function, which is given by,

$$Q(z) = \int_{z}^{\infty}\frac{1}{ \sqrt{2 \pi}} e^{- \frac{y^2}{2}} dy \;\;\;\;\;\;\; (4)$$

Here the Q function is related as,

$$ Pr\left( y > \frac{x_0-\mu}{\sigma} \right ) = Q\left(\frac{x_0-\mu}{\sigma} \right ) = Q(z)\;\;\;\;\;\;\; (5)$$

Thus Q function gives the area of the shaded curve with the transformation \( y = \frac{x-\mu}{\sigma}\) applied to the Gaussian probability density function. Essentially, Q function evaluates the tail probability of normal distribution (area of shaded area in the above figure).

### Error functions:

The error function represents the probability that the parameter of interest is within a range between \( \sigma \sqrt{2} \) and \( x/ \sigma \sqrt{2} \) and the complementary error function gives the probability that the parameter lies outside that range.

The error function is given by

$$erf(z) = \frac{2}{\sqrt{\pi}} \int_{0}^{z} e^{-x^2} dx\;\;\;\;\;\;\; (6)$$

and the complementary error function is given by

$$ erfc(z) = 1 – erf(z) \;\;\;\;\;\;\; (7)$$

or equivalently,

$$erfc(z) = \frac{2}{\sqrt{\pi}} \int_{z}^{\infty} e^{-x^2} dx\;\;\;\;\;\;\; (8)$$

### Q function and Complementary Error Function (erfc) :

From the limits of the integrals in equation (4) and (8) one can conclude that Q function is directly related to complementary error function (erfc). It follows from equation (4) and (8), Q function is related to complementary error function by the following relation.

$$Q(z) = \frac{1}{2} erfc \left( \frac{z}{\sqrt{2}}\right) \;\;\;\;\;\;\; (9)$$

### Some important results:

Keep a note of the following equations that can come handy when deriving probability of bit errors for various scenarios. These equations are compiled here for easy reference.

If we have a normal variable \( X \sim N(\mu, \sigma^2)\),the probability that \(X > x\) is

$$ Pr \left( X > x \right) = Q \left( \frac{x-\mu}{\sigma} \right ) \;\;\;\;\;\;\; (10)$$

If we want to know the probaility that X is away from the mean by an amount a (on the left or right side of the mean), then

$$Pr \left( X > \mu+a \right) = Pr \left( X < \mu-a \right) = Q\left(\frac{a}{\sigma} \right ) \;\;\;\;\;\;\; (11)$$

If we want to know the probability that X is away from the mean by an amount a (on both sides of the mean), then

$$ Pr \left( \mu-a > X > \mu+a \right) = 2 Q\left(\frac{a}{\sigma} \right ) \;\;\;\;\;\;\; (12)$$

Application of Q function in computing the Bit Error Rate (BER) or probability of bit error will be the focus of our next article.

### Reference:

[1] Normal Distribution Function – Wolform MathWorld

Pingback: Intuitive derivation of Performance of an optimum BPSK receiver in AWGN channel | GaussianWaves()